~nunit-core/nunitv2/2.5

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