Author: nicko
Date: Mon Feb 12 17:17:20 2007
New Revision: 506790

URL: http://svn.apache.org/viewvc?view=rev&rev=506790
Log:
Fixed LOG4NET-92.
Added support for .NET Compact Framework 2.0.

Modified:
    logging/log4net/trunk/log4net.build
    logging/log4net/trunk/log4net.include
    logging/log4net/trunk/src/Appender/AnsiColorTerminalAppender.cs
    logging/log4net/trunk/src/Appender/ConsoleAppender.cs
    logging/log4net/trunk/src/Config/XmlConfigurator.cs
    logging/log4net/trunk/src/Core/LogException.cs
    logging/log4net/trunk/src/Core/LoggingEvent.cs
    logging/log4net/trunk/src/Layout/XMLLayout.cs
    logging/log4net/trunk/src/NDC.cs
    logging/log4net/trunk/src/Util/SystemInfo.cs
    logging/log4net/trunk/src/Util/ThreadContextStack.cs
    
logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs
    logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs

Modified: logging/log4net/trunk/log4net.build
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/log4net.build?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/log4net.build (original)
+++ logging/log4net/trunk/log4net.build Mon Feb 12 17:17:20 2007
@@ -106,7 +106,15 @@
         <if test="${not framework::exists('netcf-1.0')}">
             <echo message=".NET Compact Framework 1.0 runtime is not 
available." />
         </if>
-        <!-- Mono 1.0 -->
+               <!-- .NET Compact Framework 2.0 -->
+               <if test="${framework::exists('netcf-2.0')}">
+                       <property name="nant.settings.currentframework" 
value="netcf-2.0" />
+                       <call target="display-target-framework" />
+               </if>
+               <if test="${not framework::exists('netcf-2.0')}">
+                       <echo message=".NET Compact Framework 2.0 runtime is 
not available." />
+               </if>
+               <!-- Mono 1.0 -->
         <if test="${framework::exists('mono-1.0')}">
             <property name="nant.settings.currentframework" value="mono-1.0" />
             <call target="display-target-framework" />
@@ -186,6 +194,7 @@
     <!-- Target for compiling all runtime configurations in the current build 
configuration -->
     <target name="compile-build" description="Compile current build 
configurations for all runtime configurations">
         <echo message="Compiling all framework versions for the 
${current.build.config} build configuration." />
+               <!-- NETCF_1_0 -->
         <if test="${framework::exists('netcf-1.0')}">
             <call target="compile-netcf-1.0" />
         </if>
@@ -198,7 +207,21 @@
                     message="The .NET Compact Framework 1.0 is not available. 
Build skipped." />
             </if>
         </if>
-        <if test="${framework::exists('net-1.0')}">
+               <!-- NETCF_2_0 -->
+               <if test="${framework::exists('netcf-2.0')}">
+                       <call target="compile-netcf-2.0" />
+               </if>
+               <if test="${not framework::exists('netcf-2.0')}">
+                       <if test="${property::exists('project.build.package') 
and project.build.package}">
+                               <fail message="The .NET Compact Framework 2.0 
is not available." />
+                       </if>
+                       <if 
test="${not(property::exists('project.build.package') and 
project.build.package)}">
+                               <echo 
+                    message="The .NET Compact Framework 2.0 is not available. 
Build skipped." />
+                       </if>
+               </if>
+               <!-- NET_1_0 -->
+               <if test="${framework::exists('net-1.0')}">
             <call target="compile-net-1.0" />
             <call target="compile-cli-1.0" />
         </if>
@@ -210,18 +233,20 @@
                 <echo message="The .NET Framework 1.0 is not available. Build 
skipped." />
             </if>
         </if>
-        <if test="${framework::exists('net-1.1')}">
-            <call target="compile-net-1.1" />
-        </if>
-        <if test="${not framework::exists('net-1.1')}">
-            <if test="${property::exists('project.build.package') and 
project.build.package}">
-                <fail message="The .NET Framework 1.1 is not available." />
-            </if>
-            <if test="${not(property::exists('project.build.package') and 
project.build.package)}">
-                <echo message="The .NET Framework 1.1 is not available. Build 
skipped." />
-            </if>
-        </if>
-        <if test="${framework::exists('net-2.0')}">
+               <!-- NET_1_1 -->
+               <if test="${framework::exists('net-1.1')}">
+                       <call target="compile-net-1.1" />
+               </if>
+               <if test="${not framework::exists('net-1.1')}">
+                       <if test="${property::exists('project.build.package') 
and project.build.package}">
+                               <fail message="The .NET Framework 1.1 is not 
available." />
+                       </if>
+                       <if 
test="${not(property::exists('project.build.package') and 
project.build.package)}">
+                               <echo message="The .NET Framework 1.1 is not 
available. Build skipped." />
+                       </if>
+               </if>
+               <!-- NET_2_0 -->
+               <if test="${framework::exists('net-2.0')}">
             <call target="compile-net-2.0" />
         </if>
         <if test="${not framework::exists('net-2.0')}">
@@ -231,8 +256,9 @@
             <if test="${not(property::exists('project.build.package') and 
project.build.package)}">
                 <echo message="The .NET Framework 2.0 is not available. Build 
skipped." />
             </if>
-        </if> 
-        <if test="${framework::exists('mono-1.0')}">
+        </if>
+               <!-- MONO_1_0 -->
+               <if test="${framework::exists('mono-1.0')}">
             <call target="compile-mono-1.0" />
         </if>
         <if test="${not framework::exists('mono-1.0')}">
@@ -243,7 +269,8 @@
                 <echo message="Mono 1.0 is not available. Build skipped." />
             </if>
         </if>
-        <if test="${framework::exists('mono-2.0')}">
+               <!-- MONO_2_0 -->
+               <if test="${framework::exists('mono-2.0')}">
             <call target="compile-mono-2.0" />
         </if>
         <if test="${not framework::exists('mono-2.0')}">
@@ -254,7 +281,8 @@
                 <echo message="Mono 2.0 is not available. Build skipped." />
             </if>
         </if>
-        <if test="${framework::exists('sscli-1.0')}">
+               <!-- SSCLI_1_0 -->
+               <if test="${framework::exists('sscli-1.0')}">
             <call target="compile-sscli-1.0" />
         </if>
         <if test="${not framework::exists('sscli-1.0')}">
@@ -306,7 +334,44 @@
             </csc>
         </if>
     </target>
-    <target name="compile-net-1.0" description="Builds .NET Framework 1.0 
version" depends="set-net-1.0-runtime-configuration, check-log4net-basedir, 
clean-current-bin-dir">
+       <target name="compile-netcf-2.0" description="Builds .NET Compact 
Framework 2.0 version" depends="set-netcf-2.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 test="${file::exists(log4net.basedir + 
'/log4net.snk')}">
+                               <!-- copy the log4net key file to the location 
where the compiler expects it to be -->
+                               <copy file="${log4net.basedir}/log4net.snk" 
todir="${current.bin.dir}/../../../" />
+                       </if>
+               </if>
+               <if test="${not temp.build.skip}">
+                       <csc 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">
+                               <sources basedir="${log4net.basedir}/src">
+                                       <include name="**/*.cs" />
+                               </sources>
+                               <references>
+                                       <include name="mscorlib.dll" />
+                                       <include name="System.dll" />
+                                       <include name="System.Data.dll" />
+                                       <include name="System.Xml.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-net-1.0" description="Builds .NET Framework 1.0 
version" depends="set-net-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" />
         <if test="${current.build.config.release}">
@@ -598,6 +663,10 @@
         <echo message="Generating SDK documentation based on the 
${current.build.config} build configuration for all runtime configurations." />
         <if test="${framework::exists('netcf-1.0')}">
             <call target="set-netcf-1.0-runtime-configuration" />
+            <call target="generate-sdkdoc" />
+        </if>
+        <if test="${framework::exists('netcf-2.0')}">
+            <call target="set-netcf-2.0-runtime-configuration" />
             <call target="generate-sdkdoc" />
         </if>
         <if test="${framework::exists('net-1.0')}">

Modified: logging/log4net/trunk/log4net.include
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/log4net.include?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/log4net.include (original)
+++ logging/log4net/trunk/log4net.include Mon Feb 12 17:17:20 2007
@@ -231,9 +231,21 @@
         <property name="current.build.debug" value="${build.debug}" 
dynamic="true" />
         <property name="current.build.defines.csc" 
value="${build.defines.csc},NETCF,NETCF_1_0" dynamic="true" />
         <property name="current.build.defines.jsc" 
value="${build.defines.jsc},NETCF,NETCF_1_0" dynamic="true" />
-        <property name="current.build.defines.vbc" 
value="${build.defines.vbc},NETCF=True" dynamic="true" />
-        <property name="current.build.defines.vjc" 
value="${build.defines.vjc},NETCF" dynamic="true" />
+        <property name="current.build.defines.vbc" 
value="${build.defines.vbc},NETCF=True,NETCF_1_0=True" dynamic="true" />
+        <property name="current.build.defines.vjc" 
value="${build.defines.vjc},NETCF,NETCF_1_0" dynamic="true" />
         <property name="current.build.defines.cl" value="${build.defines.cl} 
/D NETCF /D NETCF_1_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-2.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-2.0" />
+        <property name="current.build.debug" value="${build.debug}" 
dynamic="true" />
+        <property name="current.build.defines.csc" 
value="${build.defines.csc},NETCF,NETCF_2_0" dynamic="true" />
+        <property name="current.build.defines.jsc" 
value="${build.defines.jsc},NETCF,NETCF_2_0" dynamic="true" />
+        <property name="current.build.defines.vbc" 
value="${build.defines.vbc},NETCF=True,NETCF_2_0=True" dynamic="true" />
+        <property name="current.build.defines.vjc" 
value="${build.defines.vjc},NETCF,NETCF_2_0" dynamic="true" />
+        <property name="current.build.defines.cl" value="${build.defines.cl} 
/D NETCF /D NETCF_2_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" />

Modified: logging/log4net/trunk/src/Appender/AnsiColorTerminalAppender.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/AnsiColorTerminalAppender.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Appender/AnsiColorTerminalAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/AnsiColorTerminalAppender.cs Mon Feb 12 
17:17:20 2007
@@ -334,7 +334,7 @@
                                }
                        }
 
-#if NETCF
+#if NETCF_1_0
                        // Write to the output stream
                        Console.Write(loggingMessage);
 #else

Modified: logging/log4net/trunk/src/Appender/ConsoleAppender.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/ConsoleAppender.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Appender/ConsoleAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/ConsoleAppender.cs Mon Feb 12 17:17:20 
2007
@@ -150,7 +150,7 @@
                /// </remarks>
                override protected void Append(LoggingEvent loggingEvent) 
                {
-#if NETCF
+#if NETCF_1_0
                        // Write to the output stream
                        Console.Write(RenderLoggingEvent(loggingEvent));
 #else

Modified: logging/log4net/trunk/src/Config/XmlConfigurator.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Config/XmlConfigurator.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Config/XmlConfigurator.cs (original)
+++ logging/log4net/trunk/src/Config/XmlConfigurator.cs Mon Feb 12 17:17:20 2007
@@ -547,7 +547,7 @@
 
                                        if (configRequest != null)
                                        {
-#if !NETCF
+#if !NETCF_1_0
                                                // authentication may be 
required, set client to use default credentials
                                                try
                                                {

Modified: logging/log4net/trunk/src/Core/LogException.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Core/LogException.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Core/LogException.cs (original)
+++ logging/log4net/trunk/src/Core/LogException.cs Mon Feb 12 17:17:20 2007
@@ -18,7 +18,9 @@
 #endregion
 
 using System;
+#if !NETCF
 using System.Runtime.Serialization;
+#endif
 
 namespace log4net.Core
 {

Modified: logging/log4net/trunk/src/Core/LoggingEvent.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Core/LoggingEvent.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Core/LoggingEvent.cs (original)
+++ logging/log4net/trunk/src/Core/LoggingEvent.cs Mon Feb 12 17:17:20 2007
@@ -18,10 +18,10 @@
 #endregion
 
 using System;
-using System.Runtime.Serialization;
 using System.Collections;
 using System.IO;
 #if (!NETCF)
+using System.Runtime.Serialization;
 using System.Security.Principal;
 #endif
 

Modified: logging/log4net/trunk/src/Layout/XMLLayout.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/XMLLayout.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Layout/XMLLayout.cs (original)
+++ logging/log4net/trunk/src/Layout/XMLLayout.cs Mon Feb 12 17:17:20 2007
@@ -220,7 +220,7 @@
                        writer.WriteStartElement(m_elmEvent);
                        writer.WriteAttributeString(ATTR_LOGGER, 
loggingEvent.LoggerName);
 
-#if NET_2_0 || MONO_2_0
+#if NET_2_0 || NETCF_2_0 || MONO_2_0
                        writer.WriteAttributeString(ATTR_TIMESTAMP, 
XmlConvert.ToString(loggingEvent.TimeStamp, 
XmlDateTimeSerializationMode.Local));
 #else
                        writer.WriteAttributeString(ATTR_TIMESTAMP, 
XmlConvert.ToString(loggingEvent.TimeStamp));

Modified: logging/log4net/trunk/src/NDC.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/NDC.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/NDC.cs (original)
+++ logging/log4net/trunk/src/NDC.cs Mon Feb 12 17:17:20 2007
@@ -20,7 +20,7 @@
 using System;
 using System.Collections;
 
-#if NETCF
+#if NETCF_1_0
 using Stack = log4net.Util.ThreadContextStack.Stack;
 #endif
 

Modified: logging/log4net/trunk/src/Util/SystemInfo.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/SystemInfo.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Util/SystemInfo.cs (original)
+++ logging/log4net/trunk/src/Util/SystemInfo.cs Mon Feb 12 17:17:20 2007
@@ -223,9 +223,9 @@
                {
                        get 
                        {
-#if NETCF
+#if NETCF_1_0
                                return 
System.Threading.Thread.CurrentThread.GetHashCode();
-#elif NET_2_0
+#elif NET_2_0 || NETCF_2_0 || MONO_2_0
                                return 
System.Threading.Thread.CurrentThread.ManagedThreadId;
 #else
                                return AppDomain.GetCurrentThreadId();
@@ -678,7 +678,7 @@
                        {
                                // Includes explicit assembly name
                                //LogLog.Debug("SystemInfo: Loading type 
["+typeName+"] from global Type");
-#if NETCF
+#if NETCF_1_0
                                return Type.GetType(typeName, throwOnError);
 #else
                                return Type.GetType(typeName, throwOnError, 
ignoreCase);
@@ -698,7 +698,7 @@
                /// </remarks>
                public static Guid NewGuid()
                {
-#if NETCF
+#if NETCF_1_0
                        return PocketGuid.NewGuid();
 #else
                        return Guid.NewGuid();
@@ -726,8 +726,10 @@
                /// </remarks>
                public static ArgumentOutOfRangeException 
CreateArgumentOutOfRangeException(string parameterName, object actualValue, 
string message)
                {
-#if NETCF
-                       return new ArgumentOutOfRangeException(message + " 
param: " + parameterName + " value: " + actualValue);
+#if NETCF_1_0
+                       return new ArgumentOutOfRangeException(message + " 
[param=" + parameterName + "] [value=" + actualValue + "]");
+#elif NETCF_2_0
+                       return new ArgumentOutOfRangeException(parameterName, 
message + " [value=" + actualValue + "]");
 #else
                        return new ArgumentOutOfRangeException(parameterName, 
actualValue, message);
 #endif
@@ -921,8 +923,10 @@
                /// </remarks>
                public static Hashtable CreateCaseInsensitiveHashtable()
                {
-#if NETCF
+#if NETCF_1_0
                        return new 
Hashtable(CaseInsensitiveHashCodeProvider.Default, 
CaseInsensitiveComparer.Default);
+#elif NETCF_2_0 || NET_2_0 || MONO_2_0
+                       return new Hashtable(StringComparer.OrdinalIgnoreCase);
 #else
                        return 
System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
 #endif
@@ -1016,7 +1020,7 @@
                #endregion
 
                #region Compact Framework Helper Classes
-#if NETCF
+#if NETCF_1_0
                /// <summary>
                /// Generate GUIDs on the .NET Compact Framework.
                /// </summary>

Modified: logging/log4net/trunk/src/Util/ThreadContextStack.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/ThreadContextStack.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Util/ThreadContextStack.cs (original)
+++ logging/log4net/trunk/src/Util/ThreadContextStack.cs Mon Feb 12 17:17:20 
2007
@@ -19,7 +19,7 @@
 
 using System;
 
-#if !NETCF
+#if !NETCF_1_0
 using System.Collections;
 #endif
 
@@ -380,7 +380,7 @@
                        #endregion Implementation of IDisposable
                }
 
-#if NETCF
+#if NETCF_1_0
                /// <summary>
                /// Subclass of <see cref="System.Collections.Stack"/> to
                /// provide missing methods.

Modified: 
logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- 
logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs
 (original)
+++ 
logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs
 Mon Feb 12 17:17:20 2007
@@ -18,7 +18,9 @@
 #endregion
 
 using System;
+#if !NETCF
 using System.Runtime.Serialization;
+#endif
 
 namespace log4net.Util.TypeConverters
 {

Modified: logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs?view=diff&rev=506790&r1=506789&r2=506790
==============================================================================
--- logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs 
(original)
+++ logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs Mon Feb 
12 17:17:20 2007
@@ -77,13 +77,16 @@
                        {
                                try
                                {
-#if NET_2_0
+#if NET_2_0 || NETCF_2_0
+
+#if !NETCF_2_0
                                        // Try an explicit parse of string 
representation of an IPAddress (v4 or v6)
                                        IPAddress result;
                                        if (IPAddress.TryParse(str, out result))
                                        {
                                                return result;
                                        }
+#endif
 
                                        // Try to resolve via DNS. This is a 
blocking call. 
                                        // GetHostEntry works with either an 
IPAddress string or a host name


Reply via email to