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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
|
<?xml version="1.0"?>
<project name="NUnit" default="help" basedir=".">
<!-- ***************************************************************** -->
<!-- This script has been tested with the NAnt 0.86 beta 1 release. -->
<!-- -->
<!-- At least one of the supported runtimes and sdk must be installed. -->
<!-- In order to build the msi, WiX 2.0 and the WiX tasks for NAnt -->
<!-- are required. To run the test coverage target, NCover is -->
<!-- required. -->
<!-- -->
<!-- Currently, the .NET 1.0 builds of the GUI runner cannot be run -->
<!-- successfully. However, the .NET 1.1 builds may be run under 1.0. -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ********* Common properties that control the build ************** -->
<!-- ***************************************************************** -->
<!-- Project name - used as a prefix for packages -->
<property name="project.name" value="NUnit"/>
<!-- NUnit Base Package Version - First three digits -->
<property name="base.package.version" value="2.5.9"/>
<!-- Nominal version used for install directory and program
files menu. Normally the same as the package version,
but may differ when we are in alpha or beta. -->
<property name="nominal.version" value="2.5.9" />
<!-- Determine todays build number -->
<property name="temp.now" value="${datetime::now()}"/>
<property name="temp.yr" value="${datetime::get-year(temp.now)-2000}"/>
<property name="temp.day" value="${string::pad-left(datetime::get-day-of-year(temp.now),3,'0')}"/>
<property name="package.build.number" value="${temp.yr}${temp.day}"/>
<!-- NUnit full package version -->
<property name="package.version" value="${base.package.version}.${package.build.number}"/>
<!-- Package Configuration (Release, Alpha, Beta, etc.) -->
<property name="package.configuration" value=""/>
<!-- Base name for packages - add suffix for Alpha, Beta, RC -->
<property name="package.name"
value="${project.name}-${package.version}"/>
<!-- Frameworks supported by this build script. The first
installed framework found is the default for builds.
The first .NET and Mono frameworks found are the
respective net and mono defaults. -->
<property name="supported.frameworks"
value="net-2.0,net-3.5,net-4.0,net-1.1,net-1.0,mono-2.0,mono-1.0"/>
<!-- Packages we normally create -->
<!--<property name="standard.packages" value="std,mono" />-->
<property name="standard.packages" value="std" />
<!-- Our standard package for general distribution -->
<property name="default.package.config" value="std" />
<!-- Options for runing the NUnit tests -->
<property name="nunit.options" value=""/>
<!-- Additional internal properties are set in the include file -->
<include buildfile="nunit.build.include"/>
<!-- ***************************************************************** -->
<!-- *** Default Help Target *** -->
<!-- ***************************************************************** -->
<target name="help" description="Displays additional help information">
<echo>
This build file will build NUnitLite for any of the supported
runtime frameworks which are actually installed. To add or
support for a framework, edit this script
Running on the current system, the following runtime frameworks
are available for building and testing NUnit:
</echo>
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<echo message=" ${string::pad-right(framework,15,' ')}${framework::get-description(framework)}"/>
</foreach>
<property name="default.net.target" value="(Not available)"/>
<property name="default.mono.target" value="(Not available)"/>
<property name="default.net.target" value="${default.net.runtime}"
if="${property::exists('default.net.runtime')}"/>
<property name="default.mono.target" value="${default.mono.runtime}"
if="${property::exists('default.mono.runtime')}"/>
<echo>
The default build target is the ${default.runtime} debug config.
Generic runtime targets use the following defaults:
net ${default.net.target}
mono ${default.mono.target}
Note that targets that set the build configuration or runtime
to be used must come before action targets. For example:
nant net-1.1 release build
nant build-all
nant debug clean build
Use nant -projecthelp to see a full list of targets.
</echo>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets that set the build configuration *** -->
<!-- *** These must come before actions like build or test *** -->
<!-- ***************************************************************** -->
<target name="debug" depends="set-debug-build-config"
description="Set config to debug for commands that follow"/>
<target name="release" depends="set-release-build-config"
description="Set config to release for commands that follow"/>
<!-- ***************************************************************** -->
<!-- *** Targets that set the runtime configuration *** -->
<!-- *** These must come before actions like build or test *** -->
<!-- ***************************************************************** -->
<target name="net" depends="set-default-dot-net-runtime-config"
description="Set runtime to .NET 1.1 for commands that follow"/>
<target name="net-1.0" depends="set-net-1.0-runtime-config"
description="Set runtime to .NET 1.0 for commands that follow"/>
<target name="net-1.1" depends="set-net-1.1-runtime-config"
description="Set runtime to .NET 1.1 for commands that follow"/>
<target name="net-2.0" depends="set-net-2.0-runtime-config"
description="Set runtime to .NET 2.0 for commands that follow"/>
<target name="net-3.5" depends="set-net-3.5-runtime-config"
description="Set runtime to .NET 3.5 for commands that follow"/>
<target name="net-4.0" depends="set-net-4.0-runtime-config"
description="Set runtime to .NET 4.0 for commands that follow"/>
<target name="mono" depends="set-default-mono-runtime-config"
description="Set runtime to Mono 1.0 for commands that follow"/>
<target name="mono-1.0" depends="set-mono-1.0-runtime-config"
description="Set runtime to Mono 1.0 for commands that follow"/>
<target name="mono-2.0" depends="set-mono-2.0-runtime-config"
description="Set runtime to Mono 2.0 for commands that follow"/>
<!-- ***************************************************************** -->
<!-- *** Targets that clean directories *** -->
<!-- ***************************************************************** -->
<target name="clean" depends="set-build-dir"
description="Removes output created by the current build config">
<delete dir="${current.build.dir}"
if="${directory::exists( current.build.dir )}"/>
<delete file="src/GeneratedAssemblyInfo.cs"
if="${file::exists( 'src/GeneratedAssemblyInfo.cs' )}"/>
</target>
<target name="clean-all"
description="Removes output created by all build configs">
<delete dir="${project.build.dir}"
if="${directory::exists( project.build.dir )}"/>
<delete file="src/GeneratedAssemblyInfo.cs"
if="${file::exists( 'src/GeneratedAssemblyInfo.cs' )}"/>
</target>
<!-- Removes the current package working directory -->
<target name="clean-package-dir">
<delete dir="${package.working.dir}"
if="${directory::exists( package.working.dir )}"/>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets that generate code *** -->
<!-- ***************************************************************** -->
<!-- Generate AssemblyInfo for this build -->
<target name="gen-assembly-info">
<asminfo output="src/GeneratedAssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System.Reflection"/>
</imports>
<attributes>
<attribute type="AssemblyCompanyAttribute" value="NUnit.org"/>
<attribute type="AssemblyProductAttribute" value="NUnit"/>
<attribute type="AssemblyCopyrightAttribute"
value="Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved."/>
<attribute type="AssemblyTrademarkAttribute" value="NUnit is a trademark of NUnit.org"/>
<attribute type="AssemblyVersionAttribute" value="${package.version}"/>
<attribute type="AssemblyInformationalVersionAttribute" value="${package.version}"/>
<attribute type="AssemblyConfigurationAttribute" value="${package.configuration}"/>
</attributes>
</asminfo>
</target>
<!-- Generate code for the fluent constraint builder interface -->
<target name="gen-syntax"
description="Generate code for the fluent constraint builder interface">
<exec program="GenSyntax.exe"
managed="true"
basedir="${project.tools.dir}/bin"
workingdir="${project.src.dir}/NUnitFramework/framework"
commandline="SyntaxElements.txt"/>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets that perform builds *** -->
<!-- ***************************************************************** -->
<!-- Build NUnit for default runtime version and config -->
<target name="build" depends="make-build-dir,gen-assembly-info"
description="Build NUnit for default runtime version and config">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} build"/>
<echo message="*"/>
<!-- Copy key file to base directory, so second level files can access it -->
<copy file="${project.base.dir}/nunit.snk" todir="${project.build.dir}"/>-->
<!-- Copy lib files to current lib dir dir -->
<copy todir="${current.lib.dir}">
<fileset basedir="${project.lib.dir}">
<include name="*.dll"/>
</fileset>
</copy>
<!-- Build NUnit components and tests -->
<nant target="build">
<buildfiles refid="project.buildfiles"/>
</nant>
<!-- Build GUI if runtime is 2.0 or greater -->
<call target="build-gui" if="${build.gui}" />
<!-- Copy test project for this runtime framework -->
<copy file="${project.base.dir}/${runtime.testproj}"
tofile="${current.build.dir}/NUnitTests.nunit">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<!-- Copy other files for running tests -->
<copy todir="${current.build.dir}" flatten="true">
<fileset basedir="${project.base.dir}">
<include name="NUnitTests.config" />
<include name="NUnitFitTests.html" />
<include name="clr.bat" />
<include name="src/PNUnit/*.conf" />
<include name="src/PNUnit/runpnunit.bat" />
</fileset>
</copy>
</target>
<!-- Build the Gui -->
<target name="build-gui">
<fail unless="${build.gui}"
message="Runtime 2.0 or greater is required to build the NUnit GUI" />
<nant target="build">
<buildfiles refid="gui.buildfiles"/>
</nant>
</target>
<!-- Build current config for all available runtimes -->
<target name="build-all"
description="Build current config for all available runtimes">
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<call target="set-${framework}-runtime-config"/>
<call target="build"/>
</foreach>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for running tests *** -->
<!-- ***************************************************************** -->
<target name="test" depends="build,run-test"
description="Build and run tests for selected config and runtime"/>
<target name="run-test"
description="Run tests for selected config and runtime (no rebuild)">
<echo message="*"/>
<echo message="* Testing ${runtime.config} ${build.config} build"/>
<echo message="* Running under ${nant.settings.currentframework}"/>
<echo message="*"/>
<!-- We use exec rather than the nunit2 task because we are testing
a new build of NUnit which is likely not to be included in the Nant build -->
<!-- Mono currently has a SIGSEGV fault if we run in a single AppDomain -->
<property name="result.file"
value="TestResult-${nant.settings.currentframework}"/>
<exec basedir="${current.build.dir}"
workingdir="${current.build.dir}"
program="nunit-console.exe"
managed="strict"
commandline="NUnitTests.nunit ${nunit.options} -xml:${result.file}.xml" />
</target>
<target name="test-coverage" depends="build"
description="Run tests for a build under NCover to get coverage results">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} test coverage run"/>
<echo message="*"/>
<property name="ncover.options"
value="//a nunit.framework;nunit.core;nunit.extensions;nunit.util;nunit.console;nunit.uikit;nunit-gui-runner"/>
<!-- We use exec rather than the nunit2 task because we are testing
a new build of NUnit which is likely not to be included in the Nant build -->
<exec basedir="${ncover.dir}"
workingdir="${current.build.dir}"
program="NCover.Console.exe"
managed="strict"
commandline="nunit-console.exe NUnitTests.nunit ${nunit.options} ${ncover.options}"
if="${build.win32}" />
<!-- Mono currently has a SIGSEGV fault if we run in a single AppDomain -->
a new build of NUnit which is likely not to be included in the Nant build -->
<exec basedir="${ncover.dir}"
workingdir="${current.build.dir}"
program="NCover.Console.exe"
managed="strict"
commandline="nunit-console.exe NUnitTests.nunit ${nunit.options}"
unless="${build.win32}" />
</target>
<target name="test-all"
description="Build and test all runtimes for current config">
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<call target="set-${framework}-runtime-config"/>
<call target="test" />
</foreach>
</target>
<target name="test-each-runtime" depends="build"
description="Run tests for the current build under each runtime">
<foreach item="String" delim=","
property="framework" in="${supported.test.platforms}">
<if test="${framework::exists( framework )}">
<property name="nant.settings.currentframework"
value="${framework}" />
<call target="run-test" failonerror="false" />
</if>
</foreach>
<property name="nant.settings.currentframework" value="${runtime.config}" />
<echo message="*" />
<echo message="* Restored runtime to ${nant.settings.currentframework}" />
<echo message="*" />
</target>
<target name="test-under-net-1.0">
<if test="${framework::exists('net-1.0')}">
<property name="nant.settings.currentframework" value="net-1.0"/>
<call target="run-test"/>
<property name="nant.settings.currentframework" value="${runtime.config}" />
</if>
</target>
<target name="test-all-under-each"
description="Build all runtimes and test the builds under each runtime.">
<call target="set-release-build-config"/>
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<call target="set-${framework}-runtime-config"/>
<call target="test-each-runtime" failonerror="false"/>
</foreach>
</target>
<target name="nunit2-test" depends="build"
description="Run tests for a build using the nunit2 task">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} test run"/>
<echo message="*"/>
<nunit2>
<formatter type="Plain"/>
<test assemblyname="${current.build.dir}/nunit.framework.tests.dll"/>
</nunit2>
</target>
<target name="timing-test" depends="build"
description="Run timing tests (long)">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} timing tests"/>
<echo message="*"/>
<echo message="* WARNING: Test may take some time to run"/>
<echo message="*"/>
<exec basedir="${current.build.dir}"
workingdir="${current.build.dir}"
program="nunit-console.exe"
commandline="timing-tests.dll"/>
</target>
<target name="gui-test" depends="build"
description="Run tests for a build using gui runner">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} gui test run"/>
<echo message="*"/>
<exec basedir="${current.build.dir}"
workingdir="${current.build.dir}"
program="nunit.exe"
managed="strict"
commandline="NUnitTests.nunit -run"/>
</target>
<target name="fit-tests" depends="build"
description="Run Fit Acceptance tests on the build">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} Fit Tests"/>
<echo message="*"/>
<exec basedir="${current.build.dir}"
workingdir="${current.build.dir}"
program="runfile.exe"
managed="strict"
commandline="NUnitFitTests.html TestResults.html ." />
</target>
<!-- ***************************************************************** -->
<!-- * Build the NUnit samples - not part of normal build *** -->
<!-- ***************************************************************** -->
<property name="samples.bin.dir"
value="${path::combine(project.samples.dir, 'bin')}"/>
<target name="clean-samples" description="Removes the samples build directory">
<delete dir="${samples.bin.dir}" />
</target>
<target name="build-samples" depends="build"
description="Build the NUnit samples">
<mkdir dir="${samples.bin.dir}" unless="${directory::exists(samples.bin.dir)}" />
<copy todir="${samples.bin.dir}"
file="${path::combine(current.framework.dir,'nunit.framework.dll')}" />
<copy todir="${samples.bin.dir}"
file="${path::combine(current.lib.dir,'nunit.core.interfaces.dll')}" />
<copy todir="${samples.bin.dir}"
file="${path::combine(current.lib.dir,'nunit.core.dll')}" />
<nant target="build">
<buildfiles refid="sample.buildfiles" />
</nant>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for packaging the NUnit distribution *** -->
<!-- ***************************************************************** -->
<target name="package-all"
description="Create all the standard packages for distribution">
<call target="package-src"/>
<call target="package-docs"/>
<foreach item="String" delim=","
property="package.config" in="${standard.packages}">
<call target="set-package-config"/>
<call target="package"/>
</foreach>
</target>
<!-- ***************************************************************** -->
<!-- *** Package Binaries From Current Build *** -->
<!-- ***************************************************************** -->
<target name="package-build" depends="build"
description="Create a zip of the current build (not a full installation)">
<property name="zip.file.name"
value="${package.name}-${runtime.config}${build.suffix}"/>
<zip ziplevel="9"
zipfile="${project.package.dir}/${zip.file.name}.zip">
<fileset basedir="${current.build.dir}" prefix="${zip.file.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<!-- ***************************************************************** -->
<!-- *** Package Using the Currently Selected Package Config *** -->
<!-- *** or the default package if none is selected *** -->
<!-- ***************************************************************** -->
<target name="package" depends="build-install-image"
description="Create a package using the current or default config">
<call target="create-zip"/>
<call target="create-msi" if="${create.msi}"/>
</target>
<!-- ***************************************************************** -->
<!-- *** Package as a zip *** -->
<!-- ***************************************************************** -->
<target name="package-zip"
depends="build-install-image,create-zip"
description="Create zip binary distribution package"/>
<!-- ***************************************************************** -->
<!-- *** Package as an msi *** -->
<!-- ***************************************************************** -->
<target name="package-msi" depends="build-install-image,create-msi"
description="Build standard msi file and deploy it to the package dir"/>
<!-- ***************************************************************** -->
<!-- *** Install the msi *** -->
<!-- ***************************************************************** -->
<target name="install-msi" description="Install msi file on system" >
<exec program="msiexec" workingdir="${project.package.dir}"
commandline="/i ${package.name}-${runtime.config}${build.suffix}.msi /passive" />
</target>
<!-- ***************************************************************** -->
<!-- *** Uninstall the msi *** -->
<!-- ***************************************************************** -->
<target name="remove-msi" description="Uninstall an msi" >
<exec program="msiexec" workingdir="${project.package.dir}"
commandline="/x ${package.name}-${runtime.config}${build.suffix}.msi /passive" />
</target>
<!-- ***************************************************************** -->
<!-- *** Create the zip *** -->
<!-- ***************************************************************** -->
<!-- Create zip from existing install image -->
<target name="create-zip">
<!-- Create the zip file -->
<property name="zip.file.name"
value="${package.name}-${package.config}${build.suffix}"
unless="${package.config==default.package.config}"/>
<property name="zip.file.name"
value="${package.name}${build.suffix}"
if="${package.config==default.package.config}"/>
<zip ziplevel="9"
zipfile="${project.package.dir}/${zip.file.name}.zip">
<fileset basedir="${package.working.dir}" prefix="${package.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<!-- ***************************************************************** -->
<!-- *** Create the msi *** -->
<!-- ***************************************************************** -->
<!-- Create msi from existing install image -->
<target name="create-msi">
<fail message="MSI can only be built on the Win32 platform" unless="${platform::is-windows()}"/>
<fail message="MSI can only be built for a Win32 runtime" unless="${build.win32}"/>
<property name="wix.dir"
value="${project.tools.dir}/wix"/>
<property name="work.dir"
value="${package.working.dir}"/>
<property name="install.dir"
value="${project.base.dir}/install"/>
<property name="build.suffix" value=""
unless="${property::exists('build.suffix')}" />
<property name="msi.file.name"
value="${package.name}-${package.config}${build.suffix}.msi"
unless="${package.config==default.package.config}"/>
<property name="msi.file.name"
value="${package.name}${build.suffix}.msi"
if="${package.config==default.package.config}"/>
<candle out="${work.dir}/" exedir="${wix.dir}">
<defines>
<define name="ProductVersion" value="${package.version}" />
<define name="NominalVersion" value="${nominal.version}" />
<define name="InstallImage" value="package\NUnit-${package.version}" />
</defines>
<sources basedir="${install.dir}">
<include name="bin.wxs" />
<include name="nunit-gui.wxs" />
<include name="doc.wxs" />
<include name="tests.wxs" />
<include name="samples.wxs" />
<include name="pnunit.wxs" />
<include name="NUnit.wxs" />
</sources>
</candle>
<light exedir="${wix.dir}"
out="${project.package.dir}/${msi.file.name}"
locfile="${wix.dir}/WixUI_en-us.wxl">
<sources>
<include name="${work.dir}/NUnit.wixobj" />
<include name="${work.dir}/bin.wixobj" />
<include name="${work.dir}/nunit-gui.wixobj" />
<include name="${work.dir}/doc.wixobj" />
<include name="${work.dir}/samples.wixobj" />
<include name="${work.dir}/tests.wixobj" />
<include name="${work.dir}/pnunit.wixobj" />
<include name="${wix.dir}/wixui.wixlib" />
</sources>
</light>
</target>
<!-- ***************************************************************** -->
<!-- *** Package source files *** -->
<!-- ***************************************************************** -->
<target name="package-src" depends="clean-package-dir"
description="Create full source package for developer use">
<call target="copy-docs"/>
<call target="copy-samples"/>
<call target="copy-src"/>
<call target="copy-tools" />
<copy file="license.txt" todir="${package.working.dir}" />
<!-- Create the zip file -->
<zip ziplevel="9"
zipfile="${project.package.dir}/${package.name}-src.zip">
<fileset basedir="${package.working.dir}" prefix="${package.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<!-- ***************************************************************** -->
<!-- *** Package docs *** -->
<!-- ***************************************************************** -->
<target name="package-docs" depends="clean-package-dir"
description="Create a zip of the docs only">
<call target="copy-docs"/>
<!-- Create the zip file -->
<zip ziplevel="9"
zipfile="${project.package.dir}/${package.name}-docs.zip">
<fileset basedir="${package.working.dir}" prefix="${package.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<!-- ***************************************************************** -->
<!-- *** Package resources *** -->
<!-- ***************************************************************** -->
<target name="package-resources" depends="clean-package-dir"
description="Package resources for localization - currently not working">
<copy todir="${package.resource.dir}/nunit-gui-runner">
<fileset basedir="GuiRunner/nunit-gui/obj/Release">
<include name="*.resources"/>
</fileset>
</copy>
<copy todir="${package.resource.dir}/nunit.uikit">
<fileset basedir="GuiComponents/UiKit/obj/Release">
<include name="NUnit.UiKit.AddConfigurationDialog.resources"/>
<include name="NUnit.UiKit.AssemblyPathDialog.resources"/>
<include name="NUnit.UiKit.ConfigurationEditor.resources"/>
<include name="NUnit.UiKit.RenameConfigurationDialog.resources"/>
<include name="NUnit.UiKit.TestPropertiesDialog.resources"/>
<include name="NUnit.UiKit.TestTree.resources"/>
</fileset>
</copy>
<copy todir="${package.working.dir}">
<fileset basedir="${project.tools.dir}/localization">
<include name="*.*"/>
</fileset>
</copy>
<if test="${property::exists('localize')}">
<foreach property="culture" item="String" delim=","
in="${localize}">
<foreach property="folder" item="Folder"
in="${package.working.dir}/resources">
<property name="proj"
value="${path::get-file-name(folder)}"/>
<property name="projdir"
value="${package.working.dir}/${culture}/${proj}"/>
<foreach property="file" item="File" in="${folder}">
<property name="filename"
value="${path::get-file-name-without-extension(file)}"/>
<copy file="${file}"
tofile="${projdir}/${filename}.${culture}.resources"/>"
</foreach>
</foreach>
</foreach>
</if>
<zip ziplevel="9"
zipfile="${project.package.dir}/${package.name}-resources.zip">
<fileset basedir="${package.working.dir}" prefix="${package.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<!-- ***************************************************************** -->
<!-- *** Helper targets used for packaging *** -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- *** Build install image for a package *** -->
<!-- ***************************************************************** -->
<!-- Create an install image for use by a package -->
<target name="build-install-image" depends="clean-package-dir">
<call target="copy-top-level-files" />
<foreach item="String" delim="+"
property="runtime" in="${package.runtimes}">
<if test="${framework::exists( runtime )}">
<if test="${framework::sdk-exists( runtime )}">
<call target="set-${runtime}-runtime-config"/>
<call target="copy-bins" />
</if>
</if>
</foreach>
<call target="copy-docs" />
<call target="copy-samples" />
</target>
<target name="copy-top-level-files">
<copy file="license.txt" todir="${package.working.dir}" />
<copy file="${project.tools.dir}/fit/license.txt"
tofile="${package.working.dir}/fit-license.txt" />
<copy file="${project.src.dir}/GuiRunner/nunit-gui/Logo.ico"
todir="${package.working.dir}" />
<copy file="NUnitFitTests.html"
todir="${package.working.dir}" />
</target>
<!-- ***************************************************************** -->
<!-- *** Copy a set of binaries for a package *** -->
<!-- ***************************************************************** -->
<target name="copy-bins" depends="build">
<mkdir dir="${package.bin.dir}"/>
<copy todir="${package.bin.dir}/${runtime.config}">
<fileset basedir="${current.build.dir}">
<include name="*"/>
<include name="lib/*"/>
<include name="tests/*"/>
<include name="framework/*"/>
<exclude name="*.wixobj"/>
<exclude name="nunit-server.*"/>
<exclude name="nunit-test-server.*"/>
</fileset>
</copy>
</target>
<!-- ***************************************************************** -->
<!-- *** Copy the documentation for a package *** -->
<!-- ***************************************************************** -->
<target name="copy-docs">
<mkdir dir="${package.doc.dir}"/>
<copy todir="${package.doc.dir}">
<fileset basedir="${project.doc.dir}">
<include name="*.html"/>
<include name="nunit.css"/>
<include name="codeFuncs.js"/>
<include name="favicon.ico"/>
<include name="files/*"/>
<include name="img/*"/>
<exclude name="img/thumbs.db"/>
</fileset>
</copy>
</target>
<!-- ***************************************************************** -->
<!-- *** Copy sample programs for a package *** -->
<!-- ***************************************************************** -->
<target name="copy-samples">
<mkdir dir="${package.samples.dir}"/>
<!-- Copy files that are not part of an individual project -->
<copy todir="${package.samples.dir}">
<fileset basedir="${project.samples.dir}">
<include name="ReadMe.txt" />
<include name="samples.common" />
<include name="csharp/CSharp.sln" />
<include name="jsharp/jsharp.sln" />
<include name="vb/vb-samples.sln" />
<include name="cpp/managed/managed-cpp.sln" />
<include name="cpp/cpp-cli/cpp-cli.sln" />
<include name="Extensibility/Core/CoreExtensibility.sln" />
<include name="Extensibility/Core/Install.bat" />
</fileset>
</copy>
<!-- Copy each project's files -->
<nant target="package">
<buildfiles refid="sample.buildfiles" failonerror="true" />
</nant>
</target>
<!-- ***************************************************************** -->
<!-- *** Copy the source code for a package *** -->
<!-- ***************************************************************** -->
<target name="copy-src">
<delete dir="${package.src.dir}" />
<mkdir dir="${package.src.dir}"/>
<!-- Copy project top level files -->
<copy todir="${package.working.dir}">
<fileset basedir="${project.base.dir}">
<include name="license.rtf"/>
<include name="nunit.build"/>
<include name="nunit.build.include"/>
<include name="nunit.sln"/>
<include name="nunit.snk"/>
<include name="NUnitFitTests.html"/>
<include name="NUnitTests.nunit"/>
<include name="NUnitTests.config"/>
<include name="NUnitTests.v1.nunit"/>
<include name="NUnitTests.v2.nunit"/>
</fileset>
</copy>
<!-- Copy src dir files -->
<copy todir="${package.src.dir}">
<fileset basedir="${project.src.dir}">
<include name="nunit.snk"/>
<include name="CommonAssemblyInfo.cs"/>
<include name="nunit20under21.config"/>
<include name="nunit20under22.config"/>
<include name="nunit21under22.config"/>
<include name="PNUnit/*.conf"/>
<include name="PNUnit/runpnunit.bat"/>
</fileset>
</copy>
<!-- Copy lib dir files -->
<copy todir="${package.lib.dir}">
<fileset basedir="${project.lib.dir}">
<include name="*.dll"/>
</fileset>
</copy>
<!-- Copy install directory files -->
<copy todir="${package.install.dir}">
<fileset basedir="${project.install.dir}">
<include name="bin.wxs" />
<include name="nunit-gui.wxs" />
<include name="doc.wxs" />
<include name="tests.wxs" />
<include name="samples.wxs" />
<include name="NUnit.wxs"/>
</fileset>
</copy>
<!-- Copy individual projects -->
<nant target="package" inheritrefs="true">
<buildfiles refid="project.buildfiles" />
</nant>
<nant target="package" inheritrefs="true">
<buildfiles refid="gui.buildfiles" />
</nant>
</target>
<!-- ***************************************************************** -->
<!-- *** Copy the tools for a package *** -->
<!-- ***************************************************************** -->
<target name="copy-tools">
<mkdir dir="${package.tools.dir}" />
<copy todir="${package.tools.dir}">
<fileset basedir="${project.tools.dir}">
<include name="fit/fit.dll"/>
<include name="fit/runFile.exe"/>
<include name="fit/runFile.exe.config"/>
<include name="fit/license.txt"/>
<include name="bin/GenSyntax.exe"/>
<include name="src/Gensyntax/GenSyntax.build"/>
<include name="src/Gensyntax/GenSyntax.csproj"/>
<include name="src/Gensyntax/GenSyntax.sln"/>
<include name="src/Gensyntax/App.ico"/>
<include name="src/GenSyntax/*.cs"/>
<include name="src/Gensyntax/Templates/*.cs"/>
</fileset>
</copy>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for installing the NUnit distribution *** -->
<!-- ***************************************************************** -->
<target name="install" depends="build-install-image"
description="Install NUnit directly from the build">
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for building custom tools used in the build *** -->
<!-- *** *** -->
<!-- *** NOTE: Tools are not built automatically. If you are *** -->
<!-- *** building from source and don't have binaries for *** -->
<!-- *** NUnit-specific tools, you can run this target. *** -->
<!-- ***************************************************************** -->
<target name="clean-tools"
description="Remove binaries of tools used to build NUnit (DANGEROUS!)">
<nant target="clean" buildfile="tools/src/GenSyntax/GenSyntax.build"/>
</target>
<target name="build-tools"
description="Build tools used in building NUnit">
<nant target="build" buildfile="tools/src/GenSyntax/GenSyntax.build"/>
</target>
<!-- ***************************************************************** -->
<!-- ****** Patternsets and Filesets Used by Various Targets ******** -->
<!-- ***************************************************************** -->
<fileset id="project.buildfiles" basedir="${project.src.dir}">
<!-- NUnit Base -->
<include name="NUnitFramework/framework/nunit.framework.build" />
<include name="NUnitCore/interfaces/nunit.core.interfaces.build" />
<include name="NUnitCore/core/nunit.core.build" />
<include name="NUnitMocks/mocks/nunit.mocks.build" />
<include name="ClientUtilities/util/nunit.util.build" />
<!-- Console Runner -->
<include name="ConsoleRunner/nunit-console/nunit-console.build" />
<include name="ConsoleRunner/nunit-console-exe/nunit-console.exe.build" />
<!-- Test Server -->
<include name="NUnitTestServer/nunit-server-exe/nunit-server.exe.build" />
<include name="NUnitTestServer/nunit-agent-exe/nunit-agent.exe.build" />
<!-- PNUnit -->
<include name="PNUnit/pnunit.framework/pnunit.framework.build" />
<include name="PNUnit/agent/pnunit-agent.build"/>
<include name="PNUnit/launcher/pnunit-launcher.build"/>
<!-- Test Utilities and Dummy Projects -->
<include name="tests/mock-assembly/mock-assembly.build" />
<include name="tests/nonamespace-assembly/nonamespace-assembly.build" />
<include name="tests/test-assembly/test-assembly.build" />
<include name="tests/test-utilities/test-utilities.build" />
<include name="tests/loadtest-assembly/loadtest-assembly.build" />
<include name="tests/timing-tests/timing-tests.build" />
<!-- NUnit Base Tests -->
<include name="NUnitFramework/tests/nunit.framework.tests.build" />
<include name="NUnitCore/tests/nunit.core.tests.build" />
<include name="NUnitMocks/tests/nunit.mocks.tests.build" />
<include name="ClientUtilities/tests/nunit.util.tests.build" />
<!-- Console Runner Tests -->
<include name="ConsoleRunner/tests/nunit-console.tests.build" />
<!-- PNUnit Tests -->
<include name="PNUnit/tests/pnunit.tests.build"/>
<!-- FIT Tests -->
<include name="NUnitFixtures/fixtures/nunit.fixtures.build" />
<include name="NUnitFixtures/tests/nunit.fixtures.tests.build" />
</fileset>
<fileset id="gui.buildfiles" basedir="${project.src.dir}">
<!-- Gui Runner -->
<include name="GuiException/UiException/nunit.uiexception.build" />
<include name="GuiComponents/UiKit/nunit.uikit.build" />
<include name="GuiRunner/nunit-gui/nunit-gui.build" />
<include name="GuiRunner/nunit-gui-exe/nunit-gui.exe.build" />
<!-- GUI Tests -->
<include name="GuiException/tests/nunit.uiexception.tests.build" />
<include name="GuiComponents/tests/nunit.uikit.tests.build" />
<include name="GuiRunner/tests/nunit-gui.tests.build" />
</fileset>
<!-- BuildFiles for Samples -->
<!-- Note: For each sample, sample.buildfile includes sample.build.
The distribution includes sample.build, but not sample.buildfile,
because the latter is used by NUnit for packaging. -->
<fileset id="sample.buildfiles" basedir="${project.samples.dir}">
<!-- CSharp Samples -->
<include name="csharp/failures/cs-failures.build" />
<include name="csharp/money/cs-money.build" />
<include name="csharp/syntax/cs-syntax.build" />
<!-- JSharp Samples -->
<include name="jsharp/failures/jsharp-failures.build"
if="${task::exists('vjc') and platform::is-windows()}" />
<!-- VB Samples -->
<include name="vb/failures/vb-failures.build"
if="${task::exists('vbc') and platform::is-windows()}" />
<include name="vb/money/vb-money.build"
if="${task::exists('vbc') and platform::is-windows()}" />
<include name="vb/syntax/vb-syntax.build"
if="${task::exists('vbc') and platform::is-windows()}" />
<!-- Managed C++ Samples -->
<include name="cpp/managed/failures/cpp-managed-failures.build"
if="${platform::is-windows()}" />
<!-- C++/CLI Samples -->
<include name="cpp/cpp-cli/failures/cpp-cli-failures.build"
if="${platform::is-windows()}" />
<include name="cpp/cpp-cli/syntax/cpp-cli-syntax.build"
if="${platform::is-windows()}" />
<!-- Extensibility Samples -->
<include name="Extensibility/Core/Minimal/Minimal.build" />
<include name="Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.build" />
<include name="Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.build" />
</fileset>
<!-- Files to be copied to source directories -->
<fileset id="source-files" >
<include name="**/*.sln" />
<include name="**/*.csproj" />
<include name="**/*.config" />
<include name="**/*.build" />
<include name="**/*.cs" />
<include name="**/*.xsd" />
<include name="**/*.xslt" />
<include name="**/*.resx" />
<include name="**/*.jpg" />
<include name="**/*.gif" />
<include name="**/*.ico" />
<include name="**/*.txt" />
<include name="**/resources/*" />
<exclude name="**/CVS/**" />
<exclude name="**/bin/**" />
<exclude name="**/obj/**" />
<exclude name="**/Debug/**" />
<exclude name="**/Release/**" />
</fileset>
</project>
|