Fixing MR-189, helpers accessing the cotext via the controller vs. static variable.
[castle.git] / common.xml
bloba6211ce4e235aa6777705bd33de3de360af46290
1 <?xml version="1.0"?>\r
2 <project name="Castle" xmlns="http://nant.sf.net/release/0.85/nant.xsd">\r
3         <!-- \r
4                 Use this to determine if the key file CastleKey.snk should be used to \r
5                 sign the assemblies. Defaults to true since private key is present\r
6                 in SVN.\r
7         -->\r
8         <property name="sign" value="true" overwrite="false" />\r
9         <property name="key.file" value="${root.dir}/CastleKey.snk" />\r
11         <!-- Controls whether tests are run. Setting this is as input to the build disables *all* tests. -->\r
12         <property name="common.run-tests" value="true" overwrite="false" />\r
14         <!-- properties used to connect to database for testing -->\r
15         <property name="ar.dialect" value="NHibernate.Dialect.MsSql2000Dialect" overwrite="false" />\r
16         <property name="ar.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" overwrite="false" />\r
17         <property name="ar.connection.connection_string.1" value="Server=(local);initial catalog=test;Integrated Security=SSPI" overwrite="false" />\r
18         <property name="ar.connection.connection_string.2" value="Server=(local);initial catalog=test2;Integrated Security=SSPI" overwrite="false" />\r
20         <!-- \r
21                 Path to the folder that contain the external assemblies.  For net-1.1 the values will\r
22                 be lib, lib/net, and lib/net/1.1 respectively.\r
23         -->\r
24         <property name="lib.dir" value="SharedLibs" dynamic="true" />\r
25         <property name="lib.family.dir" value="${path::combine(lib.dir, framework::get-family(framework::get-target-framework()))}" dynamic="true" />\r
26         <property name="lib.framework.dir" value="${path::combine(lib.family.dir, version::to-string(framework::get-version(framework::get-target-framework())))}" dynamic="true" />\r
28         <!-- \r
29                 Versioning\r
30         -->\r
31         <property name="project.version"        value="1.1.0.0" overwrite="false" />\r
32         <property name="project.major"          value="${version::get-major(version::parse(project.version))}"          dynamic="true" />\r
33         <property name="project.minor"          value="${version::get-minor(version::parse(project.version))}"          dynamic="true" />\r
34         <property name="project.build"          value="${version::get-build(version::parse(project.version))}"          dynamic="true" />\r
35         <property name="project.revision"       value="${svn.revision}"                                                                                         dynamic="true" />\r
37         <property name="assembly.major"         value="${version::get-major(version::parse(assembly.version))}"         dynamic="true" />\r
38         <property name="assembly.minor"         value="${version::get-minor(version::parse(assembly.version))}"         dynamic="true" />\r
39         <property name="assembly.build"         value="${version::get-build(version::parse(assembly.version))}"         dynamic="true" />\r
40         <property name="assembly.revision"      value="${version::get-revision(version::parse(assembly.version))}"      dynamic="true" />\r
41         \r
42         <property name="svn.revision" value="0" overwrite="false" />\r
44         <!-- \r
45                 These are used to set the correct attributes in AssemblyInfo.cs.  \r
46         -->\r
47         <property name="project.company" value="Castle Project" />\r
49         <!-- debug|release -->\r
50         <property name="build.defines" value="TRACE" />\r
51         <property name="build.defines" value="${build.defines},STRONG" if="${sign}" />\r
53         <!-- platform specific properties. These are the defaults -->\r
54         <property name="current.build.defines" value="${build.defines}" />\r
56         <!-- named project configurations -->\r
57         <target name="set-debug-project-configuration" description="Perform a 'debug' build">\r
58                 <property name="build.debug"    value="true" />\r
59                 <property name="build.optimize" value="false" overwrite="false" />\r
60         </target>\r
61         \r
62         <target name="set-release-project-configuration" description="Perform a 'release' build">\r
63                 <property name="build.debug"    value="false" />\r
64                 <property name="build.optimize" value="true" overwrite="false" />\r
65         </target>\r
67         <target name="set-project-configuration">\r
68                 <property name="project.config" value="debug" overwrite="false" />\r
69                 <if test="${not(target::exists('set-' + project.config + '-project-configuration'))}">\r
70                         <fail message="Unknown configuration: '${project.config}'" />\r
71                 </if>\r
72                 <property name="build.warnaserrors" value="true" overwrite="false" />\r
73                 <property name="build.warnmissingdocs" value="false" overwrite="false" />\r
74                 <call target="set-${project.config}-project-configuration" />\r
76                 <property name="src.dir"                        value="${path::get-full-path(project::get-base-directory())}" />\r
77                 <property name="build.base.dir" value="${root.dir}/build" />\r
78                 <property name="build.family.dir"       value="${build.base.dir}/${nant.settings.currentframework}" />\r
79                 <property name="build.dir"              value="${path::get-full-path(path::combine(build.family.dir,project.config))}" dynamic="true" />\r
80                 <property name="testresults.dir"        value="${build.dir}/test-results" />\r
81                 <property name="releasenotes.dir"       value="${build.dir}/ReleaseNotes" />\r
82                 <property name="build.rebuild"          value="false" overwrite="false" />\r
83         </target>\r
85         <target name="set-framework-configuration">\r
86                 <if test="${not(target::exists('set-'+framework::get-target-framework()+'-framework-configuration'))}">\r
87                         <fail message="The '${framework::get-target-framework()}' framework is not supported by this version of Cast;e." />\r
88                 </if>\r
89                 <property name="csc.keyfile"    value="" />\r
90                 <property name="csc.args"               value="" />\r
91                 <call target="set-${framework::get-target-framework()}-framework-configuration" />\r
93                 <!-- Where is nunit-console.exe ? -->\r
94                 <property name="nunit-console" value="nunit-console.exe" overwrite="false" />\r
95                 <!-- Where is WiX? -->\r
96                 <property name="wix.dir" value="%ProgramFiles%\wix" overwrite="false" />\r
97         </target>\r
99         <target name="set-net-1.1-framework-configuration">\r
100                 <property name="nant.settings.currentframework" value="net-1.1" />\r
101                 <property name="current.build.defines" value="${build.defines},NET,DOTNET1" />\r
102                 <property name="link.sdkdoc.version" value="SDK_v1_1" />\r
103                 <property name="merge.targetplatform" value="v1.1" />\r
104                 <!-- If DevEnvDir exists, we grab it, otherwise we try if the default location (if it exists) -->\r
105                 <if test="${environment::variable-exists('DevEnvDir')}">\r
106                         <property name="dev.env.dir" value="${environment::get-variable('DevEnvDir')}" />\r
107                 </if>\r
108                 <if test="${not environment::variable-exists('DevEnvDir')}">\r
109                         <property name="default.dev.env.dir" value="%ProgramFiles%\Microsoft Visual Studio .NET 2003\Common7\IDE" />\r
110                         <if test="${directory::exists(default.dev.env.dir)}">\r
111                                 <property name="dev.env.dir" value="${default.dev.env.dir}" />\r
112                         </if>\r
113                 </if>\r
114         </target>\r
116         <target name="set-net-2.0-framework-configuration">\r
117                 <property name="nant.settings.currentframework" value="net-2.0" />\r
118                 <property name="current.build.defines" value="${build.defines},NET,DOTNET2" />\r
119                 <property name="link.sdkdoc.version" value="SDK_v2_0" />\r
120                 <property name="merge.targetplatform" value="v2" />\r
121                 <property name="csc.keyfile" value="/keyfile:${key.file}" />\r
122                 <!-- If DevEnvDir exists, we grab it, otherwise we try if the default location (if it exists) -->\r
123                 <if test="${environment::variable-exists('DevEnvDir')}">\r
124                         <property name="dev.env.dir" value="${environment::get-variable('DevEnvDir')}" />\r
125                 </if>\r
126                 <if test="${not environment::variable-exists('DevEnvDir')}">\r
127                         <property name="default.dev.env.dir" value="%ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE" />\r
128                         <if test="${directory::exists(default.dev.env.dir)}">\r
129                                 <property name="dev.env.dir" value="${default.dev.env.dir}" />\r
130                         </if>\r
131                 </if>\r
132         </target>\r
134         <target name="set-mono-1.0-framework-configuration">\r
135                 <property name="nant.settings.currentframework" value="mono-1.0" />\r
136                 <property name="current.build.defines" value="${build.defines},MONO,MONO1" />\r
137                 <property name="link.sdkdoc.version" value="MsdnOnline" />\r
138         </target>\r
140         <target name="display-current-runtime">\r
141                 <echo message="" />\r
142                 <echo message="----------------------------------------------------------" />\r
143                 <echo message=" ${framework::get-description(framework::get-target-framework())}" />\r
144                 <echo message="----------------------------------------------------------" />\r
145                 <echo message="" />\r
146                 <echo message="framework : ${framework::get-target-framework()}" />\r
147                 <echo message="description : ${framework::get-description(framework::get-target-framework())}" />\r
148                 <echo message="sdk directory : ${framework::get-sdk-directory(framework::get-target-framework())}" />\r
149                 <echo message="framework directory : ${framework::get-framework-directory(framework::get-target-framework())}" />\r
150                 <echo message="assembly directory : ${framework::get-assembly-directory(framework::get-target-framework())}" />\r
151                 <echo message="runtime engine : ${framework::get-runtime-engine(framework::get-target-framework())}" />\r
152                 <echo message="" />\r
153         </target>\r
155         <target name="common.init"\r
156                 depends="set-framework-configuration set-project-configuration"\r
157                 description="Initializes build properties">\r
159                 <fileset id="project.sources" failonempty="true">\r
160                         <include name="${src.dir}/**/*.cs" />\r
161                 </fileset>\r
162                 <resourcefileset id="project.resources" />\r
163         </target>\r
164         \r
165         <target name="common.find-svninfo">\r
166                 <!-- For adding SVN revision to builds -->\r
167                 <property name="svn.revision" value="0" overwrite="false" />\r
168                 <!-- try to update the revision -->\r
169                 <exec\r
170                         program="svn"\r
171                         commandline='info "${project::get-base-directory()}" --xml'\r
172                         output="_revision.xml"\r
173                         failonerror="false"/>\r
174                 <xmlpeek\r
175                         file="_revision.xml"\r
176                         xpath="/info/entry/commit/@revision"\r
177                         property="svn.revision"\r
178                         failonerror="false"/>\r
179                 <delete file="_revision.xml" failonerror="false" />\r
180                 <echo message="INFO: Using Subversion revision number: ${svn.revision}"/>\r
181         </target>\r
183         <target name="common.find-nunit">\r
184                 <if test="${not property::exists('nunit.found')}">\r
185                         <exec \r
186                                 program="${nunit-console}" \r
187                                 resultproperty="nunit.found"\r
188                                 failonerror="false" />\r
189                         <property name="nunit.found" value="${nunit.found == '0'}" readonly="true" />\r
191                         <echo message="INFO: Using nunit-console.exe for running unit tests" if="${nunit.found}"/>\r
192                         <echo message="WARNING: nunit-console not found, using less predictable NAnt &lt;nunit2&gt; task" unless="${nunit.found}"/>\r
193                 </if>\r
194         </target>\r
195         \r
196         <script language="C#" prefix="build">\r
197                 <code>\r
198                         <![CDATA[\r
199                                 [Function("path-make-relative")]\r
200                                 public static string PathMakeRelative(string fromPath, string toPath)\r
201                                 {\r
202                                         Uri uri1 = new Uri(Path.GetFullPath(fromPath));\r
203                                         Uri uri2 = new Uri(Path.GetFullPath(toPath));\r
204                                         return uri1.MakeRelative(uri2);\r
205                                 }\r
206                                 \r
207                         ]]>\r
208                 </code>\r
209         </script>\r
210         \r
211 </project>\r