2
<project name="Addins.Common">
4
<!-- ***************************************************************** -->
5
<!-- ** Copyright 2008, Charlie Poole ** -->
7
<!-- ** Licensed under the Academic Free License version 3.0 ** -->
8
<!-- ***************************************************************** -->
10
<!-- ***************************************************************** -->
11
<!-- ** Common.Addin.Build - Version 1.0 ** -->
13
<!-- ** Common build script for use in building NUnit addins. For ** -->
14
<!-- ** simple cases, the main script only needs to include this ** -->
15
<!-- ** script and define a few properties. More complex cases may ** -->
16
<!-- ** require additional targets in the main script. ** -->
18
<!-- ** The script uses the following project organization: ** -->
19
<!-- ** <project> - contains the build script ** -->
20
<!-- ** src - source code ** -->
21
<!-- ** addin - the addin itself ** -->
22
<!-- ** framework- optional assembly to be referenced by ** -->
23
<!-- ** user tests - contains attributes, etc. ** -->
24
<!-- ** fixture - optional fixture assembly used by tests ** -->
25
<!-- ** sample - optional sample optionally used by tests ** -->
26
<!-- ** tests - unit tests ** -->
27
<!-- ** lib - external dlls used by the addin or tests ** -->
28
<!-- ** build - output of builds, structured by runtime, ** -->
29
<!-- ** NUnit version and build type ** -->
30
<!-- ** package - holds packages created ** -->
31
<!-- ** work - work directory for buildin packages ** -->
33
<!-- ** If the src directory is not found, the script looks for ** -->
34
<!-- ** addin, fixture, etc. directly in the project root. ** -->
36
<!-- ** If the addin directory is not found, source files for the ** -->
37
<!-- ** the addin are taken directly from the src directory or ** -->
38
<!-- ** project root. The other src subdirectories are optional. ** -->
40
<!-- ** This allows using the script for a simple addin with only ** -->
41
<!-- ** one source file in the project root, or a more complex ** -->
42
<!-- ** addin with multiple source files and test projects. ** -->
44
<!-- ** Additional properties may be set in order to modify ** -->
45
<!-- ** the behavior of the script (defaults in parentheses): ** -->
47
<!-- ** addin.dir (addin) ** -->
48
<!-- ** Name of the directory containing addin source ** -->
50
<!-- ** addin.dll (<project>Addin.dll) ** -->
51
<!-- ** Name of the addin assembly ** -->
53
<!-- ** framework.dir (framework) ** -->
54
<!-- ** Name of the directory containing the source code ** -->
55
<!-- ** for any framework extension ** -->
57
<!-- ** framework.dll (<project>.dll) ** -->
58
<!-- ** Name of any framework extension assembly, intended ** -->
59
<!-- ** to be referenced by the tests. ** -->
61
<!-- ** fixture.dir (fixture) ** -->
62
<!-- ** Name of the directory containing fixture source ** -->
64
<!-- ** fixture.dll (<project>Fixture.dll) ** -->
65
<!-- ** Name of the fixture assembly ** -->
67
<!-- ** sample.dir (sample) ** -->
68
<!-- ** Name of the directory containing sample source ** -->
70
<!-- ** sample.dll (<project>Sample.dll) ** -->
71
<!-- ** Name of the sample assembly ** -->
73
<!-- ** test.dir (tests) ** -->
74
<!-- ** Name of the directory containing unit test source ** -->
76
<!-- ** test.dll (<project>Tests.dll ) ** -->
77
<!-- ** Name of the unit test assembly ** -->
79
<!-- ** alt.lib.dir ** -->
80
<!-- ** Specifies a subdirectory of the lib dir to be used for ** -->
81
<!-- ** the current build. For use when multiple versions of ** -->
82
<!-- ** an external program are used for different builds ** -->
84
<!-- ** supported.frameworks (net-1.1,net-2.0,mono-1.0,mono-2.0) ** -->
85
<!-- ** Set to restrict the frameworks for which the addin ** -->
86
<!-- ** may be built, provided it is installed. ** -->
88
<!-- ** target.framework.dll (nunit.framework.dll) ** -->
89
<!-- ** Set when the addin supports an external framework. ** -->
90
<!-- ** The sample and fixture dlls will reference this ** -->
91
<!-- ** framework, which should be in the lib directory. ** -->
92
<!-- ** The unit tests still use the NUnit framework. ** -->
94
<!-- ** mock.framework.dll ** -->
95
<!-- ** The mock framework in use. If set to nunit.mocks.dll ** -->
96
<!-- ** then it's pulled from the NUnit installation. Any ** -->
97
<!-- ** other mock framework should be in the lib directory. ** -->
99
<!-- ** package.version (1.0) ** -->
100
<!-- ** The version to be suffixed to any package names. ** -->
101
<!-- ** This should normally match the internal version. ** -->
103
<!-- ** nunit.version (2.4.7) ** -->
104
<!-- ** The default version of NUnit to build against. ** -->
106
<!-- ** nunit.dir ** -->
107
<!-- ** The base directory where NUnit is installed. Not ** -->
108
<!-- ** needed for Windows installations using msi package, ** -->
109
<!-- ** since the location is found in the registry. If ** -->
110
<!-- ** specified, nunit.version should be set to match. ** -->
112
<!-- ** Further customization may be provided by defining certain ** -->
113
<!-- ** targets in the main script, which are called if present. ** -->
114
<!-- ** The following targets are called before or after the ** -->
115
<!-- ** indicated actions: ** -->
117
<!-- ** pre-init Before build initialization ** -->
118
<!-- ** post-init After build initialization ** -->
119
<!-- ** pre-build Before the build target ** -->
120
<!-- ** post-build After the build completes ** -->
122
<!-- ** The following targets are used in lieu of the default ** -->
123
<!-- ** actions contained in this script, if they are found, ** -->
124
<!-- ** allowing complete control of the build while still using ** -->
125
<!-- ** support functions provided in this script. ** -->
127
<!-- ** build-addin Build the addin ** -->
128
<!-- ** build-sample Build just the sample ** -->
129
<!-- ** build-fixture Build just the test fixture ** -->
130
<!-- ** build-unit-tests Build just the unit tests ** -->
131
<!-- ** build-tests Build all the test assemblies ** -->
133
<!-- ** create-binary-package Copy binaries to work dir ** -->
134
<!-- ** create-source-package Copy source to work dir ** -->
136
<!-- ** Notes: ** -->
138
<!-- ** 1. Build output should be saved in ${current.build.dir}. ** -->
140
<!-- ** 2. Package images should be saved in ${work.dir}. ** -->
142
<!-- ** See the source code below for further information. ** -->
144
<!-- ***************************************************************** -->
146
<!-- ***************************************************************** -->
147
<!-- ** Define the overall directory structure ** -->
148
<!-- ***************************************************************** -->
150
<property name="src.dir" value="." unless="${directory::exists('src')}"/>
151
<property name="src.dir" value="src" if="${directory::exists('src')}"/>
153
<property name="build.dir" value="build"/>
154
<property name="package.dir" value="package"/>
155
<property name="lib.dir" value="lib"/>
156
<property name="work.dir" value="${package.dir}/work"/>
158
<property name="project.name" value="${project::get-name()}"/>
160
<!-- ***************************************************************** -->
161
<!-- ** Define the output assembly names ** -->
162
<!-- ***************************************************************** -->
164
<if test="${not string::ends-with(project.name,'Addin')}">
165
<property name="addin.dll" value="${project.name}Addin.dll"
166
unless="${property::exists('addin.dll')}"/>
167
<property name="framework.dll" value="${project.name}.dll"
168
unless="${property::exists('framework.dll')}"/>
171
<if test="${string::ends-with(project.name,'Addin')}">
172
<property name="addin.dll" value="${project.name}.dll"
173
unless="${property::exists('addin.dll')}"/>
174
<property name="framework.dll"
175
value="${string::substring(project.name,0,string::get-length(project.name)-5)}"/>
176
unless="${property::exists('framework.dll')}"/>
179
<property name="sample.dll" value="${project.name}Sample.dll"
180
unless="${property::exists('sample.dll')}"/>
181
<property name="fixture.dll" value="${project.name}Fixture.dll"
182
unless="${property::exists('fixture.dll')}"/>
183
<property name="test.dll" value="${project.name}Tests.dll"
184
unless="${property::exists('test.dll')}"/>
186
<!-- ***************************************************************** -->
187
<!-- ** Define the frameworks this addin supports ** -->
188
<!-- ***************************************************************** -->
190
<property name="supported.frameworks"
191
value="net-1.1,net-2.0,mono-1.0,mono-2.0"
192
unless="${property::exists('supported.frameworks')}"/>
194
<foreach item="String" delim=","
195
property="framework" in="${supported.frameworks}">
197
<property name="${framework}.supported" value="true"/>
199
<if test="${framework::exists( framework )}">
200
<if test="${framework::sdk-exists( framework )}">
201
<property name="default.runtime" value="${framework}"
202
unless="${property::exists('default.runtime')}"/>
208
<!-- ***************************************************************** -->
209
<!-- ** Set defaults for the build ** -->
210
<!-- ***************************************************************** -->
212
<call target="set-debug-build-config"/>
213
<call target="set-${default.runtime}-runtime-config"/>
214
<property name="nunit.version" value="2.4.7"
215
unless="${property::exists('nunit.version')}"/>
217
<!-- ***************************************************************** -->
218
<!-- *** Targets that set the build configuration *** -->
219
<!-- *** These must come before actions like build or test *** -->
220
<!-- ***************************************************************** -->
222
<target name="debug" depends="set-debug-build-config"
223
description="Set config to debug for commands that follow"/>
225
<target name="release" depends="set-release-build-config"
226
description="Set config to release for commands that follow"/>
228
<!-- ***************************************************************** -->
229
<!-- *** Targets that set the runtime configuration *** -->
230
<!-- *** These must come before actions like build or test *** -->
231
<!-- ***************************************************************** -->
233
<target name="net-1.0" depends="set-net-1.0-runtime-config"
234
description="Use .NET 1.0 for commands that follow"/>
236
<target name="net-1.1" depends="set-net-1.1-runtime-config"
237
description="Use .NET 1.1 for commands that follow"/>
239
<target name="net-2.0" depends="set-net-2.0-runtime-config"
240
description="Use .NET 2.0 for commands that follow"/>
242
<target name="mono-1.0" depends="set-mono-1.0-runtime-config"
243
description="Use Mono 1.0 for commands that follow"/>
245
<target name="mono-2.0" depends="set-mono-2.0-runtime-config"
246
description="Use Mono 2.0 for commands that follow"/>
248
<!-- ***************************************************************** -->
249
<!-- *** Targets that set the NUnit version *** -->
250
<!-- *** These must come before actions like build or test *** -->
251
<!-- ***************************************************************** -->
253
<target name="nunit-2.4" description="Use NUnit 2.4 for commands that follow">
254
<property name="nunit.version" value="2.4"/>
257
<target name="nunit-2.4.1" description="Use NUnit 2.4.1 for commands that follow">
258
<property name="nunit.version" value="2.4.1"/>
261
<target name="nunit-2.4.2" description="Use NUnit 2.4.2 for commands that follow">
262
<property name="nunit.version" value="2.4.2"/>
265
<target name="nunit-2.4.3" description="Use NUnit 2.4.3 for commands that follow">
266
<property name="nunit.version" value="2.4.3"/>
269
<target name="nunit-2.4.4" description="Use NUnit 2.4.4 for commands that follow">
270
<property name="nunit.version" value="2.4.4"/>
273
<target name="nunit-2.4.5" description="Use NUnit 2.4.5 for commands that follow">
274
<property name="nunit.version" value="2.4.5"/>
277
<target name="nunit-2.4.6" description="Use NUnit 2.4.6 for commands that follow">
278
<property name="nunit.version" value="2.4.6"/>
281
<target name="nunit-2.4.7" description="Use NUnit 2.4.7 for commands that follow">
282
<property name="nunit.version" value="2.4.7"/>
285
<target name="nunit-2.5" description="Use NUnit 2.5 for commands that follow">
286
<property name="nunit.version" value="2.5"/>
289
<!-- ***************************************************************** -->
290
<!-- *** Remove artifacts created by the build *** -->
291
<!-- ***************************************************************** -->
293
<target name="clean" description="Remove build" depends="set-configuration">
294
<delete dir="${current.build.dir}"
295
if="${directory::exists(current.build.dir)}"/>
298
<!-- ***************************************************************** -->
299
<!-- *** Rebuild the addin and tests *** -->
300
<!-- ***************************************************************** -->
302
<target name="rebuild" depends="clean,build"
303
description="Clean and rebuild the addin and its test assemblies"/>
305
<!-- ***************************************************************** -->
306
<!-- *** Build the addin and tests *** -->
307
<!-- ***************************************************************** -->
309
<target name="build" depends="build-init"
310
description="Build the addin and its test assemblies">
312
<call target="pre-build" if="${target::exists('pre-build')}"/>
314
<call target="build-addin" if="${target::exists('build-addin')}"/>
315
<call target="default-build-addin" unless="${target::exists('build-addin')}"/>
317
<call target="build-framework" if="${target::exists('build-framework')}"/>
318
<call target="default-build-framework" unless="${target::exists('build-framework')}"/>
320
<call target="build-tests" if="${target::exists('build-tests')}"/>
322
<if test="${not target::exists('build-tests')}">
324
<call target="build-sample" if="${target::exists('build-sample')}"/>
325
<call target="default-build-sample" unless="${target::exists('build-sample')}"/>
327
<call target="build-fixture" if="${target::exists('build-fixture')}"/>
328
<call target="default-build-fixture" unless="${target::exists('build-fixture')}"/>
330
<call target="build-unit-tests" if="${target::exists('build-unit-tests')}"/>
331
<call target="default-build-unit-tests" unless="${target::exists('build-unit-tests')}"/>
335
<call target="post-build" if="${target::exists('post-build')}"/>
339
<!-- ***************************************************************** -->
340
<!-- *** Install the addin *** -->
341
<!-- ***************************************************************** -->
343
<target name="install" depends="build"
344
description="Install the addin to the nunit addins dir">
345
<copy file="${current.build.dir}/${addin.dll}"
346
todir="${nunit.bin.dir}/addins"/>
349
<target name="lib-install" depends="build"
350
description="Install the framework assembly to the nunit lib dir">
351
<copy file="${current.build.dir}/${framework.dll}"
352
todir="${nunit.bin.dir}/lib"/>
355
<target name="bundled-install" depends="install,lib-install"
356
description="Install a bundled addin to the nunit build"/>
358
<!-- ***************************************************************** -->
359
<!-- *** Test the installed addin *** -->
360
<!-- ***************************************************************** -->
362
<target name="test" depends="install"
363
description="Run unit tests using the console runner">
365
<exec basedir="${current.build.dir}"
366
workingdir="${current.build.dir}"
367
program="${nunit.bin.dir}/nunit-console.exe"
369
commandline="${test.dll}" />
373
<target name="test-sample" depends="install"
374
description="Run sample using the console runner">
376
<exec basedir="${current.build.dir}"
377
workingdir="${current.build.dir}"
378
program="${nunit.bin.dir}/nunit-console.exe"
380
commandline="${sample.dll}" />
384
<target name="gui-test" depends="install"
385
description="Run unit tests using the gui runner">
387
<exec basedir="${current.build.dir}"
388
workingdir="${current.build.dir}"
389
program="${nunit.bin.dir}/nunit.exe"
391
commandline="${test.dll} -run" />
395
<target name="gui-sample" depends="install"
396
description="Run sample using the gui runner">
398
<exec basedir="${current.build.dir}"
399
workingdir="${current.build.dir}"
400
program="${nunit.bin.dir}/nunit.exe"
402
commandline="${sample.dll} -run" />
406
<!-- ***************************************************************** -->
407
<!-- *** Package the addin for distribution *** -->
408
<!-- ***************************************************************** -->
410
<target name="package" depends="build,package-init"
411
description="Create binary package as a zip file">
413
<delete dir="${work.dir}" if="${directory::exists(work.dir)}"/>
414
<mkdir dir="${work.dir}"/>
416
<call target="create-binary-package"
417
if="${target::exists('create-binary-package')}"/>
419
<call target="create-default-binary-package"
420
unless="${target::exists('create-binary-package')}"/>
423
zipfile="${package.dir}/${package.name}-nunit-${nunit.version}${build.suffix}.zip">
424
<fileset basedir="${work.dir}">
431
<target name="package-src" depends="package-init"
432
description="Create source package as a zip file">
434
<delete dir="${work.dir}" if="${directory::exists(work.dir)}"/>
435
<mkdir dir="${work.dir}"/>
437
<call target="create-source-package"
438
if="${target::exists('create-source-package')}"/>
440
<call target="create-default-source-package"
441
unless="${target::exists('create-source-package')}"/>
445
zipfile="${package.dir}/${package.name}-src.zip">
446
<fileset basedir="${work.dir}">
447
<include name="**/*"/>
453
<!-- ***************************************************************** -->
454
<!-- *** Default targets for building the addin and tests *** -->
455
<!-- ***************************************************************** -->
457
<target name="default-build-addin">
459
<csc target="library"
460
output="${current.build.dir}/${addin.dll}"
461
define="${current.build.defines}"
462
debug="${build.debug}">
464
<include name="${addin.src.dir}/*.cs"/>
466
<references basedir="${current.build.dir}">
467
<include name="nunit.core.dll"/>
468
<include name="nunit.core.interfaces.dll"/>
474
<target name="default-build-framework"
475
if="${directory::exists(framework.dir)}">
477
<csc target="library"
478
output="${current.build.dir}/${framework.dll}"
479
define="${current.build.defines}"
480
debug="${build.debug}">
482
<include name="${framework.src.dir}/*.cs"/>
484
<references basedir="${current.build.dir}">
485
<include name="${target.framework.dll}"/>
491
<target name="default-build-sample"
492
if="${directory::exists(sample.src.dir)}">
494
<csc target="library"
495
output="${current.build.dir}/${sample.dll}"
496
define="${current.build.defines}"
497
debug="${build.debug}">
499
<include name="${sample.src.dir}/**/*.cs"/>
501
<references basedir="${current.build.dir}">
502
<include name="${target.framework.dll}"/>
503
<include name="${framework.dll}"/>
509
<target name="default-build-fixture"
510
if="${directory::exists(fixture.src.dir)}">
512
<csc target="library"
513
output="${current.build.dir}/${fixture.dll}"
514
define="${current.build.defines}"
515
debug="${build.debug}">
517
<include name="${fixture.src.dir}/**/*.cs"/>
519
<references basedir="${current.build.dir}">
520
<include name="${target.framework.dll}"/>
521
<include name="${framework.dll}"/>
527
<target name="default-build-unit-tests"
528
if="${directory::exists(test.src.dir)}">
530
<csc target="library"
531
output="${current.build.dir}/${test.dll}"
532
define="${current.build.defines}"
533
debug="${build.debug}">
535
<include name="${test.src.dir}/**/*.cs"/>
537
<references basedir="${current.build.dir}">
538
<include name="nunit.framework.dll"/>
539
<include name="nunit.core.dll"/>
540
<include name="nunit.core.interfaces.dll"/>
541
<include name="nunit.mocks.dll"/>
542
<include name="${addin.dll}"/>
543
<include name="${framework.dll}"/>
544
<include name="${fixture.dll}"/>
545
<include name="${sample.dll}"/>
551
<!-- ***************************************************************** -->
552
<!-- *** Default targets for creating packages *** -->
553
<!-- ***************************************************************** -->
555
<target name="create-default-binary-package">
557
<copy todir="${work.dir}" flatten="true">
559
<fileset basedir=".">
560
<include name="${current.build.dir}/*"/>
561
<exclude name="${current.build.dir}/log4net.dll"/>
562
<exclude name="${current.build.dir}/nunit*.dll"/>
563
<exclude name="${current.build.dir}/${target.framework.dll}"/>
564
<include name="*.txt"/>
571
<target name="create-default-source-package">
573
<copy todir="${work.dir}">
575
<fileset basedir=".">
576
<include name="*.sln"/>
577
<include name="*.build"/>
578
<include name="*.include"/>
579
<include name="*.txt"/>
580
<include name="${src.dir}/**/*.cs"/>
581
<include name="${src.dir}/**/*.csproj"/>
582
<include name="${src.dir}/**/*.csproj.user"/>
583
<include name="${lib.dir}/**/*"/>
590
<!-- ***************************************************************** -->
591
<!-- *** Helpers used by primary targets *** -->
592
<!-- ***************************************************************** -->
594
<!-- ***************************************************************** -->
595
<!-- *** Initialize for the build *** -->
596
<!-- ***************************************************************** -->
598
<target name="build-init" depends="set-configuration,set-src-dirs">
600
<echo message="Building ${project.name} for NUnit ${nunit.version}"/>
602
<mkdir dir="${current.build.dir}"
603
unless="${directory::exists(current.build.dir)}"/>
605
<property name="target.framework.dll" value="nunit.framework.dll"
606
unless="${property::exists('target.framework.dll')}"/>
608
<call target="pre-init" if="${target::exists('pre-init')}"/>
609
<call target="copy-nunit-files"/>
610
<call target="copy-lib-files"/>
611
<call target="post-init" if="${target::exists('post-init')}"/>
615
<!-- ***************************************************************** -->
616
<!-- *** Initialize for creating packages *** -->
617
<!-- ***************************************************************** -->
619
<target name="package-init">
621
<mkdir dir="${package.dir}" unless="${directory::exists(package.dir)}"/>
623
<property name="package.version" value="1.0"
624
unless="${property::exists('package.version')}"/>
625
<property name="package.name" value="${project.name}-${package.version}"/>
629
<!-- ***************************************************************** -->
630
<!-- *** Set all configuration properties *** -->
631
<!-- ***************************************************************** -->
633
<target name="set-configuration"
634
depends="set-runtime-config,set-nunit-config,set-build-config">
636
<property name="current.build.dir"
637
value="${build.dir}/${runtime.config}/nunit-${nunit.version}/${build.config}"/>
639
<property name="current.build.defines"
640
value="${build.defines},${runtime.defines},${nunit.defines}"/>
644
<!-- ***************************************************************** -->
645
<!-- *** Set properties based on the target runtime *** -->
646
<!-- ***************************************************************** -->
648
<target name="set-runtime-config">
649
<call target="set-${runtime.config}-runtime-config"/>
652
<target name="set-net-1.0-runtime-config">
653
<fail unless="${property::exists('net-1.0.supported')}"
654
message="The net-1.0 framework is not supported by this addin"/>
655
<fail unless="${framework::exists( 'net-1.0' )}"
656
message="The net-1.0 framework is not installed"/>
657
<fail unless="${framework::sdk-exists( 'net-1.0' )}"
658
message="The net-1.0 sdk is not installed"/>
660
<property name="runtime.config" value="net-1.0"/>
661
<property name="runtime.defines" value="MSNET,NET_1_0"/>
662
<property name="nant.settings.currentframework" value="net-1.0"/>
665
<target name="set-net-1.1-runtime-config">
666
<fail unless="${property::exists('net-1.1.supported')}"
667
message="The net-1.1 framework is not supported by this addin"/>
668
<fail unless="${framework::exists( 'net-1.1' )}"
669
message="The net-1.1 framework is not installed"/>
670
<fail unless="${framework::sdk-exists( 'net-1.1' )}"
671
message="The net-1.1 sdk is not installed"/>
673
<property name="runtime.config" value="net-1.1"/>
674
<property name="runtime.defines" value="MSNET,NET_1_1"/>
675
<property name="nant.settings.currentframework" value="net-1.1"/>
678
<target name="set-net-2.0-runtime-config">
679
<fail unless="${property::exists('net-2.0.supported')}"
680
message="The net-2.0 framework is not supported by this addin"/>
681
<fail unless="${framework::exists('net-2.0')}"
682
message="The net-2.0 framework is not installed"/>
683
<fail unless="${framework::sdk-exists('net-2.0')}"
684
message="The net-2.0 sdk is not installed"/>
686
<property name="runtime.config" value="net-2.0"/>
687
<property name="runtime.defines" value="MSNET,NET_2_0"/>
688
<property name="nant.settings.currentframework" value="net-2.0"/>
691
<target name="set-mono-1.0-runtime-config">
692
<fail unless="${property::exists('mono-1.0.supported')}"
693
message="The mono-1.0 framework is not supported by this addin"/>
694
<fail unless="${framework::exists('mono-1.0')}"
695
message="The mono-1.0 framework is not installed"/>
696
<fail unless="${framework::sdk-exists('mono-1.0')}"
697
message="The mono-1.0 sdk is not installed"/>
699
<property name="runtime.config" value="mono-1.0"/>
700
<property name="runtime.defines" value="MONO,MONO_1_0"/>
701
<property name="nant.settings.currentframework" value="mono-1.0"/>
704
<target name="set-mono-2.0-runtime-config">
705
<fail unless="${property::exists('mono-2.0.supported')}"
706
message="The mono-2.0 framework is not supported by this addin"/>
707
<fail unless="${framework::exists('mono-2.0')}"
708
message="The mono-2.0 framework is not installed"/>
709
<fail unless="${framework::sdk-exists('mono-2.0')}"
710
message="The mono-2.0 sdk is not installed"/>
712
<property name="runtime.config" value="mono-2.0"/>
713
<property name="runtime.defines" value="MONO,MONO_2_0"/>
714
<property name="nant.settings.currentframework" value="mono-2.0"/>
717
<!-- ***************************************************************** -->
718
<!-- ** Set properties based on the target NUnit installation ** -->
719
<!-- ***************************************************************** -->
721
<target name="set-nunit-config">
723
<readregistry property="nunit.dir"
724
hive="CurrentUser" failonerror="false"
725
key="SOFTWARE\nunit.org\NUnit\${nunit.version}\InstallDir"
726
unless="${property::exists('nunit.dir')}"/>
728
<fail unless="${property::exists('nunit.dir')}"
729
message="Nunit ${nunit.version} registry key not found!"/>
731
<fail unless="${directory::exists(nunit.dir)}"
732
message="${nunit.dir} directory cannot be found!"/>
734
<property name="nunit.defines"
735
value="NUNIT_${string::replace(nunit.version,'.','_')}"/>
737
<property name="nunit.bin.dir"
738
value="${path::combine(nunit.dir,'bin')}"/>
740
<if test="${nunit.version >= '2.5' }">
742
<property name="alt.dir" value="net-1.1"
743
if="${runtime.config=='net-1.1'}"/>
744
<property name="alt.dir" value="net-2.0"
745
if="${runtime.config=='net-2.0'}"/>
746
<property name="alt.dir" value="net-1.1"
747
if="${runtime.config=='mono-1.0'}"/>
748
<property name="alt.dir" value="net-2.0"
749
if="${runtime.config=='mono-2.0'}"/>
751
<property name="nunit.bin.dir"
752
value="${path::combine(nunit.dir,alt.dir)}"/>
756
<fail unless="${directory::exists(nunit.bin.dir)}"
757
message="${nunit.bin.dir} directory cannot be found!"/>
761
<!-- ***************************************************************** -->
762
<!-- *** Set properties based on the build type *** -->
763
<!-- ***************************************************************** -->
765
<target name="set-build-config">
766
<call target="set-${build.config}-build-config"/>
769
<target name="set-debug-build-config">
770
<property name="build.config" value="debug"/>
771
<property name="build.debug" value="true"/>
772
<property name="build.defines" value="DEBUG,TRACE"/>
773
<property name="build.suffix" value="-dbg"/>
776
<target name="set-release-build-config">
777
<property name="build.config" value="release"/>
778
<property name="build.debug" value="false"/>
779
<property name="build.defines" value="TRACE"/>
780
<property name="build.suffix" value=""/>
783
<!-- ***************************************************************** -->
784
<!-- ** Set properties based on the source directory structure ** -->
785
<!-- ***************************************************************** -->
787
<target name="set-src-dirs">
789
<property name="addin.src.dir" value="${src.dir}/${addin.dir}"
790
if="${property::exists('addin.dir')}"/>
792
<if test="${not property::exists('addin.dir')}">
793
<property name="addin.dir" value="addin"/>
794
<property name="addin.src.dir" value="${src.dir}/${addin.dir}"/>
795
<if test="${not directory::exists(addin.src.dir)}">
796
<property name="addin.dir" value="."/>
797
<property name="addin.src.dir" value="${src.dir}"/>
801
<property name="framework.dir" value="framework"
802
unless="${property::exists('framework.dir')}"/>
803
<property name="framework.src.dir" value="${src.dir}/${framework.dir}"/>
805
<property name="sample.dir" value="sample"
806
unless="${property::exists('sample.dir')}"/>
807
<property name="sample.src.dir" value="${src.dir}/${sample.dir}"/>
809
<property name="fixture.dir" value="fixture"
810
unless="${property::exists('fixture.dir')}"/>
811
<property name="fixture.src.dir" value="${src.dir}/${fixture.dir}"/>
813
<property name="test.dir" value="tests"
814
unless="${property::exists('test.dir')}"/>
815
<property name="test.src.dir" value="${src.dir}/${test.dir}"/>
819
<!-- ***************************************************************** -->
820
<!-- *** Copy required assemblies from the lib dir *** -->
821
<!-- ***************************************************************** -->
823
<target name="copy-lib-files">
825
<property name="current.lib.dir" value="${lib.dir}"
826
unless="${property::exists('alt.lib.dir')}"/>
828
<property name="current.lib.dir" value="${alt.lib.dir}"
829
if="${property::exists('alt.lib.dir')}"/>
831
<copy todir="${current.build.dir}">
832
<fileset basedir="${current.lib.dir}">
833
<include name="*.dll"/>
839
<!-- ***************************************************************** -->
840
<!-- *** Copy assemblies from the NUnit installation *** -->
841
<!-- ***************************************************************** -->
843
<target name="copy-nunit-files">
845
<copy todir="${current.build.dir}" flatten="true">
846
<fileset basedir="${nunit.bin.dir}">
847
<include name="nunit.core.dll"/>
848
<include name="nunit.core.interfaces.dll"/>
849
<include name="nunit.framework.dll"/>
850
<include name="lib/nunit.framework.dll"/>
851
<include name="nunit.mocks.dll"/>
852
<include name="lib/nunit.mocks.dll"/>
853
<include name="log4net.dll"/>
859
<!-- ***************************************************************** -->
860
<!-- *** Dump selected property settings for debugging *** -->
861
<!-- ***************************************************************** -->
863
<target name="dump-settings"
864
description="Dump property settings (used for debugging)">
866
<echo>Project Directories</echo>
867
<echo> Source: ${src.dir}</echo>
868
<echo> addin ${addin.src.dir}</echo>
869
<echo> framework ${framework.src.dir}</echo>
870
<echo> tests ${test.src.dir}</echo>
871
<echo> fixture ${fixture.src.dir}</echo>
872
<echo> sample ${sample.src.dir}</echo>
873
<echo> Lib: ${lib.dir}</echo>
874
<if test="${property::exists('alt.lib.dir')}">
875
<echo> alt.lib ${alt.lib.dir}</echo>
877
<echo> Build: ${build.dir}</echo>
878
<echo> current ${current.build.dir}</echo>
879
<echo> Package: ${package.dir}</echo>
880
<echo> work ${work.dir}</echo>
882
<echo>Runtime Versions</echo>
883
<echo> Supported: ${supported.frameworks}</echo>
884
<echo> Default: ${default.runtime}</echo>
886
<echo>Output assemblies</echo>
887
<echo> addin ${addin.dll}</echo>
888
<echo> framework ${framework.dll}</echo>
889
<echo> tests ${test.dll}</echo>
890
<echo> fixture ${fixture.dll}</echo>
891
<echo> sample ${sample.dll}</echo>
893
<echo>Build Settings</echo>
894
<echo> runtime ${runtime.config}</echo>
895
<echo> config ${build.config}</echo>
896
<echo> defines ${current.build.defines}</echo>
899
<echo> Version: ${nunit.version}</echo>
900
<echo> Install Dir: ${nunit.dir}</echo>
901
<echo> bin ${nunit.bin.dir}</echo>-->
b'\\ No newline at end of file'