Author: hammett
Date: Mon Sep 27 07:34:26 2004
New Revision: 47291

Added:
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ModuleScope.cs
   (contents, props changed)
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/CachedTypeTestCase.cs
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Classes/MySerializableClass.cs
   (contents, props changed)
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/SerializableClassTestCase.cs
   (contents, props changed)
Modified:
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Apache.Avalon.DynamicProxy.csproj
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/InterfaceProxyGenerator.cs
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/DefaultProxyBuilder.cs
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxy-compilations.build
   
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Apache.Avalon.DynamicProxy.Test.csproj
Log:
added Type Cache and ModuleScope.

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Apache.Avalon.DynamicProxy.csproj
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Apache.Avalon.DynamicProxy.csproj
   (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Apache.Avalon.DynamicProxy.csproj
   Mon Sep 27 07:34:26 2004
@@ -56,7 +56,7 @@
                     NoStdLib = "false"
                     NoWarn = ""
                     Optimize = "true"
-                    OutputPath = "bin\Release\"
+                    OutputPath = "..\..\bin\"
                     RegisterForComInterop = "false"
                     RemoveIntegerChecks = "false"
                     TreatWarningsAsErrors = "false"
@@ -130,6 +130,11 @@
                 />
                 <File
                     RelPath = 
"Builder\CodeGenerators\InterfaceProxyGenerator.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Builder\CodeGenerators\ModuleScope.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
 (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/BaseCodeGenerator.cs
 Mon Sep 27 07:34:26 2004
@@ -1,4 +1,5 @@
- // Copyright 2004 The Apache Software Foundation
+using System.Text;
+// Copyright 2004 The Apache Software Foundation
 // 
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -24,24 +25,29 @@
        /// </summary>
        public abstract class BaseCodeGenerator
        {
-               private static readonly String FILE_NAME = 
"GeneratedAssembly.dll";
 
-               private Type m_baseType = typeof(Object);
-               private AssemblyBuilder m_assemblyBuilder;
+               private Type m_baseType = typeof (Object);
                private TypeBuilder m_typeBuilder;
                private FieldBuilder m_handlerField;
                private ConstructorBuilder m_constBuilder;
                private IList m_generated = new ArrayList();
 
                private GeneratorContext m_context;
+               private ModuleScope m_moduleScope;
 
-               protected BaseCodeGenerator(GeneratorContext context)
+               protected BaseCodeGenerator(ModuleScope moduleScope) : 
this(moduleScope, new GeneratorContext())
                {
+               }
+
+               protected BaseCodeGenerator(ModuleScope moduleScope, 
GeneratorContext context)
+               {
+                       m_moduleScope = moduleScope;
                        m_context = context;
                }
 
-               protected BaseCodeGenerator() : this(new GeneratorContext())
+               protected ModuleScope ModuleScope
                {
+                       get { return m_moduleScope; }
                }
 
                protected GeneratorContext Context
@@ -64,37 +70,35 @@
                        get { return m_constBuilder; }
                }
 
-               protected virtual ModuleBuilder CreateDynamicModule()
+               protected Type GetFromCache( Type baseClass, Type[] interfaces )
                {
-                       AssemblyName assemblyName = new AssemblyName();
-                       assemblyName.Name = "DynamicAssemblyProxyGen";
-
-                       ModuleBuilder moduleBuilder = null;
-
-#if (DEBUG)
-                       m_assemblyBuilder =
-                               AppDomain.CurrentDomain.DefineDynamicAssembly(
-                                       assemblyName,
-                                       AssemblyBuilderAccess.RunAndSave);
-                       moduleBuilder = 
m_assemblyBuilder.DefineDynamicModule(assemblyName.Name, FILE_NAME);
-#else
-                       m_assemblyBuilder =
-                               AppDomain.CurrentDomain.DefineDynamicAssembly(
-                                       assemblyName,
-                                       AssemblyBuilderAccess.Run);
-                       moduleBuilder = 
m_assemblyBuilder.DefineDynamicModule(assemblyName.Name, true);
-#endif
+                       return ModuleScope[ GenerateTypeName( baseClass, 
interfaces ) ] as Type;
+               }
 
-                       return moduleBuilder;
+               protected void RegisterInCache( Type generatedType )
+               {
+                       ModuleScope[ generatedType.Name ] = generatedType;
                }
 
                protected virtual TypeBuilder CreateTypeBuilder(Type baseType, 
Type[] interfaces)
                {
-                       ModuleBuilder moduleBuilder = CreateDynamicModule();
+                       String typeName = GenerateTypeName(baseType, 
interfaces);
+
+                       ModuleBuilder moduleBuilder = 
ModuleScope.ObtainDynamicModule();
+
+                       TypeAttributes flags = TypeAttributes.Public | 
TypeAttributes.Class; 
+
+                       if (baseType != typeof(Object))
+                       {
+                               if (baseType.IsSerializable)
+                               {
+                                       flags |= TypeAttributes.Serializable;
+                               }
+                       }
 
                        m_baseType = baseType;
                        m_typeBuilder = moduleBuilder.DefineType(
-                               "ProxyType", TypeAttributes.Public | 
TypeAttributes.Class, baseType, interfaces);
+                               typeName, flags, baseType, interfaces);
 
                        m_handlerField = GenerateField();
                        m_constBuilder = GenerateConstructor();
@@ -102,6 +106,18 @@
                        return m_typeBuilder;
                }
 
+               protected virtual String GenerateTypeName(Type type, Type[] 
interfaces)
+               {
+                       StringBuilder sb = new StringBuilder();
+                       foreach(Type inter in interfaces)
+                       {
+                               sb.Append('_');
+                               sb.Append(inter.Name);
+                       }
+                       /// Naive implementation
+                       return String.Format("ProxyType{0}{1}", type.Name, 
sb.ToString());
+               }
+
                protected virtual void EnhanceType()
                {
                        if (Context.EnhanceType != null)
@@ -123,9 +139,9 @@
                protected virtual Type CreateType()
                {
                        Type newType = MainTypeBuilder.CreateType();
-#if (DEBUG)
-                       m_assemblyBuilder.Save(FILE_NAME);
-#endif
+
+                       RegisterInCache( newType );
+
                        return newType;
                }
 
@@ -135,7 +151,7 @@
                /// <returns><see cref="FieldBuilder"/> instance</returns>
                protected FieldBuilder GenerateField()
                {
-                       return GenerateField("handler", typeof 
(IInvocationHandler) );
+                       return GenerateField("handler", typeof 
(IInvocationHandler));
                }
 
                /// <summary>
@@ -144,10 +160,10 @@
                /// <param name="name">Field's name</param>
                /// <param name="type">Field's type</param>
                /// <returns></returns>
-               protected FieldBuilder GenerateField( String name, Type type )
+               protected FieldBuilder GenerateField(String name, Type type)
                {
                        return m_typeBuilder.DefineField(name,
-                               typeof (IInvocationHandler), 
FieldAttributes.Public);
+                                                        typeof 
(IInvocationHandler), FieldAttributes.Public);
                }
 
                /// <summary>
@@ -181,7 +197,7 @@
                {
                        foreach(Type inter in interfaces)
                        {
-                               if (!Context.ShouldSkip( inter ))
+                               if (!Context.ShouldSkip(inter))
                                {
                                        GenerateTypeImplementation(inter, 
false);
                                }
@@ -194,7 +210,7 @@
                /// </summary>
                /// <param name="type">Type class</param>
                /// <param name="ignoreInterfaces">Interface type</param>
-               protected void GenerateTypeImplementation(Type type, bool 
ignoreInterfaces )
+               protected void GenerateTypeImplementation(Type type, bool 
ignoreInterfaces)
                {
                        if (m_generated.Contains(type))
                        {
@@ -202,7 +218,7 @@
                        }
                        else
                        {
-                               m_generated.Add( type );
+                               m_generated.Add(type);
                        }
 
                        if (!ignoreInterfaces)
@@ -216,7 +232,7 @@
                        GenerateMethods(type, propertiesBuilder);
                }
 
-               protected virtual PropertyBuilder[] GenerateProperties( Type 
inter )
+               protected virtual PropertyBuilder[] GenerateProperties(Type 
inter)
                {
                        PropertyInfo[] properties = inter.GetProperties();
                        PropertyBuilder[] propertiesBuilder = new 
PropertyBuilder[properties.Length];
@@ -229,7 +245,7 @@
                        return propertiesBuilder;
                }
 
-               protected virtual void GenerateMethods( Type inter, 
PropertyBuilder[] propertiesBuilder )
+               protected virtual void GenerateMethods(Type inter, 
PropertyBuilder[] propertiesBuilder)
                {
                        MethodInfo[] methods = inter.GetMethods();
 

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
       (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ClassProxyGenerator.cs
       Mon Sep 27 07:34:26 2004
@@ -21,11 +21,11 @@
        /// </summary>
        public class ClassProxyGenerator : BaseCodeGenerator
        {
-               public ClassProxyGenerator() : base()
+               public ClassProxyGenerator(ModuleScope scope) : base(scope)
                {
                }
 
-               public ClassProxyGenerator(GeneratorContext context) : 
base(context)
+               public ClassProxyGenerator(ModuleScope scope, GeneratorContext 
context) : base(scope, context)
                {
                }
 
@@ -33,6 +33,13 @@
                {
                        Type[] interfaces = new Type[0];
                        interfaces = ScreenInterfaces(interfaces);
+
+                       Type cacheType = GetFromCache(baseClass, interfaces);
+                       
+                       if (cacheType != null)
+                       {
+                               return cacheType;
+                       }
 
                        CreateTypeBuilder( baseClass, interfaces );
                        GenerateTypeImplementation( baseClass, true );

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/InterfaceProxyGenerator.cs
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/InterfaceProxyGenerator.cs
   (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/InterfaceProxyGenerator.cs
   Mon Sep 27 07:34:26 2004
@@ -21,17 +21,24 @@
        /// </summary>
        public class InterfaceProxyGenerator : BaseCodeGenerator
        {
-               public InterfaceProxyGenerator() : base()
+               public InterfaceProxyGenerator(ModuleScope scope) : base(scope)
                {
                }
 
-               public InterfaceProxyGenerator(GeneratorContext context) : 
base(context)
+               public InterfaceProxyGenerator(ModuleScope scope, 
GeneratorContext context) : base(scope, context)
                {
                }
 
                public virtual Type GenerateCode(Type[] interfaces)
                {
                        interfaces = ScreenInterfaces(interfaces);
+
+                       Type cacheType = GetFromCache(typeof(Object), 
interfaces);
+                       
+                       if (cacheType != null)
+                       {
+                               return cacheType;
+                       }
 
                        CreateTypeBuilder( typeof(Object), interfaces );
                        GenerateInterfaceImplementation( interfaces );

Added: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ModuleScope.cs
==============================================================================
--- (empty file)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/CodeGenerators/ModuleScope.cs
       Mon Sep 27 07:34:26 2004
@@ -0,0 +1,80 @@
+// Copyright 2004 The Apache Software Foundation
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Apache.Avalon.DynamicProxy.Builder.CodeGenerators
+{
+       using System;
+       using System.Reflection;
+       using System.Reflection.Emit;
+       using System.Collections;
+
+       /// <summary>
+       /// Summary description for ModuleScope.
+       /// </summary>
+       public class ModuleScope
+       {
+               private static readonly String FILE_NAME = 
"GeneratedAssembly.dll";
+
+               /// <summary>
+               /// Avoid leaks caused by non disposal of generated types.
+               /// </summary>
+               private ModuleBuilder m_moduleBuilder = null;
+
+               /// <summary>
+               /// Keep track of generated types
+               /// </summary>
+               private Hashtable m_typeCache = Hashtable.Synchronized(new 
Hashtable());
+
+               /// <summary>
+               /// Used to lock the module builder creation
+               /// </summary>
+               private object m_lockobj = new object();
+
+               private AssemblyBuilder m_assemblyBuilder;
+
+               public ModuleBuilder ObtainDynamicModule()
+               {
+                       lock (m_lockobj)
+                       {
+                               if (m_moduleBuilder == null)
+                               {
+                                       AssemblyName assemblyName = new 
AssemblyName();
+                                       assemblyName.Name = 
"DynamicAssemblyProxyGen";
+
+#if ( DEBUG )
+                                       m_assemblyBuilder =
+                                               
AppDomain.CurrentDomain.DefineDynamicAssembly(
+                                               assemblyName,
+                                               
AssemblyBuilderAccess.RunAndSave);
+                                       m_moduleBuilder = 
m_assemblyBuilder.DefineDynamicModule(assemblyName.Name, FILE_NAME);
+#else
+                                       m_assemblyBuilder =
+                                               
AppDomain.CurrentDomain.DefineDynamicAssembly(
+                                                       assemblyName,
+                                                       
AssemblyBuilderAccess.Run);
+                                       m_moduleBuilder = 
m_assemblyBuilder.DefineDynamicModule(assemblyName.Name, true);
+#endif
+                               }
+                       }
+
+                       return m_moduleBuilder;
+               }
+
+               public Type this[String name]
+               {
+                       get { return m_typeCache[name] as Type; }
+                       set { m_typeCache[name] = value; }
+               }
+       }
+}

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/DefaultProxyBuilder.cs
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/DefaultProxyBuilder.cs
      (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/Builder/DefaultProxyBuilder.cs
      Mon Sep 27 07:34:26 2004
@@ -1,4 +1,3 @@
-using Apache.Avalon.DynamicProxy.Builder.CodeGenerators;
 // Copyright 2004 The Apache Software Foundation
 // 
 // Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,35 +15,43 @@
 namespace Apache.Avalon.DynamicProxy.Builder
 {
        using System;
+       using Apache.Avalon.DynamicProxy.Builder.CodeGenerators;
 
        /// <summary>
        /// Summary description for DefaultProxyBuilder.
        /// </summary>
        public class DefaultProxyBuilder : IProxyBuilder
        {
+               ModuleScope m_scope = new ModuleScope();
+
+               public DefaultProxyBuilder()
+               {
+                       
+               }
+
                #region IProxyBuilder Members
 
                public virtual Type CreateInterfaceProxy(Type[] interfaces)
                {
-                       InterfaceProxyGenerator generator = new 
InterfaceProxyGenerator();
+                       InterfaceProxyGenerator generator = new 
InterfaceProxyGenerator(m_scope);
                        return generator.GenerateCode( interfaces );
                }
 
                public virtual Type CreateClassProxy(Type theClass)
                {
-                       ClassProxyGenerator generator = new 
ClassProxyGenerator();
+                       ClassProxyGenerator generator = new 
ClassProxyGenerator(m_scope);
                        return generator.GenerateCode( theClass );
                }
 
                public virtual Type CreateCustomInterfaceProxy(Type[] 
interfaces, GeneratorContext context)
                {
-                       InterfaceProxyGenerator generator = new 
InterfaceProxyGenerator(context);
+                       InterfaceProxyGenerator generator = new 
InterfaceProxyGenerator(m_scope, context);
                        return generator.GenerateCode( interfaces );
                }
 
                public virtual Type CreateCustomClassProxy(Type theClass, 
GeneratorContext context)
                {
-                       ClassProxyGenerator generator = new 
ClassProxyGenerator(context);
+                       ClassProxyGenerator generator = new 
ClassProxyGenerator(m_scope, context);
                        return generator.GenerateCode( theClass );
                }
 

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxy-compilations.build
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxy-compilations.build
     (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxy-compilations.build
     Mon Sep 27 07:34:26 2004
@@ -1,300 +1,300 @@
-<?xml version="1.0" ?>
-<!--
- Copyright 2003-2004 The Apache Software Foundation
- 
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- 
-     http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project name="dynamicproxy-helper" xmlnds="http://tempuri.org/nant-vs.xsd";>
-
-    <target name="compile-runtime" description="Compile all build 
configurations for the current runtime configuration"
-        depends="check-current-runtime-config, check-current-runtime-version">
-
-        <echo message="Compiling all build configurations for the 
${current.runtime.config}-${current.runtime.version} runtime configuration." />
-        <call target="set-debug-build-configuration" />
-        <!-- make sure that the runtime properties that rely on build 
configuration information are refreshed -->
-        <call target="set-runtime-configuration" />
-        <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-        <call target="set-release-build-configuration" />
-        <!-- make sure that the runtime properties that rely on build 
configuration information are refreshed -->
-        <call target="set-runtime-configuration" />
-        <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-    </target>
-
-    <target name="compile-build" description="Compile current build 
configurations for all runtime configurations">
-        <echo message="Compiling all runtime configurations for the 
${current.build.config} build configuration." />
-        <available type="Framework" resource="net-1.0" 
property="temp.framework.available" />
-        <if propertytrue="temp.framework.available">
-            <call target="set-net-1.0-runtime-configuration" />
-            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-        </if>
-        <ifnot propertytrue="temp.framework.available">
-            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <fail message="The .NET Framework 1.0 is not available." />
-            </if>
-            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <echo message="The .NET Framework 1.0 is not available. Build 
skipped." />
-            </ifnot>
-        </ifnot>
-        <available type="Framework" resource="net-1.1" 
property="temp.framework.available" />
-        <if propertytrue="temp.framework.available">
-            <call target="set-net-1.1-runtime-configuration" />
-            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-        </if>
-        <ifnot propertytrue="temp.framework.available">
-            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <fail message="The .NET Framework 1.1 is not available." />
-            </if>
-            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <echo message="The .NET Framework 1.1 is not available. Build 
skipped." />
-            </ifnot>
-        </ifnot>
-        <available type="Framework" resource="mono-1.0" 
property="temp.framework.available" />
-        <if propertytrue="temp.framework.available">
-            <call target="set-mono-1.0-runtime-configuration" />
-            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-        </if>
-        <ifnot propertytrue="temp.framework.available">
-            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <fail message="Mono 1.0 is not available." />
-            </if>
-            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <echo message="Mono 1.0 is not available. Build skipped." />
-            </ifnot>
-        </ifnot>
-        <available type="Framework" resource="sscli-1.0" 
property="temp.framework.available" />
-        <if propertytrue="temp.framework.available">
-            <call target="set-sscli-1.0-runtime-configuration" />
-            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-        </if>
-        <ifnot propertytrue="temp.framework.available">
-            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <fail message="SSCLI 1.0 is not available." />
-            </if>
-            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                <echo message="SSCLI 1.0 is not available. Build skipped." />
-            </ifnot>
-        </ifnot>
-    </target>
-
-    <target name="compile" description="Builds the current build configuration 
for the current runtime configuration."
-        depends="check-current-build-config, check-current-runtime-config, 
check-current-runtime-version">
-        <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
-    </target>
-
-    <target name="compile-net-1.0" description="Builds .NET Framework 1.0 
version" depends="set-net-1.0-runtime-configuration, check-castle-basedir">
-        <!-- make sure the current binaries directory exists and is cleaned -->
-        <call target="clean-current-bin-dir" />
-        <!-- initialize the temp.build.skip property to false -->
-        <property name="temp.build.skip" value="false" readonly="false" />
-        <if propertytrue="current.build.config.release">
-            <!-- check if the Avalon key file is available -->
-            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
-            <ifnot propertytrue="temp.avalon.keyfile.available">
-                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <fail message="Key file not found." />
-                </if>
-                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
-                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
-                    <echo message="The release build will be skipped." />
-                    <property name="temp.build.skip" value="true" 
readonly="false" />
-                </ifnot>
-            </ifnot>
-            <if propertytrue="temp.avalon.keyfile.available">
-                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
-                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
-            </if>
-        </if>
-        <ifnot propertytrue="temp.build.skip">
-            <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
-                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}" 
doc="${current.bin.dir}/${dynproxy.doc}">
-                <sources basedir="${dynproxy.src}" defaultexcludes="true">
-                    <includes name="**/*.cs" />
-                    <excludes name="${dynproxy.test.name}/*.*" />
-                </sources>
-                <references defaultexcludes="true">
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
-                        fromPath="false" />
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" 
fromPath="false" />
-                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
-                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
-                        fromPath="false" />
-                </references>
-            </csc>
-        </ifnot>
-        <!-- Execute the testcases -->
-        <call target="run-tests" />
-    </target>
-
-    <target name="compile-net-1.1" description="Builds .NET Framework 1.1 
version" depends="set-net-1.1-runtime-configuration, check-castle-basedir">
-        <!-- make sure the current binaries directory exists and is cleaned -->
-        <call target="clean-current-bin-dir" />
-        <!-- initialize the temp.build.skip property to false -->
-        <property name="temp.build.skip" value="false" readonly="false" />
-        <if propertytrue="current.build.config.release">
-            <!-- check if the Avalon key file is available -->
-            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
-            <ifnot propertytrue="temp.avalon.keyfile.available">
-                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <fail message="Key file not found." />
-                </if>
-                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
-                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
-                    <echo message="The release build will be skipped." />
-                    <property name="temp.build.skip" value="true" 
readonly="false" />
-                </ifnot>
-            </ifnot>
-            <if propertytrue="temp.avalon.keyfile.available">
-                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
-                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
-            </if>
-        </if>
-        <ifnot propertytrue="temp.build.skip">
-            <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
-                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}" 
doc="${current.bin.dir}/${dynproxy.doc}">
-                <sources basedir="${dynproxy.src}" defaultexcludes="true">
-                    <includes name="**/*.cs" />
-                    <excludes name="${dynproxy.test.name}/*.*" />
-                </sources>
-                <references defaultexcludes="true">
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
-                        fromPath="false" />
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" 
fromPath="false" />
-                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
-                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
-                        fromPath="false" />
-                </references>
-            </csc>
-        </ifnot>
-        <!-- Execute the testcases -->
-        <call target="run-tests" />
-    </target>
-
-    <target name="compile-mono-1.0" description="Builds Mono 1.0 version" 
depends="set-mono-1.0-runtime-configuration, check-castle-basedir">
-        <!-- make sure the current binaries directory exists and is cleaned -->
-        <call target="clean-current-bin-dir" />
-        <!-- initialize the temp.build.skip property to false -->
-        <property name="temp.build.skip" value="false" readonly="false" />
-        <if propertytrue="current.build.config.release">
-            <!-- check if the Avalon key file is available -->
-            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
-            <ifnot propertytrue="temp.avalon.keyfile.available">
-                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <fail message="Key file not found." />
-                </if>
-                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
-                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
-                    <echo message="The release build will be skipped." />
-                    <property name="temp.build.skip" value="true" 
readonly="false" />
-                </ifnot>
-            </ifnot>
-            <if propertytrue="temp.avalon.keyfile.available">
-                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
-                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
-            </if>
-        </if>
-        <ifnot propertytrue="temp.build.skip">
-            <csc nostdlib="false" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
-                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}">
-                <sources basedir="${dynproxy.src}" defaultexcludes="true">
-                    <includes name="**/*.cs" />
-                    <excludes name="${dynproxy.test.name}/*.*" />
-                </sources>
-                <references defaultexcludes="true">
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" 
fromPath="false" />
-                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
-                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
-                        fromPath="false" />
-                </references>
-            </csc>
-        </ifnot>
-        <!-- Execute the testcases -->
-        <call target="run-tests" />
-    </target>
-
-    <target name="compile-sscli-1.0" description="Builds SSCLI 1.0 version" 
depends="set-sscli-1.0-runtime-configuration, check-castle-basedir">
-        <!-- make sure the current binaries directory exists and is cleaned -->
-        <call target="clean-current-bin-dir" />
-        <!-- initialize the temp.build.skip property to false -->
-        <property name="temp.build.skip" value="false" readonly="false" />
-        <if propertytrue="current.build.config.release">
-            <!-- check if the Avalon key file is available -->
-            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
-            <ifnot propertytrue="temp.avalon.keyfile.available">
-                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <fail message="Key file not found." />
-                </if>
-                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
-                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
-                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
-                    <echo message="The release build will be skipped." />
-                    <property name="temp.build.skip" value="true" 
readonly="false" />
-                </ifnot>
-            </ifnot>
-            <if propertytrue="temp.avalon.keyfile.available">
-                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
-                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
-            </if>
-        </if>
-        <ifnot propertytrue="temp.build.skip">
-            <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
-                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}">
-                <sources basedir="${dynproxy.src}" defaultexcludes="true">
-                    <includes name="**/*.cs" />
-                    <excludes name="${dynproxy.test.name}/*.*" />
-                </sources>
-                <references defaultexcludes="true">
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
-                        fromPath="false" />
-                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" 
fromPath="false" />
-                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
-                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
-                        fromPath="false" />
-                </references>
-            </csc>
-        </ifnot>
-        <!-- Execute the testcases -->
-        <call target="run-tests" />
-    </target>
-
-    <target name="compile-tests" description="Compile test cases">
-        <echo message="NAnt location is ${nant.location}" />
-        <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
-            define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.test.assembly}">
-            <sources basedir="${dynproxy.test.src}" defaultexcludes="true">
-                <includes name="**/*.cs" />
-            </sources>
-            <references defaultexcludes="true">
-                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
-                    fromPath="false" />
-                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" 
fromPath="false" />
-                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Runtime.Remoting.dll"
 fromPath="false" />
-                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Data.dll"
-                    fromPath="false" />
-                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Web.dll"
-                    fromPath="false" />
-                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Xml.dll"
-                    fromPath="false" />
-                <includes name="${nant.location}/nunit.framework.dll"
-                    fromPath="false" />
-                <includes name="${current.bin.dir}/${dynproxy.assembly}" 
fromPath="false" />
-                <!-- allow for third party assemblies to be referenced by just 
storing them in the lib/<framework>/<framework version>/<build configuration> 
directory -->
-                <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
-                    fromPath="false" />
-            </references>
-        </csc>
-    </target>
-
-</project>
+<?xml version="1.0" ?>
+<!--
+ Copyright 2003-2004 The Apache Software Foundation
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project name="dynamicproxy-helper" xmlnds="http://tempuri.org/nant-vs.xsd";>
+
+    <target name="compile-runtime" description="Compile all build 
configurations for the current runtime configuration"
+        depends="check-current-runtime-config, check-current-runtime-version">
+
+        <echo message="Compiling all build configurations for the 
${current.runtime.config}-${current.runtime.version} runtime configuration." />
+        <call target="set-debug-build-configuration" />
+        <!-- make sure that the runtime properties that rely on build 
configuration information are refreshed -->
+        <call target="set-runtime-configuration" />
+        <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+        <call target="set-release-build-configuration" />
+        <!-- make sure that the runtime properties that rely on build 
configuration information are refreshed -->
+        <call target="set-runtime-configuration" />
+        <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+    </target>
+
+    <target name="compile-build" description="Compile current build 
configurations for all runtime configurations">
+        <echo message="Compiling all runtime configurations for the 
${current.build.config} build configuration." />
+        <available type="Framework" resource="net-1.0" 
property="temp.framework.available" />
+        <if propertytrue="temp.framework.available">
+            <call target="set-net-1.0-runtime-configuration" />
+            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+        </if>
+        <ifnot propertytrue="temp.framework.available">
+            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <fail message="The .NET Framework 1.0 is not available." />
+            </if>
+            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <echo message="The .NET Framework 1.0 is not available. Build 
skipped." />
+            </ifnot>
+        </ifnot>
+        <available type="Framework" resource="net-1.1" 
property="temp.framework.available" />
+        <if propertytrue="temp.framework.available">
+            <call target="set-net-1.1-runtime-configuration" />
+            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+        </if>
+        <ifnot propertytrue="temp.framework.available">
+            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <fail message="The .NET Framework 1.1 is not available." />
+            </if>
+            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <echo message="The .NET Framework 1.1 is not available. Build 
skipped." />
+            </ifnot>
+        </ifnot>
+        <available type="Framework" resource="mono-1.0" 
property="temp.framework.available" />
+        <if propertytrue="temp.framework.available">
+            <call target="set-mono-1.0-runtime-configuration" />
+            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+        </if>
+        <ifnot propertytrue="temp.framework.available">
+            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <fail message="Mono 1.0 is not available." />
+            </if>
+            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <echo message="Mono 1.0 is not available. Build skipped." />
+            </ifnot>
+        </ifnot>
+        <available type="Framework" resource="sscli-1.0" 
property="temp.framework.available" />
+        <if propertytrue="temp.framework.available">
+            <call target="set-sscli-1.0-runtime-configuration" />
+            <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+        </if>
+        <ifnot propertytrue="temp.framework.available">
+            <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <fail message="SSCLI 1.0 is not available." />
+            </if>
+            <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                <echo message="SSCLI 1.0 is not available. Build skipped." />
+            </ifnot>
+        </ifnot>
+    </target>
+
+    <target name="compile" description="Builds the current build configuration 
for the current runtime configuration."
+        depends="check-current-build-config, check-current-runtime-config, 
check-current-runtime-version">
+        <call 
target="compile-${current.runtime.config}-${current.runtime.version}" />
+    </target>
+
+    <target name="compile-net-1.0" description="Builds .NET Framework 1.0 
version" depends="set-net-1.0-runtime-configuration, check-castle-basedir">
+        <!-- make sure the current binaries directory exists and is cleaned -->
+        <call target="clean-current-bin-dir" />
+        <!-- initialize the temp.build.skip property to false -->
+        <property name="temp.build.skip" value="false" readonly="false" />
+        <if propertytrue="current.build.config.release">
+            <!-- check if the Avalon key file is available -->
+            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
+            <ifnot propertytrue="temp.avalon.keyfile.available">
+                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <fail message="Key file not found." />
+                </if>
+                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
+                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
+                    <echo message="The release build will be skipped." />
+                    <property name="temp.build.skip" value="true" 
readonly="false" />
+                </ifnot>
+            </ifnot>
+            <if propertytrue="temp.avalon.keyfile.available">
+                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
+                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
+            </if>
+        </if>
+        <ifnot propertytrue="temp.build.skip">
+            <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
+                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}" 
doc="${current.bin.dir}/${dynproxy.doc}">
+                <sources basedir="${dynproxy.src}" defaultexcludes="true">
+                    <includes name="**/*.cs" />
+                    <excludes name="${dynproxy.test.name}/*.*" />
+                </sources>
+                <references defaultexcludes="true">
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
+                         />
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll"  
/>
+                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
+                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
+                         />
+                </references>
+            </csc>
+        </ifnot>
+        <!-- Execute the testcases -->
+        <call target="run-tests" />
+    </target>
+
+    <target name="compile-net-1.1" description="Builds .NET Framework 1.1 
version" depends="set-net-1.1-runtime-configuration, check-castle-basedir">
+        <!-- make sure the current binaries directory exists and is cleaned -->
+        <call target="clean-current-bin-dir" />
+        <!-- initialize the temp.build.skip property to false -->
+        <property name="temp.build.skip" value="false" readonly="false" />
+        <if propertytrue="current.build.config.release">
+            <!-- check if the Avalon key file is available -->
+            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
+            <ifnot propertytrue="temp.avalon.keyfile.available">
+                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <fail message="Key file not found." />
+                </if>
+                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
+                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
+                    <echo message="The release build will be skipped." />
+                    <property name="temp.build.skip" value="true" 
readonly="false" />
+                </ifnot>
+            </ifnot>
+            <if propertytrue="temp.avalon.keyfile.available">
+                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
+                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
+            </if>
+        </if>
+        <ifnot propertytrue="temp.build.skip">
+            <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
+                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}" 
doc="${current.bin.dir}/${dynproxy.doc}">
+                <sources basedir="${dynproxy.src}" defaultexcludes="true">
+                    <includes name="**/*.cs" />
+                    <excludes name="${dynproxy.test.name}/*.*" />
+                </sources>
+                <references defaultexcludes="true">
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
+                        />
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll"  
/>
+                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
+                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
+                         />
+                </references>
+            </csc>
+        </ifnot>
+        <!-- Execute the testcases -->
+        <call target="run-tests" />
+    </target>
+
+    <target name="compile-mono-1.0" description="Builds Mono 1.0 version" 
depends="set-mono-1.0-runtime-configuration, check-castle-basedir">
+        <!-- make sure the current binaries directory exists and is cleaned -->
+        <call target="clean-current-bin-dir" />
+        <!-- initialize the temp.build.skip property to false -->
+        <property name="temp.build.skip" value="false" readonly="false" />
+        <if propertytrue="current.build.config.release">
+            <!-- check if the Avalon key file is available -->
+            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
+            <ifnot propertytrue="temp.avalon.keyfile.available">
+                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <fail message="Key file not found." />
+                </if>
+                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
+                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
+                    <echo message="The release build will be skipped." />
+                    <property name="temp.build.skip" value="true" 
readonly="false" />
+                </ifnot>
+            </ifnot>
+            <if propertytrue="temp.avalon.keyfile.available">
+                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
+                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
+            </if>
+        </if>
+        <ifnot propertytrue="temp.build.skip">
+            <csc nostdlib="false" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
+                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}">
+                <sources basedir="${dynproxy.src}" defaultexcludes="true">
+                    <includes name="**/*.cs" />
+                    <excludes name="${dynproxy.test.name}/*.*" />
+                </sources>
+                <references defaultexcludes="true">
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" 
/>
+                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
+                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
+                        />
+                </references>
+            </csc>
+        </ifnot>
+        <!-- Execute the testcases -->
+        <call target="run-tests" />
+    </target>
+
+    <target name="compile-sscli-1.0" description="Builds SSCLI 1.0 version" 
depends="set-sscli-1.0-runtime-configuration, check-castle-basedir">
+        <!-- make sure the current binaries directory exists and is cleaned -->
+        <call target="clean-current-bin-dir" />
+        <!-- initialize the temp.build.skip property to false -->
+        <property name="temp.build.skip" value="false" readonly="false" />
+        <if propertytrue="current.build.config.release">
+            <!-- check if the Avalon key file is available -->
+            <available type="File" 
resource="${dynproxy.basedir}/${dynproxy.key}" 
property="temp.avalon.keyfile.available" />
+            <ifnot propertytrue="temp.avalon.keyfile.available">
+                <if propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <fail message="Key file not found." />
+                </if>
+                <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
+                    <echo message="Key file not found. You can generate a key 
file by running 'sn -k ${dynproxy.key}'." />
+                    <echo message="The generated key file should be stored in 
the DynamicProxy base directory." />
+                    <echo message="The release build will be skipped." />
+                    <property name="temp.build.skip" value="true" 
readonly="false" />
+                </ifnot>
+            </ifnot>
+            <if propertytrue="temp.avalon.keyfile.available">
+                <!-- copy the Avalon key file to the location where the 
compiler expects it to be -->
+                <copy file="${dynproxy.basedir}/${dynproxy.key}" 
todir="${current.bin.dir}/../../../" if="${current.build.config.release}" />
+            </if>
+        </if>
+        <ifnot propertytrue="temp.build.skip">
+            <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
+                define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.assembly}">
+                <sources basedir="${dynproxy.src}" defaultexcludes="true">
+                    <includes name="**/*.cs" />
+                    <excludes name="${dynproxy.test.name}/*.*" />
+                </sources>
+                <references defaultexcludes="true">
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
+                         />
+                    <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll"  
/>
+                    <!-- allow for third party assemblies to be referenced by 
just storing them in the lib/<framework>/<framework version>/<build 
configuration> directory -->
+                    <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
+                         />
+                </references>
+            </csc>
+        </ifnot>
+        <!-- Execute the testcases -->
+        <call target="run-tests" />
+    </target>
+
+    <target name="compile-tests" description="Compile test cases">
+        <echo message="NAnt location is ${nant.location}" />
+        <csc nostdlib="true" noconfig="true" warnaserror="false" 
target="library" debug="${current.build.debug}"
+            define="${current.build.defines.csc}" 
output="${current.bin.dir}/${dynproxy.test.assembly}">
+            <sources basedir="${dynproxy.test.src}" defaultexcludes="true">
+                <includes name="**/*.cs" />
+            </sources>
+            <references defaultexcludes="true">
+                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/mscorlib.dll"
+                    />
+                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll"  
/>
+                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Runtime.Remoting.dll"
  />
+                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Data.dll"
+                     />
+                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Web.dll"
+                     />
+                <includes 
name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Xml.dll"
+                     />
+                <includes name="${nant.location}/nunit.framework.dll"
+                    />
+                <includes name="${current.bin.dir}/${dynproxy.assembly}"  />
+                <!-- allow for third party assemblies to be referenced by just 
storing them in the lib/<framework>/<framework version>/<build configuration> 
directory -->
+                <includes 
name="lib/${current.runtime.config}/${current.runtime.version}/${current.build.config}/*.dll"
+                     />
+            </references>
+        </csc>
+    </target>
+
+</project>

Modified: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Apache.Avalon.DynamicProxy.Test.csproj
==============================================================================
--- 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Apache.Avalon.DynamicProxy.Test.csproj
     (original)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Apache.Avalon.DynamicProxy.Test.csproj
     Mon Sep 27 07:34:26 2004
@@ -56,7 +56,7 @@
                     NoStdLib = "false"
                     NoWarn = ""
                     Optimize = "true"
-                    OutputPath = "bin\Release\"
+                    OutputPath = "..\..\bin\"
                     RegisterForComInterop = "false"
                     RemoveIntegerChecks = "false"
                     TreatWarningsAsErrors = "false"
@@ -87,7 +87,8 @@
                 <Reference
                     Name = "nunit.framework"
                     AssemblyName = "nunit.framework"
-                    HintPath = 
"..\..\..\..\..\..\dotnet\NUnit2\bin\nunit.framework.dll"
+                    HintPath = 
"..\..\..\..\..\..\dotnet\NUnit22\bin\nunit.framework.dll"
+                    AssemblyFolderKey = "hklm\dn\nunit.framework"
                 />
             </References>
         </Build>
@@ -99,12 +100,27 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "CachedTypeTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "CustomProxyGeneratorTestCase.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
                     RelPath = "ProxyGeneratorTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "SerializableClassTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Classes\MySerializableClass.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />

Added: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/CachedTypeTestCase.cs
==============================================================================
--- (empty file)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/CachedTypeTestCase.cs
      Mon Sep 27 07:34:26 2004
@@ -0,0 +1,46 @@
+using Apache.Avalon.DynamicProxy.Test.Classes;
+// Copyright 2004 The Apache Software Foundation
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Apache.Avalon.DynamicProxy.Test
+{
+       using System;
+
+       using NUnit.Framework;
+
+       /// <summary>
+       /// Summary description for CachedTypeTestCase.
+       /// </summary>
+       [TestFixture]
+       public class CachedTypeTestCase
+       {
+               private ProxyGenerator m_generator = new ProxyGenerator();
+
+               [Test]
+               public void CachedClassProxies()
+               {
+                       object proxy = m_generator.CreateClassProxy( 
+                               typeof(ServiceClass), new 
StandardInvocationHandler( new ServiceClass() ) );
+                       
+                       Assert.IsNotNull(proxy);
+                       Assert.IsTrue( typeof(ServiceClass).IsAssignableFrom( 
proxy.GetType() ) );
+
+                       proxy = m_generator.CreateClassProxy( 
+                               typeof(ServiceClass), new 
StandardInvocationHandler( new ServiceClass() ) );
+                       
+                       Assert.IsNotNull(proxy);
+                       Assert.IsTrue( typeof(ServiceClass).IsAssignableFrom( 
proxy.GetType() ) );
+               }
+       }
+}

Added: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Classes/MySerializableClass.cs
==============================================================================
--- (empty file)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/Classes/MySerializableClass.cs
     Mon Sep 27 07:34:26 2004
@@ -0,0 +1,30 @@
+// Copyright 2004 The Apache Software Foundation
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Apache.Avalon.DynamicProxy.Test.Classes
+{
+       using System;
+
+       /// <summary>
+       /// Summary description for MySerializableClass.
+       /// </summary>
+       [Serializable]
+       public class MySerializableClass
+       {
+               public double CalculateSumDistanceNow()
+               {
+                       return Math.PI;
+               }
+       }
+}

Added: 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/SerializableClassTestCase.cs
==============================================================================
--- (empty file)
+++ 
avalon/trunk/central/laboratory/avalon-net/DynamicProxy/DynamicProxyTest/SerializableClassTestCase.cs
       Mon Sep 27 07:34:26 2004
@@ -0,0 +1,40 @@
+using Apache.Avalon.DynamicProxy.Test.Classes;
+// Copyright 2004 The Apache Software Foundation
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Apache.Avalon.DynamicProxy.Test
+{
+       using System;
+
+       using NUnit.Framework;
+
+       /// <summary>
+       /// Summary description for SerializableClassTestCase.
+       /// </summary>
+       [TestFixture]
+       public class SerializableClassTestCase : Assertion
+       {
+               [Test]
+               public void CreateSerializable()
+               {
+                       MySerializableClass myClass = new MySerializableClass();
+
+                       ProxyGenerator generator = new ProxyGenerator();
+                       MySerializableClass proxy = (MySerializableClass) 
+                               generator.CreateClassProxy( 
typeof(MySerializableClass), new StandardInvocationHandler(myClass) );
+
+                       Assert( proxy.GetType().IsSerializable );
+               }
+       }
+}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to