You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by bo...@apache.org on 2011/08/18 13:03:18 UTC

svn commit: r1159162 - in /logging/log4net/trunk: log4net.build log4net.include

Author: bodewig
Date: Thu Aug 18 11:03:18 2011
New Revision: 1159162

URL: http://svn.apache.org/viewvc?rev=1159162&view=rev
Log:
some initial attempts at building with and for .NET 4.0 - requires NAnt 0.91alpha2

Modified:
    logging/log4net/trunk/log4net.build
    logging/log4net/trunk/log4net.include

Modified: logging/log4net/trunk/log4net.build
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/log4net.build?rev=1159162&r1=1159161&r2=1159162&view=diff
==============================================================================
--- logging/log4net/trunk/log4net.build (original)
+++ logging/log4net/trunk/log4net.build Thu Aug 18 11:03:18 2011
@@ -121,6 +121,14 @@ limitations under the License.
         <if test="${not framework::exists('net-3.5')}">
           <echo message=".NET Framework 3.5 runtime is not available." />
         </if>
+        <!-- .NET Framework 4.0 -->
+        <if test="${framework::exists('net-4.0')}">
+          <property name="nant.settings.currentframework" value="net-4.0" />
+          <call target="display-target-framework" />
+        </if>
+        <if test="${not framework::exists('net-4.0')}">
+          <echo message=".NET Framework 4.0 runtime is not available." />
+        </if>
         <!-- .NET Compact Framework 1.0 -->
         <if test="${framework::exists('netcf-1.0')}">
             <property name="nant.settings.currentframework" value="netcf-1.0" />
@@ -304,6 +312,18 @@ limitations under the License.
             <echo message="The .NET Framework 3.5 is not available. Build skipped." />
           </if>
         </if>
+        <!-- NET_3_5 -->
+        <if test="${framework::exists('net-4.0')}">
+          <call target="compile-net-4.0" />
+        </if>
+        <if test="${not framework::exists('net-4.0')}">
+          <if test="${property::exists('project.build.package') and project.build.package}">
+            <fail message="The .NET Framework 4.0 is not available." />
+          </if>
+          <if test="${not(property::exists('project.build.package') and project.build.package)}">
+            <echo message="The .NET Framework 4.0 is not available. Build skipped." />
+          </if>
+        </if>
         <!-- MONO_1_0 -->
         <if test="${framework::exists('mono-1.0')}">
             <call target="compile-mono-1.0" />
@@ -725,6 +745,72 @@ limitations under the License.
       </csc>
     </if>
   </target>
+  <target name="compile-net-4.0" description="Builds .NET Framework 4.0 version" depends="set-net-4.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
+    <!-- initialize the temp.build.skip property to false -->
+    <property name="temp.build.skip" value="false" />
+    <if test="${current.build.config.release}">
+      <!-- check if the log4net key file is available -->
+      <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
+        <if test="${property::exists('project.build.package') and project.build.package}">
+          <fail message="Key file not found." />
+        </if>
+        <if test="${not(property::exists('project.build.package') and project.build.package)}">
+          <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
+          <echo message="The generated key file should be stored in the log4net base directory." />
+          <echo message="The release build will be skipped." />
+          <property name="temp.build.skip" value="true" />
+        </if>
+      </if>
+    </if>
+    <if test="${not temp.build.skip}">
+      <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
+        <nowarn>
+          <!-- warning CS1058: A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException -->
+          <warning number="1058" />
+        </nowarn>
+        <sources basedir="${log4net.basedir}/src">
+          <include name="**/*.cs" />
+        </sources>
+        <resources failonempty="true">
+          <include name="${log4net.basedir}/NOTICE" />
+          <include name="${log4net.basedir}/LICENSE" />
+        </resources>
+        <references>
+          <include name="mscorlib.dll" />
+          <include name="System.dll" />
+          <include name="System.Data.dll" />
+          <include name="System.Web.dll" />
+          <include name="System.Xml.dll" />
+          <include name="System.Configuration.dll" />
+          <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
+          <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
+        </references>
+      </csc>      
+      <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
+        <nowarn>
+          <!-- warning CS1058: A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException -->
+          <warning number="1058" />
+        </nowarn>
+        <sources basedir="${log4net.basedir}/src">
+          <include name="**/*.cs" />
+        </sources>
+        <resources failonempty="true">
+          <include name="${log4net.basedir}/NOTICE" />
+          <include name="${log4net.basedir}/LICENSE" />
+        </resources>
+        <references>
+          <include name="mscorlib.dll" />
+          <include name="System.dll" />
+          <include name="System.Data.dll" />
+          <include name="System.Web.dll" />
+          <include name="System.Xml.dll" />
+          <include name="System.Configuration.dll" />
+          <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
+          <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
+        </references>
+      </csc>
+    </if>
+  </target>
     <target name="compile-mono-1.0" description="Builds Mono 1.0 version" depends="set-mono-1.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
         <!-- initialize the temp.build.skip property to false -->
         <property name="temp.build.skip" value="false" />

Modified: logging/log4net/trunk/log4net.include
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/log4net.include?rev=1159162&r1=1159161&r2=1159162&view=diff
==============================================================================
--- logging/log4net/trunk/log4net.include (original)
+++ logging/log4net/trunk/log4net.include Thu Aug 18 11:03:18 2011
@@ -252,6 +252,19 @@ limitations under the License.
       <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />      
       <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
     </target>
+    <!-- uses NET_2_0 plus NET_4_0 defines -->
+    <target name="set-net-4.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
+      <property name="nant.settings.currentframework" value="net-4.0" />
+      <property name="current.build.debug" value="${build.debug}" dynamic="true" />
+      <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0,NET_4_0" dynamic="true" />
+      <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0,NET_4_0" dynamic="true" />
+      <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True,NET_4_0=True" dynamic="true" />
+      <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0,NET_4_0" dynamic="true" />
+      <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0 /D NET_4_0" dynamic="true" />
+      <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
+      <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />      
+      <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
+    </target>
     <target name="set-netcf-1.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
         <property name="nant.settings.currentframework" value="netcf-1.0" />
         <property name="current.build.debug" value="${build.debug}" dynamic="true" />