-
Notifications
You must be signed in to change notification settings - Fork 0
/
NAnt.build
880 lines (839 loc) · 44.9 KB
/
NAnt.build
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
<?xml version="1.0" ?>
<!-- NAnt build file for building NAnt -->
<project name="nant" default="test">
<!-- set build.date property to current date in format yyyy-MM-dd -->
<tstamp property="build.date" pattern="yyyy-MM-dd" />
<!-- global project settings -->
<property name="project.name" value="nant" />
<property name="project.version" value="0.93" unless="${property::exists('project.version')}" />
<property name="project.release.type" value="dev" unless="${property::exists('project.release.type')}" /> <!-- nightly | dev | alpha | beta# | rc# | release -->
<if test="${project.release.type == 'nightly'}">
<property name="project.version.full" value="${project.version + '-nightly-' + build.date}" />
</if>
<if test="${project.release.type != 'nightly'}">
<property name="project.version.full" value="${project.version + if(project.release.type == 'release', '', '-' + project.release.type)}" dynamic="true" />
</if>
<property name="build.warnaserror" value="false" />
<if test="${project.release.type == 'dev' or project.release.type == 'nightly'}">
<property name="build.warnaserror" value="true" />
</if>
<!--
specifies whether the CommonAssemblyInfo.cs file should be created.
we do not want this for releases (whether they're beta or release) as
this would cause the build number to be updated
-->
<property name="create.assemblyinfo" value="true" />
<!-- default configuration -->
<property name="project.config" value="debug" /> <!-- debug | release -->
<property name="nant.console.name" value="NAnt" />
<property name="build.defines" value="" />
<property name="build.number" value="${math::abs(math::floor(timespan::get-total-days(datetime::now() - datetime::parse('01/01/2000'))))}" />
<!-- platform specific properties. These are the defaults -->
<property name="current.build.defines" value="${build.defines}" />
<fileset id="ext.core" basedir="src">
<include name="NAnt.DotNet/NAnt.DotNet.build" />
<include name="NAnt.Compression/NAnt.Compression.build" />
<include name="NAnt.NUnit/NAnt.NUnit.build" />
<include name="NAnt.SourceControl/NAnt.SourceControl.build" />
<include name="NAnt.MSNet/NAnt.MSNet.build" />
<include name="NAnt.Win32/NAnt.Win32.build" />
<include name="NAnt.VisualCpp/NAnt.VisualCpp.build" />
<include name="NAnt.VSNet/NAnt.VSNet.build" />
</fileset>
<fileset id="ext.core.tests" basedir="tests">
<include name="NAnt.DotNet/NAnt.DotNet.build" />
<include name="NAnt.Compression/NAnt.Compression.build" />
<include name="NAnt.SourceControl/NAnt.SourceControl.build" />
<include name="NAnt.MSNet/NAnt.MSNet.build" />
<include name="NAnt.Win32/NAnt.Win32.build" />
<include name="NAnt.VisualCpp/NAnt.VisualCpp.build" />
<include name="NAnt.VSNet/NAnt.VSNet.build" />
</fileset>
<!-- build in help manual -->
<target name="help" description="Describe usage of this file">
<echo message="Synopsis:" />
<echo message=" nant" />
<echo message=" nant [debug|release] [clean|cleanall] [build] [test]" />
<echo message="" />
<echo message="Targets:" />
<echo message=" clean - clean the files for the current project configuration" />
<echo message=" cleanall - clean the files for all project configurations" />
<echo message=" debug - setup the build for 'debug' project configuration" />
<echo message=" release - setup the build for 'release' project configuration" />
<echo message="" />
</target>
<!-- project configurations (used by self-test and self-doc tasks) -->
<target name="debug" description="Perform a 'debug' build">
<property name="project.config" value="debug" />
<property name="build.debug" value="true" />
<property name="build.dir" value="${project::get-base-directory()}/build/${framework::get-target-framework()}.${platform::get-name()}/${project.name}-${project.config}" />
</target>
<target name="release" description="Perform a 'release' build">
<property name="project.config" value="release" />
<property name="build.debug" value="false" />
<property name="build.dir" value="${project::get-base-directory()}/build/${project.name}" />
</target>
<!-- build tasks -->
<target name="init" description="Initializes build properties">
<call target="${project.config}" />
<call target="set-framework-configuration" />
</target>
<target name="create-common-assemblyinfo" if="${create.assemblyinfo}">
<!-- ensure src/CommonAssemblyInfo.cs is writable if it already exists -->
<attrib file="src/CommonAssemblyInfo.cs" readonly="false" if="${file::exists('src/CommonAssemblyInfo.cs')}" />
<!-- generate the source file holding the common assembly-level attributes -->
<asminfo output="src/CommonAssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System" />
<import namespace="System.Reflection" />
<import namespace="System.Runtime.InteropServices" />
</imports>
<attributes>
<attribute type="ComVisibleAttribute" value="false" />
<attribute type="CLSCompliantAttribute" value="true" />
<attribute type="AssemblyTitleAttribute" value="NAnt" />
<attribute type="AssemblyDescriptionAttribute" value="A .NET Build Tool" />
<attribute type="AssemblyConfigurationAttribute" value="${project.release.type}" />
<attribute type="AssemblyCompanyAttribute" value="http://nant.sourceforge.net" />
<attribute type="AssemblyProductAttribute" value="NAnt" />
<attribute type="AssemblyCopyrightAttribute" value="Copyright (C) 2001-${datetime::get-year(datetime::now())} Gerry Shaw" />
<attribute type="AssemblyTrademarkAttribute" value="" />
<attribute type="AssemblyCultureAttribute" value="" />
<attribute type="AssemblyVersionAttribute" value="${project.version}.${build.number}.0" />
<attribute type="AssemblyInformationalVersionAttribute" value="${project.version}" />
</attributes>
</asminfo>
</target>
<!-- cleanup -->
<target name="clean" depends="init" description="Deletes current build configuration">
<delete dir="${build.dir}" if="${directory::exists(build.dir)}" />
</target>
<target name="cleanall" description="Deletes every build configuration">
<echo message="Deleting all builds from all configurations" />
<delete dir="build" if="${directory::exists('build')}" />
</target>
<target name="build" depends="init, create-common-assemblyinfo" description="Builds current configuration">
<echo message="Build Directory is ${build.dir}" />
<!-- ensure bin directory exists -->
<mkdir dir="${build.dir}/bin" />
<!-- ensure lib directory exists -->
<mkdir dir="${build.dir}/bin/lib" />
<!-- copy third party executables -->
<copy todir="${build.dir}/bin">
<fileset basedir="bin">
<include name="scvs.exe" />
</fileset>
</copy>
<copy todir="${build.dir}/bin">
<fileset basedir="lib/common/neutral">
<!-- copy log4net assembly, workaround for Mono bug #57602 -->
<include name="log4net.dll" />
<!-- #ziplib command line client -->
<include name="scvs.exe" />
</fileset>
</copy>
<!-- copy third party assemblies -->
<copy todir="${build.dir}/bin/lib">
<fileset basedir="lib">
<include name="**/*" />
<exclude name="common/neutral/log4net.dll" />
<exclude name="common/neutral/scvs.exe" />
</fileset>
</copy>
<!-- build NAnt.Core assembly -->
<nant buildfile="src/NAnt.Core/NAnt.Core.build" target="build" />
<!-- build NAnt.Console assembly -->
<nant buildfile="src/NAnt.Console/NAnt.Console.build" target="build" />
<!-- build extension assemblies -->
<nant target="build">
<buildfiles refid="ext.core" />
</nant>
<!-- build NAnt.MSBuild assembly -->
<nant buildfile="src/NAnt.MSBuild/NAnt.MSBuild.build" target="build" />
<!-- build NDoc.Documenter.NAnt assembly -->
<nant buildfile="src/NDoc.Documenter.NAnt/NDoc.Documenter.NAnt.build" target="build" />
<!-- build NAnt.Core.Tests assembly -->
<nant buildfile="tests/NAnt.Core/NAnt.Core.build" target="build" />
<!-- build NAnt.Console.Tests assembly -->
<nant buildfile="tests/NAnt.Console/NAnt.Console.build" target="build" />
<!-- build tests for extension assemblies -->
<nant target="build">
<buildfiles refid="ext.core.tests"/>
</nant>
</target>
<!-- test the newly built NAnt -->
<target name="test" depends="build" description="Tests current configuration">
<echo message="Running unit tests with just built version of NAnt." />
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-test" />
</exec>
</target>
<target name="test-core" depends="build">
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-test-core" />
</exec>
</target>
<target name="test-dotnet" depends="build">
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-test-dotnet" />
</exec>
</target>
<target name="test-sourcecontrol" depends="build">
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-test-sourcecontrol" />
</exec>
</target>
<target name="test-visualcpp" depends="build">
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-test-visualcpp" />
</exec>
</target>
<target name="test-compression" depends="build">
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-test-compression" />
</exec>
</target>
<target name="prepare-self-test" depends="init">
<copy file="${path::combine(nant::get-base-directory(), 'NAnt.exe.config')}" tofile="${path::combine(nant::get-base-directory(), 'nant.tests.config')}" />
<!-- make sure the config file is writable -->
<attrib file="${path::combine(nant::get-base-directory(), 'nant.tests.config')}" readonly="false" />
<!-- ensure the tests target the current framework -->
<xmlpoke file="${path::combine(nant::get-base-directory(), 'nant.tests.config')}"
xpath="//configuration/nant/frameworks/platform[@name='${platform::get-name()}']/@default"
value="${framework::get-target-framework()}"/>
<!-- output the config file that will be used to run the tests -->
<echo message="testing with config '${path::combine(nant::get-base-directory(), 'nant.tests.config')}'" />
</target>
<target name="self-test-core" depends="prepare-self-test">
<nant target="test">
<buildfiles basedir="tests">
<include name="NAnt.Core/NAnt.Core.build" />
</buildfiles>
</nant>
</target>
<target name="self-test-dotnet" depends="prepare-self-test">
<nant target="test">
<buildfiles basedir="tests">
<include name="NAnt.DotNet/NAnt.DotNet.build" />
</buildfiles>
</nant>
</target>
<target name="self-test-sourcecontrol" depends="prepare-self-test">
<nant target="test">
<buildfiles basedir="tests">
<include name="NAnt.SourceControl/NAnt.SourceControl.build" />
</buildfiles>
</nant>
</target>
<target name="self-test-visualcpp" depends="prepare-self-test">
<nant target="test">
<buildfiles basedir="tests">
<include name="NAnt.VisualCpp/NAnt.VisualCpp.build" />
</buildfiles>
</nant>
</target>
<target name="self-test-compression" depends="prepare-self-test">
<nant target="test">
<buildfiles basedir="tests">
<include name="NAnt.Compression/NAnt.Compression.build" />
</buildfiles>
</nant>
</target>
<target name="self-test" depends="prepare-self-test, test-examples">
<!-- test NAnt.Console assembly -->
<nant buildfile="tests/NAnt.Console/NAnt.Console.build" target="test" />
<!-- test NAnt.Core assembly -->
<nant buildfile="tests/NAnt.Core/NAnt.Core.build" target="test" />
<!-- test extension assemblies -->
<nant target="test">
<buildfiles refid="ext.core.tests" />
</nant>
</target>
<target name="test-examples" depends="init" unless="${framework::get-family(framework::get-target-framework()) == 'mono'}">
<echo message="Examples: Copy local and build."/>
<copy todir="${build.dir}">
<fileset>
<include name="examples/**" />
</fileset>
</copy>
<nant target="build clean">
<buildfiles basedir="${build.dir}/examples">
<include name="examples.build" />
</buildfiles>
</nant>
</target>
<!-- generate user documentation -->
<target name="userdoc" depends="build" description="Builds user documentation">
<echo message="Creating task and type documentation from ${build.dir}/bin" />
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-indent:1" />
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-userdoc" />
</exec>
</target>
<target name="self-userdoc" depends="init">
<!-- use ndoc and NAnt.Documenter to build user doc if they need it -->
<uptodate property="help.uptodate">
<targetfiles>
<include name="${build.dir}/doc/help/*.html" />
</targetfiles>
<sourcefiles basedir="${build.dir}/bin">
<!-- make sure the tasks/types are not new -->
<include name="NAnt.Core.dll" />
<include name="*Tasks.dll" />
<include name="NAnt.NUnit.dll" />
<!-- make sure the documenter is not new -->
<include name="NDoc.Documenter.*.dll" />
</sourcefiles>
</uptodate>
<if test="${not(help.uptodate)}">
<ndoc>
<assemblies basedir="${build.dir}/bin">
<include name="NAnt.Core.dll" />
<include name="*Tasks.dll" />
<include name="NAnt.NUnit.dll" />
<!-- never document NAntContrib as part of NAnt -->
<exclude name="NAnt.Contrib.Tasks.dll" />
</assemblies>
<documenters>
<documenter name="NAnt">
<property name="OutputDirectory" value="${build.dir}/doc/help" />
<property name="SdkDocVersion" value="${link.sdkdoc.version}" />
<property name="SdkLinksOnWeb" value="${link.sdkdoc.web}" />
<!-- set base uri used for linking to other NAnt docs -->
<property name="NAntBaseUri" value="../" />
<!-- do not filter on namespace -->
<property name="NamespaceFilter" value="" />
<!-- set the name and version of the product for which docs are generated -->
<property name="ProductName" value="NAnt" />
<property name="ProductVersion" value="${project.version.full}" />
<property name="ProductUrl" value="http://nant.sourceforge.net" />
<property name="Preliminary" value="${not(project.release.type == 'release')}" />
<property name="DocumentAttributes" value="True" />
<property name="IncludeAssemblyVersion" value="True" />
<property name="ShowMissingParams" value="True" />
<property name="ShowMissingReturns" value="True" />
<property name="ShowMissingValues" value="True" />
</documenter>
</documenters>
</ndoc>
</if>
<!-- copy doc files from source-->
<copy todir="${build.dir}">
<fileset>
<include name="doc/**" />
<exclude name="**/obj/**" />
<exclude name="**/bin/**" />
</fileset>
</copy>
<echo message="User documentation: file://${build.dir}/doc/index.html" />
</target>
<target name="sdkdoc" depends="build" description="Builds SDK documentation">
<echo message="Creating SDK Documentation for ${build.dir}/bin/${nant.console.name}.exe" />
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-indent:1" />
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-sdkdoc" />
</exec>
</target>
<target name="self-sdkdoc" depends="init">
<!-- use ndoc to build sdk doc if they are not uptodate-->
<uptodate property="sdk.uptodate">
<targetfiles>
<include name="${build.dir}/doc/sdk/*.chm" />
</targetfiles>
<sourcefiles basedir="${build.dir}/bin">
<include name="NAnt.Core.dll" />
<include name="*Tasks.dll" />
<include name="NAnt.NUnit.dll" />
<!-- make sure the documenter is not new -->
<include name="NDoc.Documenter.*.dll" />
</sourcefiles>
</uptodate>
<if test="${not(sdk.uptodate)}">
<ndoc>
<assemblies basedir="${build.dir}/bin">
<include name="NAnt.Core.dll" />
<include name="NAnt.*Tasks.dll" />
<include name="NAnt.NUnit.dll" />
</assemblies>
<documenters>
<documenter name="MSDN">
<property name="OutputDirectory" value="${build.dir}/doc/sdk" />
<property name="OutputTarget" value="HtmlHelpAndWeb" />
<property name="SdkDocVersion" value="${link.sdkdoc.version}" />
<property name="SdkLinksOnWeb" value="${link.sdkdoc.web}" />
<property name="HtmlHelpName" value="NAnt-SDK" />
<property name="IncludeFavorites" value="False" />
<property name="Title" value="NAnt SDK Documentation - v${project.version.full}" />
<property name="SplitTOCs" value="False" />
<property name="DefaulTOC" value="" />
<property name="ShowVisualBasic" value="True" />
<property name="Preliminary" value="${not(project.release.type == 'release')}" />
<property name="ShowMissingSummaries" value="${build.debug}" />
<property name="ShowMissingRemarks" value="${build.debug}" />
<property name="ShowMissingParams" value="${build.debug}" />
<property name="ShowMissingReturns" value="${build.debug}" />
<property name="ShowMissingValues" value="${build.debug}" />
<property name="DocumentAttributes" value="True" />
<property name="ShowTypeIdInAttributes" value="False" />
<property name="DocumentInternals" value="False" />
<property name="DocumentPrivates" value="False" />
<property name="DocumentProtected" value="True" />
<property name="DocumentEmptyNamespaces" value="False" />
<property name="IncludeAssemblyVersion" value="False" />
<property name="CopyrightText" value="Copyright (C) 2001-${datetime::get-year(datetime::now())} Gerry Shaw" />
<property name="CopyrightHref" value="http://nant.sourceforge.net" />
<property name="EditorBrowsableFilter" value="Off" />
</documenter>
</documenters>
</ndoc>
</if>
<!-- delete all intermediate build output -->
<delete>
<fileset basedir="${build.dir}/doc/sdk">
<include name="NAnt-SDK.hhc" />
<include name="NAnt-SDK.hhk" />
<include name="NAnt-SDK.hhp" />
<include name="NAnt-SDK.log" />
<!-- temporary directory -->
<include name="ndoc_msdn_temp" />
</fileset>
</delete>
</target>
<target name="self-schema" depends="init">
<property name="schema.output" value="${build.dir}/schema/${project.name}.xsd" />
<!-- ensure schema directory exists -->
<mkdir dir="${build.dir}/schema" />
<!-- determine target namespace -->
<if test="${project.release.type == 'nightly'}">
<property name="schema.ns" value="http://nant.sf.net/${project.release.type + '/' + build.date + '-' + project.version + '/nant.xsd'}" />
</if>
<if test="${project.release.type != 'nightly'}">
<property name="schema.ns" value="http://nant.sf.net/release/${project.version.full}/nant.xsd" />
</if>
<!-- generate schema -->
<nantschema output="${schema.output}" target-ns="${schema.ns}" />
</target>
<target name="schema" depends="build">
<exec program="${build.dir}/bin/${nant.console.name}.exe" managed="true">
<arg value="-buildfile:NAnt.build" />
<arg value="-D:project.version=${project.version}" />
<arg value="-D:project.release.type=${project.release.type}" />
<arg value="-targetframework:${framework::get-target-framework()}" />
<arg value="${project.config}" />
<arg value="self-schema" />
</exec>
</target>
<target name="changelog" depends="init">
<property name="start.date" value="2003/12/26"/>
<property name="now" value="${datetime::now()}"/>
<property name="end.date" value="${datetime::get-year(now)}/${datetime::get-month(now)}/${datetime::get-day(now)}"/>
<property name="changes.name-without-extension" value="changelog_${string::replace(start.date, '/', '-')}_to_${string::replace(end.date, '/', '-')}"/>
<cvs-changelog
start="${start.date}"
end="${end.date}"
xmlfile="${build.dir}/${changes.name-without-extension}.xml"
destination="${project::get-base-directory()}"
module="nant"
/>
<style
style="etc/changelog.xsl"
in="${build.dir}/${changes.name-without-extension}.xml"
out="${build.dir}/${changes.name-without-extension}.html"
>
<parameters>
<parameter name="module" value="nant" />
<parameter name="title" value="NAnt Changelog (${project.version.full})" />
<parameter name="logo" value="doc/logo.gif" />
<parameter name="cvsweb" value="http://cvs.sourceforge.net/viewcvs.py/nant/" />
<parameter name="start-date" value="${start.date}" />
<parameter name="end-date" value="${end.date}" />
</parameters>
</style>
<delete file="${build.dir}/${changes.name-without-extension}.xml" />
</target>
<target name="deploy-schema" depends="schema" description="Deploys the Schema to VS.Net schemas dirs. For now it only copies to 7.0 and 7.1">
<!-- retrieve location of VS.NET 2002 schema store -->
<readregistry property="vs2002.xml.schemas" key="SOFTWARE\Microsoft\VisualStudio\7.0\InstallDir" hive="LocalMachine" failonerror="false" />
<if test="${property::exists('vs2002.xml.schemas')}">
<!-- deploy schema to VS.NET 2002 schema store -->
<copy file="${schema.output}" todir="${vs2002.xml.schemas}..\\Packages\schemas\xml" />
</if>
<!-- retrieve location of VS.NET 2003 schema store -->
<readregistry property="vs2003.xml.schemas" key="SOFTWARE\Microsoft\VisualStudio\7.1\InstallDir" hive="LocalMachine" failonerror="false" />
<if test="${property::exists('vs2003.xml.schemas')}">
<!-- deploy schema to VS.NET 2002 schema store -->
<copy file="${schema.output}" todir="${vs2003.xml.schemas}..\\Packages\schemas\xml" />
</if>
</target>
<target name="package-common" depends="test, userdoc, sdkdoc, schema">
<!-- move config file -->
<move file="${build.dir}/bin/NAnt.exe.config" tofile="${build.dir}/bin/${nant.console.name}.exe.config" />
<!-- remove non-release files -->
<delete>
<fileset basedir="${build.dir}/bin">
<include name="NAnt.Console.*" />
<!-- remove test assemblies -->
<include name="*.Tests.*" />
</fileset>
</delete>
<!-- copy project files -->
<copy todir="${build.dir}">
<fileset>
<include name="*" />
<include name="doc/**" />
<include name="src/**" />
<include name="tests/**" />
<include name="examples/**" />
<include name="schema/**" />
<include name="etc/nant.pc.in" />
<!-- third party assemblies -->
<include name="lib/**" />
<!-- website -->
<include name="web/**" />
<!-- docs -->
<include name="doc/**" />
<!-- exclude static html pages as these will be filter-copied -->
<exclude name="doc/**/*.html" />
<!-- exclude nighlty build file -->
<exclude name="nightly.xml" />
<!-- exclude release build file -->
<exclude name="release.xml" />
<!--exclude VS.Net stuff -->
<exclude name="**/*.suo" />
<exclude name="**/*j.user" />
<exclude name="**/bin/**" />
<exclude name="**/obj/**" />
</fileset>
</copy>
<!-- filter-copy static html pages -->
<copy todir="${build.dir}" overwrite="true">
<fileset>
<include name="doc/**/*.html" />
</fileset>
<filterchain>
<replacetokens>
<token key="PRODUCT_VERSION" value="${project.version.full}" />
</replacetokens>
<!-- when NOT building a release package, add prelimary notice -->
<replacestring
from="<!-- @PRELIMINARY_NOTICE@ -->"
to="<p class="topicstatus">[This is preliminary documentation and subject to change.]</p>"
unless="${project.release.type == 'release'}"
/>
<!-- when building a release package, remove the placeholder -->
<replacestring
from="<!-- @PRELIMINARY_NOTICE@ -->"
to=""
if="${project.release.type == 'release'}"
/>
</filterchain>
</copy>
<!-- determine the zip file prefix directory -->
<property name="project.zip.prefix" value="${project.name}-${project.version.full}" />
</target>
<!-- creates tar for distributing the user manual and SDK to SourceForge -->
<target name="package-doc" depends="package-common">
<!-- determine name of temporary doc distribution -->
<property name="project.gzip-path.doc" value="${project::get-base-directory()}/build/${project.name}-${project.version.full}-doc.tar.gz" />
<!-- remove package gzip file if it already exists -->
<delete file="${project.gzip-path.doc}" if="${file::exists(project.gzip-path.doc)}" />
<!-- create package gzip file -->
<tar destfile="${project.gzip-path.doc}" compression="GZip">
<fileset basedir="${build.dir}/doc">
<include name="help/**/*" />
</fileset>
</tar>
<echo message="Created '${project.config}' doc package at file://${project::get-base-directory()}/build/" />
</target>
<target name="package-src" depends="package-common">
<!-- determine name of source zip distribution -->
<property name="project.zip-path.src" value="${project::get-base-directory()}/build/${project.name}-${project.version.full}-src.zip" />
<!-- remove package zip file if it already exists -->
<delete file="${project.zip-path.src}" if="${file::exists(project.zip-path.src)}" />
<!-- create package zip file -->
<zip zipfile="${project.zip-path.src}" ziplevel="9">
<fileset basedir="${build.dir}" prefix="${project.zip.prefix}">
<include name="Makefile" />
<include name="Makefile.nmake" />
<include name="NAnt.build" />
<include name="NAnt.sln" />
<include name="COPYING.txt" />
<include name="README.txt" />
<include name="etc/nant.pc.in" />
<!-- third party assemblies -->
<include name="lib/**/*" />
<!-- license & release notes -->
<include name="doc/*" />
<!-- user manual (no SDK) -->
<include name="doc/help/**" />
<!-- examples -->
<include name="examples/**/*" />
<!-- sources -->
<include name="src/**/*" />
<!-- unit tests -->
<include name="tests/**/*" />
</fileset>
</zip>
<!-- determine name of source gzipped tar distribution -->
<property name="project.gzip-path.src" value="${project::get-base-directory()}/build/${project.name}-${project.version.full}-src.tar.gz" />
<!-- remove package gzip file if it already exists -->
<delete file="${project.gzip-path.src}" if="${file::exists(project.gzip-path.src)}" />
<!-- create package gzip file -->
<tar destfile="${project.gzip-path.src}" compression="GZip">
<fileset basedir="${build.dir}" prefix="${project.zip.prefix}">
<include name="Makefile" />
<include name="Makefile.nmake" />
<include name="NAnt.build" />
<include name="NAnt.sln" />
<include name="COPYING.txt" />
<include name="README.txt" />
<include name="etc/nant.pc.in" />
<!-- third party assemblies -->
<include name="lib/**/*" />
<!-- license & release notes -->
<include name="doc/*" />
<!-- user manual (no SDK) -->
<include name="doc/help/**" />
<!-- examples -->
<include name="examples/**/*" />
<!-- sources -->
<include name="src/**/*" />
<!-- unit tests -->
<include name="tests/**/*" />
</fileset>
</tar>
<echo message="Created '${project.config}' source packages at file://${project::get-base-directory()}/build/" />
</target>
<target name="package-bin" depends="package-common">
<!-- determine name of binary zip distribution -->
<property name="project.zip-path.bin" value="${project::get-base-directory()}/build/${project.name}-${project.version.full}-bin.zip" />
<!-- remove package zip file if it already exists -->
<delete file="${project.zip-path.bin}" if="${file::exists(project.zip-path.bin)}" />
<!-- create package zip file -->
<zip zipfile="${project.zip-path.bin}" ziplevel="9">
<fileset basedir="${build.dir}" prefix="${project.zip.prefix}">
<include name="COPYING.txt" />
<include name="README.txt" />
<include name="bin/**/*" />
<!-- license & release notes -->
<include name="doc/*" />
<!-- user manual -->
<include name="doc/help/**" />
<!-- SDK (in HTML Help format) -->
<include name="doc/sdk/NAnt-SDK.chm" />
<!-- examples -->
<include name="examples/**/*" />
<!-- XML Schema -->
<include name="schema/**/*" />
</fileset>
</zip>
<!-- determine name of binary gzipped tar distribution -->
<property name="project.gzip-path.bin" value="${project::get-base-directory()}/build/${project.name}-${project.version.full}-bin.tar.gz" />
<!-- remove package gzip file if it already exists -->
<delete file="${project.gzip-path.bin}" if="${file::exists(project.gzip-path.bin)}" />
<!-- create package gzip file -->
<tar destfile="${project.gzip-path.bin}" compression="GZip">
<fileset basedir="${build.dir}" prefix="${project.zip.prefix}">
<include name="COPYING.txt" />
<include name="README.txt" />
<include name="bin/**/*" />
<!-- license & release notes -->
<include name="doc/*" />
<!-- user manual -->
<include name="doc/help/**" />
<!-- SDK (in plain HTML format) -->
<include name="doc/sdk/*" />
<exclude name="doc/sdk/NAnt-SDK.chm" />
<!-- examples -->
<include name="examples/**/*" />
<!-- XML Schema -->
<include name="schema/**/*" />
</fileset>
</tar>
<echo message="Created '${project.config}' binary packages at file://${project.zip-path.bin}" />
</target>
<target name="package" depends="package-doc, package-src, package-bin" description="Creates a binary and source distribution package." />
<!-- Copies files to the bin folder. -->
<target name="UpdateBin" depends="build" description="Does a release build and copies them to the bin folder.">
<delete if="false">
<fileset basedir="bin">
<include name="NAnt*" />
<exclude name="${nant.console.name}.exe" />
</fileset>
</delete>
<copy todir="bin" overwrite="true">
<fileset basedir="${build.dir}/bin/">
<include name="NAnt*" />
<exclude name="*Test*" />
<exclude name="${nant.console.name}.xml" />
<exclude name="${nant.console.name}.exe" />
</fileset>
</copy>
</target>
<!-- Framework support targets -->
<target name="set-framework-configuration">
<if test="${not(target::exists('set-'+framework::get-target-framework()+'-framework-configuration'))}">
<fail message="The '${framework::get-target-framework()}' framework is not supported by this version of NAnt." />
</if>
<call target="set-${framework::get-target-framework()}-framework-configuration" />
</target>
<target name="set-net-2.0-framework-configuration">
<property name="nant.settings.currentframework" value="net-2.0" />
<property name="current.build.defines" value="${build.defines}NET,NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" dynamic="true" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="link.sdkdoc.web" value="true" />
</target>
<target name="set-net-3.5-framework-configuration">
<property name="nant.settings.currentframework" value="net-3.5" />
<property name="current.build.defines" value="${build.defines}NET,NET_1_0,NET_1_1,NET_2_0,NET_3_5,ONLY_3_5" dynamic="true" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="link.sdkdoc.web" value="true" />
</target>
<target name="set-net-4.0-framework-configuration">
<property name="nant.settings.currentframework" value="net-4.0" />
<property name="current.build.defines" value="${build.defines}NET,NET_1_0,NET_1_1,NET_2_0,NET_3_5,NET_4_0,ONLY_4_0" dynamic="true" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="link.sdkdoc.web" value="true" />
</target>
<target name="set-mono-2.0-framework-configuration">
<property name="nant.settings.currentframework" value="mono-2.0" />
<property name="current.build.defines" value="${build.defines}MONO,NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" dynamic="true" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="link.sdkdoc.web" value="true" />
</target>
<target name="set-mono-3.5-framework-configuration">
<property name="nant.settings.currentframework" value="mono-3.5" />
<property name="current.build.defines" value="${build.defines}MONO,NET_1_0,NET_1_1,NET_2_0,NET_3_5,ONLY_3_5" dynamic="true" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="link.sdkdoc.web" value="true" />
</target>
<target name="set-mono-4.0-framework-configuration">
<property name="nant.settings.currentframework" value="mono-4.0" />
<property name="current.build.defines" value="${build.defines}MONO,NET_1_0,NET_1_1,NET_2_0,NET_3_5,NET_4_0,ONLY_4_0" dynamic="true" />
<property name="link.sdkdoc.version" value="SDK_v1_1" />
<property name="link.sdkdoc.web" value="true" />
</target>
<!-- install targets -->
<target name="install" depends="install-windows, install-linux" />
<target name="install-windows" depends="build" if="${platform::is-windows()}">
<!-- Make sure that the docs are only built/installed when needed -->
<call target="userdoc" cascade="false" />
<!-- install to program files directory by default -->
<property name="install.prefix" value="${environment::get-folder-path('ProgramFiles')}" />
<if test="${property::exists('prefix') and string::get-length(prefix) != 0}">
<property name="install.prefix" value="${prefix}" />
</if>
<property name="install.nant" value="${path::combine(install.prefix, 'NAnt')}" />
<!-- support staged installs -->
<property name="install.destdir" value="" />
<if test="${property::exists('destdir') and string::get-length(destdir) != 0}">
<property name="install.destdir" value="${destdir}" />
</if>
<property name="install.copylocation" value="${install.destdir + install.nant}" />
<!-- perform (staged) install -->
<echo message="Installing NAnt to '${install.copylocation}' ..." />
<copy todir="${install.copylocation}" overwrite="true">
<fileset basedir="${build.dir}">
<include name="bin/**/*" />
<include name="doc/**/*" />
<exclude name="bin/nant.tests.config" />
<exclude name="bin/*.Tests.*" />
</fileset>
</copy>
</target>
<target name="install-linux" depends="build" if="${platform::is-unix()}">
<property name="install.prefix" value="/usr/local" />
<if test="${property::exists('prefix') and string::get-length(prefix) != 0}">
<property name="install.prefix" value="${prefix}" />
</if>
<property name="install.share" value="${path::combine(install.prefix, 'share')}" />
<property name="install.nant" value="${path::combine (install.share, 'NAnt')}" />
<!-- support staged installs -->
<property name="install.destdir" value="" />
<if test="${property::exists('destdir') and string::get-length(destdir) != 0}">
<property name="install.destdir" value="${destdir}" />
</if>
<property name="install.docdir" value="${install.destdir + path::combine(path::combine(install.share, 'doc'), 'NAnt')}" />
<if test="${property::exists('doc.prefix') and string::get-length(doc.prefix) != 0}">
<property name="install.docdir" value="${install.destdir + path::combine(doc.prefix, 'NAnt')}" />
</if>
<property name="install.bindir" value="${install.destdir + path::combine(install.prefix, 'bin')}" />
<property name="install.pkgconfigdir" value="${install.destdir + path::combine(install.prefix, 'lib/pkgconfig')}" />
<property name="install.copylocation" value="${install.destdir + install.nant}" />
<!-- perform (staged) install -->
<echo message="Installing NAnt to '${install.copylocation}' ..." />
<copy todir="${install.copylocation}" overwrite="true">
<fileset basedir="${build.dir}">
<include name="bin/**/*" />
<exclude name="bin/nant.tests.config" />
<exclude name="bin/*.Tests.*" />
</fileset>
</copy>
<echo message="Installing NAnt Docs to '${install.docdir}' ..." />
<mkdir dir="${install.docdir}" />
<copy todir="${install.docdir}" overwrite="true">
<fileset basedir="./doc">
<include name="**/*" />
</fileset>
</copy>
<mkdir dir="${install.pkgconfigdir}" />
<copy file="etc/nant.pc.in" tofile="${install.pkgconfigdir}/nant.pc">
<filterchain>
<replacetokens>
<token key="VERSION" value="${project.version}" />
</replacetokens>
</filterchain>
</copy>
<!-- create wrapper script -->
<echo message="Installing NAnt wrapper script to '${install.bindir}' ..." />
<property name="wrapper" value="${path::combine(install.bindir, 'nant')}" />
<!--
create wrapper file using separate echo tasks for each line to ensure
the line endings of the generated file match the platform on which
the wrapper is created
-->
<echo file="${wrapper}" append="false">#!/bin/sh${environment::newline()}</echo>
<echo file="${wrapper}" append="true">exec ${path::combine(install.prefix, 'bin')}/mono ${path::combine(install.nant, 'bin')}/NAnt.exe "$@"</echo>
<exec program="chmod" commandline="a+x ${path::combine(install.bindir, 'nant')}" />
</target>
</project>