forked from spring-projects/spring-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common-project.include
345 lines (282 loc) · 14.9 KB
/
common-project.include
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" ?>
<project xmlns="http://nant.sf.net/schemas/nant.xsd">
<description>
<![CDATA[
Credits for this shared build script go to the NHibernate Team
This file contains common tasks tailored specifically for the Spring
build process. The goal was to define all the actions in this file, so
that actual project build files only have to configure a few variables
and call tasks in this file.
Usage
<property name="root.dir" value="../.." />;
<include buildfile="${root.dir}/build-common/common-project.xml" />;
These lines should be placed at the top level under the <project>
element. Property root.dir defines a relative path to the root of the
distribution, that is, NHibernate directory.
After including the file, a target should be defined to initialize
configuration variables according to the project being built.
The standard name of this target is init (but any other name can be chosen).
The init target should depend on (or call) target common.init defined
in this file.
Other predefined targets are:
- common.compile-dll
compile a DLL, generating the documentation file (.xml) and using Clover
if enabled.
- common.run-tests
run compiled NUnit tests.
All compile/run targets put the output in ${current.bin.dir}.
common.compile* targets use source fileset with id="project.sources",
assembly fileset
with id="project.references" and resource fileset with id="project.resources"
to compile the project. The source and resource filesets are optional and
default to **/*.cs files and no files respectively.
]]>
</description>
<echo message="global common-project.xml" />
<!--
*******************************************************************************
Arguments:
${root.dir}: root dir
${current.bin.dir}: the binary directory to output the assembly + app.config to
-->
<target name="common.init" description="Initializes build properties">
<property name="assembly.is-cls-compliant" value="true" />
<property name="assembly.version" value="1.0.0.0" />
<property name="assembly.version.informational" value="1.0" />
<patternset id="project.references.default">
<include name="System.dll" />
<include name="System.Xml.dll" />
<include name="System.Drawing.dll" />
<include name="System.Windows.Forms.dll" />
<include name="System.Drawing.Design.dll" />
<include name="System.Design.dll" />
<include name="System.Data.dll" />
<include name="*.dll" />
</patternset>
<patternset id="project.references.test" />
<patternset id="project.references.additional" />
<fileset id="project.sources" failonempty="true">
<include name="**/*.cs" />
</fileset>
<resourcefileset id="project.resources" />
<patternset id="project.content" />
</target>
<!--
*******************************************************************************
Arguments:
${root.dir}: root dir
${current.bin.dir}: the binary directory to output the assembly + app.config to
-->
<target name="common.init-test" description="Initializes build properties" depends="common.init">
</target>
<!--
*******************************************************************************
Arguments:
${current.bin.dir}: the binary directory to output the assembly + app.config to
${current.build.nowarn}: list of disabled warnings
${current.build.debug}
${current.build.optimize}
${current.build.defines}
-->
<target name="common.compile-dll" description="compiles sources">
<property name="compile.bin.dir" value="${current.bin.dir}" if="${not property::exists('compile.bin.dir')}" />
<echo message="copying libs from ${lib.dir} to ${compile.bin.dir}" />
<property name="compile.lib.dir.tmp" value="${lib.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" dynamic="true" />
<echo message="copying libs from ${compile.lib.dir.tmp}" />
<copy todir="${compile.bin.dir}" verbose="${copy-verbose}">
<fileset>
<include name="${compile.lib.dir.tmp}/*.dll" />
</fileset>
</copy>
<property name="compile.lib.dir.tmp" value="${lib.dir}/${framework::get-family(framework::get-target-framework())}" dynamic="true" />
<echo message="copying libs from ${compile.lib.dir.tmp}" />
<copy todir="${compile.bin.dir}" verbose="${copy-verbose}">
<fileset>
<include name="${compile.lib.dir.tmp}/*.dll" />
</fileset>
</copy>
<property name="compile.lib.dir.tmp" value="${lib.dir}" dynamic="true" />
<echo message="copying libs from ${compile.lib.dir.tmp}" />
<copy todir="${compile.bin.dir}" verbose="${copy-verbose}">
<fileset>
<include name="${compile.lib.dir.tmp}/*.dll" />
</fileset>
</copy>
<property name="compile.lib.dir.tmp" value="${current.bin.dir}" dynamic="true" />
<echo message="copying libs from ${compile.lib.dir.tmp}" />
<copy todir="${compile.bin.dir}" verbose="${copy-verbose}">
<fileset>
<!-- exclude name="${current.lib.dir}/*.Tests.dll" / -->
<include name="${compile.lib.dir.tmp}/*.dll" />
</fileset>
</copy>
<csc target="library"
verbose="true" warnaserror="false"
output="${compile.bin.dir}/${project::get-name()}.dll"
debug="${current.build.debug}"
optimize="${current.build.optimize}"
unsafe="true"
checked="false"
define="${current.build.defines.csc}"
doc="${current.bin.dir}/${project::get-name()}.xml"
>
<nowarn>
<warning number="${current.build.nowarn}" />
</nowarn>
<sources refid="project.sources" />
<references basedir="${compile.bin.dir}">
<patternset refid="project.references.default" />
<patternset refid="project.references.test" />
<patternset refid="project.references.additional" />
</references>
<resources refid="project.resources" />
</csc>
<!--
<if test="${file::exists(project::get-base-directory() + '/app.config')}">
<copy file="${project::get-base-directory()}/app.config" tofile="${current.bin.dir}/${project::get-name()}.dll.config" />
</if>
-->
<!-- copy app.config -->
<copy file="${project::get-base-directory()}/app.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config" failonerror="false"/>
<!-- copy 'TestData' directory -->
<copy todir="${current.bin.dir}/TestData" failonerror="false" verbose="${copy-verbose}">
<fileset basedir="${project::get-base-directory()}/TestData">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<!--
*******************************************************************************
Runs standard unit test configuration of the current ${project::get-name()}.dll
Arguments:
${current.bin.dir} : the binary directory to pick the assembly + app.config from
${project.name} : (optional), the name of the assembly
${tool.dir} : dir for tools
${test.withcoverage}: flag indicating whether to invoke tests with test-coverage profiler or not
-->
<target name="common.run-tests">
<if test="${not test.withcoverage}" >
<call target="common.run-tests.nunit" />
</if>
<if test="${test.withcoverage}" >
<call target="common.run-tests.ncover" if="${test.coverage.tool == 'ncover'}" />
<call target="common.run-tests.opencover" if="${test.coverage.tool == 'opencover'}" />
</if>
</target>
<!--
*******************************************************************************
Runs Microsoft unit test configuration of the current ${project::get-name()}.dll
Currently assumes you have installed VS.NET on the machine
Arguments:
${current.bin.dir}: the binary directory to pick the assembly + app.config from
${project.name} : (optional), the name of the assembly
${tool.dir} : dir for tools
-->
<target name="common.run-tests.mstest">
<property name="test.assemblyname" value="${project::get-name()}" overwrite="false" />
<property name="test.bin.dir" value="${current.bin.dir}" if="${not property::exists('test.bin.dir')}" />
<echo message="Unit Testing ${project.name} in ${test.bin.dir}" />
<exec program="${mstest.exe.current}" workingdir="${test.bin.dir}" verbose="false">
<arg value="/testcontainer:${test.bin.dir}/${test.assemblyname}.dll"/>
<arg value="/resultsfile:${test.assemblyname}.dll-MsTestResults.trx"/>
<arg value="/nologo" />
</exec>
</target>
<!--
*******************************************************************************
Runs NUnit unit test configuration of the current ${project::get-name()}.dll
Arguments:
${current.bin.dir}: the binary directory to pick the assembly + app.config from
${project.name} : (optional), the name of the assembly
${tool.dir} : dir for tools
-->
<target name="common.run-tests.nunit">
<property name="test.assemblyname" value="${project::get-name()}" overwrite="false" />
<property name="test.assemblyfile" value="${test.assemblyname}.dll" overwrite="false" />
<property name="nunit.framework.version" value="${nant.settings.currentframework}" />
<property name="nunit.framework.version" value="net-4.0" if="${nunit.framework.version == 'net-4.5'}" />
<property name="test.bin.dir" value="${current.bin.dir}" if="${not property::exists('test.bin.dir')}" />
<echo message="Unit Testing ${project.name}, ${test.assemblyname} in ${test.bin.dir}" />
<!-- 2.6.2 and 2.6.3 seem to be broken at least w.r.t. remoting and security levels -->
<exec program="${nunit.console.exe}" workingdir="${test.bin.dir}" verbose="true">
<arg line="${test.assemblyfile}" />
<arg value="/xml:${test.assemblyname}.dll-TestResults.xml" />
<arg value="/framework:${nunit.framework.version}" />
<arg value="/nologo" />
<arg value="/noshadow" />
</exec>
</target>
<!--
*******************************************************************************
Runs coverage unit test configuration of the current ${project::get-name()}.dll
Arguments:
${current.bin.dir}: the binary directory to pick the assembly + app.config from
${project.name} : (optional), the name of the assembly
${tool.dir} : dir for tools
-->
<target name="common.run-tests.ncover" description="Run NUnit tests">
<property name="test.assemblyname" value="${project::get-name()}" overwrite="false" />
<property name="test.assemblyfile" value="${test.assemblyname}.dll" overwrite="false" />
<property name="test.assemblyname.tocover" value="${string::substring(test.assemblyname,0,string::last-index-of(test.assemblyname, '.Tests') )}" overwrite="false" />
<property name="test.bin.dir" value="${current.bin.dir}" if="${not property::exists('test.bin.dir')}" />
<property name="nunit.framework.version" value="${nant.settings.currentframework}" />
<property name="nunit.framework.version" value="net-4.0" if="${nunit.framework.version == 'net-4.5'}" />
<echo message="Coverage Testing ${test.assemblyname} in ${test.bin.dir}" />
<exec program="${tool.dir}/ncover/ncover.console.exe" workingdir="${test.bin.dir}" verbose="true">
<arg value="//q" />
<arg value="//reg" />
<arg value="//w" />
<arg path="${test.bin.dir}" />
<arg value="//x" />
<arg path="${test.bin.dir}/${test.assemblyname}.dll-TestCoverage.xml" />
<arg value="//a" />
<arg value="${test.assemblyname.tocover}" />
<arg value="//ea" />
<arg value="CoverageExcludeAttribute" />
<arg value="//q" />
<arg path="${nunit.console.exe}" />
<arg line="${test.assemblyfile}" />
<arg value="/xml:${test.assemblyname}.dll-TestResults.xml" />
<arg value="/noshadow" />
<arg value="/nologo" />
<arg value="/framework:${nunit.framework.version}" />
</exec>
<!--
<loadtasks assembly="${tool.dir}/ncoverexplorer/NCoverExplorer.NAntTasks.dll" />
<ncoverexplorer program="${tool.dir}/ncoverexplorer/ncoverexplorer.console.exe"
projectName="CCNet"
configName="${tool.dir}/ncoverexplorer/ncoverexplorer.console.config"
outputDir="${current.bin.dir}"
satisfactoryCoverage="80" reportType="4"
xmlReportName="${current.bin.dir}/${project.name}.dll-CoverageSummary.xml">
<fileset>
<include name="${current.bin.dir}/${project.name}.dll-Coverage.xml" />
</fileset>
</ncoverexplorer>
-->
</target>
<target name="common.run-tests.opencover" description="Run NUnit tests">
<property name="test.assemblyname" value="${project::get-name()}" overwrite="false" />
<property name="test.assemblyfile" value="${test.assemblyname}.dll" overwrite="false" />
<property name="test.assemblyname.tocover" value="${string::substring(test.assemblyname,0,string::last-index-of(test.assemblyname, '.Tests') )}" overwrite="false" />
<property name="test.bin.dir" value="${current.bin.dir}" if="${not property::exists('test.bin.dir')}" />
<property name="nunit.framework.version" value="${nant.settings.currentframework}" />
<property name="nunit.framework.version" value="net-4.0" if="${nunit.framework.version == 'net-4.5'}" />
<echo message="Coverage Testing ${test.assemblyname} in ${test.bin.dir}" />
<exec program="${tool.dir}/opencover/OpenCover.Console.exe" workingdir="${test.bin.dir}" verbose="true">
<arg value="-register:user" />
<arg value="-target:${nunit.console.exe}" />
<arg value="-targetargs:${test.assemblyfile} /xml:${test.assemblyname}.dll-TestResults.xml /noshadow /nologo /framework:${nunit.framework.version}" />
<arg value="-filter:"+[Spring*]* -[*Test*]* -[*nunit*]*"" />
<arg value="-output:${test.bin.dir}/${test.assemblyname}.dll-TestCoverage.xml" />
</exec>
<exec program="${tool.dir}\ReportGenerator\bin\ReportGenerator.exe" workingdir="${test.bin.dir}" verbose="true">
<arg value="${test.assemblyname}.dll-TestCoverage.xml" />
<arg path="${test.bin.dir}\CoverageReport\${test.assemblyname}" />
</exec>
</target>
<readregistry property="net35.install.dir" key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5\InstallPath" hive="LocalMachine" failonerror="true"/>
<property name="msbuild.exe" value="${net35.install.dir}\msbuild.exe"/>
<property name="nunit.console.exe" value="${spring.basedir}/packages/NUnit.Runners.2.6.1/tools/nunit-console-x86.exe" />
</project>