-
Notifications
You must be signed in to change notification settings - Fork 432
/
build.xml
2221 lines (2002 loc) · 85.4 KB
/
build.xml
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
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="apache-ant" default="main" basedir=".">
<!-- Give user a chance to override without editing this file
(and without typing -D on each invocation) -->
<property file=".ant.properties"/>
<property file="${user.home}/.ant.properties"/>
<property environment="env"/>
<!--
===================================================================
Set the properties that control names and versions
===================================================================
-->
<property name="Name" value="Apache Ant"/>
<property name="name" value="ant"/>
<!-- this is the directory corresponding to groupId of Ant in the Maven repository -->
<property name="groupid" value="org/apache/ant"/>
<property name="project.version" value="1.10.16alpha"/>
<!-- pom.version is used when doing a distribution and must match with what is checked in under src/etc/poms -->
<property name="pom.version" value="1.10.16-SNAPSHOT"/>
<property name="manifest-version" value="1.10.16"/>
<property name="bootstrap.jar" value="ant-bootstrap.jar"/>
<property name="ant.package" value="org/apache/tools/ant"/>
<property name="taskdefs.package" value="${ant.package}/taskdefs"/>
<property name="condition.package" value="${taskdefs.package}/condition"/>
<property name="modules.package" value="${taskdefs.package}/modules"/>
<property name="optional.package" value="${taskdefs.package}/optional"/>
<property name="type.package" value="${ant.package}/types"/>
<property name="optional.type.package" value="${type.package}/optional"/>
<property name="apache.resolver.type.package" value="${type.package}/resolver"/>
<property name="util.package" value="${ant.package}/util"/>
<property name="regexp.package" value="${util.package}/regexp"/>
<property name="optional.jars.prefix" value="ant"/>
<property name="optional.jars.whenmanifestonly" value="skip"/>
<!--
===================================================================
Set the properties related to the source tree
===================================================================
-->
<property name="src.dir" value="src"/>
<property name="java.dir" value="${src.dir}/main"/>
<property name="script.dir" value="${src.dir}/script"/>
<property name="resource.dir" value="${src.dir}/resources"/>
<property name="src.junit" value="${src.dir}/tests/junit"/>
<property name="src.antunit" value="${src.dir}/tests/antunit"/>
<property name="etc.dir" value="${src.dir}/etc"/>
<property name="tests.etc.dir" value="${etc.dir}/testcases"/>
<property name="lib.dir" value="lib"/>
<property name="manual.dir" value="manual"/>
<!--
===================================================================
Set the properties for the build area
===================================================================
-->
<property name="build.dir" value="build"/>
<property name="bootstrap.dir" location="bootstrap"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.lib" value="${build.dir}/lib"/>
<property name="build.lib-src" value="${build.dir}/lib-src"/>
<property name="build.javadocs" value="${build.dir}/javadocs"/>
<property name="build.tests" value="${build.dir}/testcases"/>
<property name="build.tests.javadocs" value="${build.dir}/javadocs.test/"/>
<property name="build.junit.xml" location="${build.tests}/xml"/>
<property name="build.junit.tmpdir" location="${build.tests}/tmp"/>
<property name="build.junit.reports" location="${build.tests}/reports"/>
<property name="build.pkg.dir" value="${build.dir}/pkg"/>
<property name="antunit.xml" location="${build.dir}/antunit/xml"/>
<property name="antunit.tmpdir" location="${build.dir}/antunit/tmp"/>
<property name="antunit.reports" location="${build.dir}/antunit/reports"/>
<property name="antunit.loglevel" value="none"/>
<!-- the absolute path -->
<property name="build.classes.value" location="${build.classes}"/>
<property name="build.tests.value" location="${build.tests}"/>
<!--
===================================================================
Set the properties that control various build options
===================================================================
-->
<property name="debug" value="true"/>
<property name="setpermissions.fail" value="true"/>
<property name="setpermissions.nonposixmode" value="tryDosOrPass"/>
<property name="deprecation" value="false"/>
<property name="optimize" value="true"/>
<property name="javac.target" value="1.8"/>
<property name="javac.source" value="1.8"/>
<property name="javac.release" value="8"/>
<property name="junit.filtertrace" value="off"/>
<property name="junit.summary" value="no"/>
<property name="test.haltonfailure" value="false"/>
<property name="junit.fork" value="true"/>
<property name="junit.forkmode" value="once"/>
<condition property="junit.threads" value="2" else="0">
<and>
<equals arg1="${junit.fork}" arg2="true"/>
<equals arg1="${junit.forkmode}" arg2="perTest"/>
</and>
</condition>
<property name="expandproperty.files"
value="**/version.txt,**/defaultManifest.mf"/>
<property name="junit.collector.dir" value="${build.dir}/failingTests"/>
<property name="junit.collector.class" value="FailedTests"/>
<!--
===================================================================
Set the paths used in the build
===================================================================
-->
<path id="classpath">
<fileset dir="lib/optional" includes="*.jar"/>
</path>
<path id="tests-classpath">
<pathelement location="${build.classes}"/>
<path refid="classpath"/>
</path>
<path id="tests-runtime-classpath">
<path refid="tests-classpath"/>
<pathelement location="${build.tests}"/>
<!--
include the test source and test data dirs
so that we can pick resources via getResource(AsStream)
-->
<pathelement location="${src.junit}"/>
<pathelement location="${tests.etc.dir}"/>
<!-- Otherwise many tests fail with "com.sun.tools.javac.Main is not on the classpath.": -->
<pathelement location="${java.home}/../lib/tools.jar"/>
</path>
<!--
===================================================================
Set up properties for the distribution area
===================================================================
-->
<property name="dist.name" value="apache-${name}-${project.version}"/>
<property name="dist.base" value="distribution"/>
<property name="dist.base.source" value="${dist.base}/source"/>
<property name="dist.base.binaries" value="${dist.base}/binaries"/>
<property name="dist.base.manual" value="${dist.base}/manual"/>
<property name="dist.dir" location="dist"/>
<property name="dist.bin" value="${dist.dir}/bin"/>
<property name="dist.lib" value="${dist.dir}/lib"/>
<property name="dist.manual" value="${dist.dir}/manual"/>
<property name="dist.etc" value="${dist.dir}/etc"/>
<property name="dist.javadocs" value="${dist.dir}/manual/api"/>
<property name="src.dist.dir" value="dist-src"/>
<property name="src.dist.src" value="${src.dist.dir}/src"/>
<property name="src.dist.manual" value="${src.dist.dir}/manual"/>
<property name="src.dist.lib" value="${src.dist.dir}/lib"/>
<property name="java-repository.dir" value="java-repository/${groupid}"/>
<!--
===================================================================
Set up selectors to be used by javac, junit and jar to exclude
files that have dependencies that are not available
===================================================================
-->
<selector id="needs.jdk9+">
<filename name="${modules.package}/"/>
</selector>
<!-- Kaffe has some JDK 1.5 features including java.lang.Readable,
but not all of them -->
<selector id="not.in.kaffe">
<or>
<filename name="${condition.package}/IsReachable*"/>
</or>
</selector>
<selector id="needs.apache-resolver">
<filename name="${apache.resolver.type.package}/"/>
</selector>
<selector id="needs.junit">
<and>
<filename name="${optional.package}/junit/"/>
<not>
<or>
<filename name="${optional.package}/junit/JUnit4TestMethodAdapter*"/>
<filename name="${optional.package}/junit/CustomJUnit4TestAdapterCache*"/>
</or>
</not>
</and>
</selector>
<selector id="needs.junit4">
<or>
<filename name="${optional.package}/junit/JUnit4TestMethodAdapter*"/>
<filename name="${optional.package}/junit/CustomJUnit4TestAdapterCache*"/>
</or>
</selector>
<selector id="needs.junitlauncher">
<or>
<filename name="${optional.package}/junitlauncher/"/>
<filename name="org/example/junitlauncher/Tracker.java"/>
</or>
</selector>
<selector id="needs.junit.engine.vintage">
<or>
<!-- we need JUnit vintage engine only in tests where we test the junitlauncher task -->
<filename name="${optional.package}/junitlauncher/**/JUnitLauncherTaskTest.java"/>
<filename name="org/example/junitlauncher/vintage/**/*"/>
</or>
</selector>
<selector id="needs.junit.engine.jupiter">
<or>
<!-- we need JUnit jupiter engine only in tests where we test the junitlauncher task -->
<filename name="${optional.package}/junitlauncher/**/JUnitLauncherTaskTest.java"/>
<filename name="${optional.package}/junitlauncher/OutputDirLocationTest.java"/>
<filename name="org/example/junitlauncher/jupiter/**/*"/>
</or>
</selector>
<selector id="needs.apache-regexp">
<filename name="${regexp.package}/JakartaRegexp*"/>
</selector>
<selector id="needs.apache-oro">
<or>
<filename name="${regexp.package}/JakartaOro*"/>
</or>
</selector>
<selector id="needs.apache-bcel">
<or>
<filename name="${ant.package}/filters/util/JavaClassHelper*"/>
<filename name="${util.package}/depend/bcel/"/>
<filename name="${optional.type.package}/depend/ClassFileSetTest*"/>
</or>
</selector>
<selector id="needs.apache-log4j">
<filename name="${ant.package}/listener/Log4jListener*"/>
</selector>
<selector id="needs.commons-logging">
<filename name="${ant.package}/listener/CommonsLoggingListener*"/>
</selector>
<selector id="needs.apache-bsf">
<or>
<filename name="${util.package}/ScriptRunner.*"/>
<filename name="${util.package}/optional/ScriptRunner*"/>
</or>
</selector>
<selector id="needs.javamail">
<or>
<filename name="${ant.package}/taskdefs/email/MimeMailer*"/>
</or>
</selector>
<selector id="needs.jakartamail">
<or>
<filename name="${ant.package}/taskdefs/email/JakartaMimeMailer*"/>
</or>
</selector>
<selector id="needs.netrexx">
<filename name="${optional.package}/NetRexxC*"/>
</selector>
<selector id="needs.commons-net">
<or>
<filename name="${optional.package}/net/FTP*"/>
<filename name="${optional.package}/net/RExec*"/>
<filename name="${optional.package}/net/TelnetTask*"/>
</or>
</selector>
<selector id="needs.antlr">
<filename name="${optional.package}/ANTLR*"/>
</selector>
<selector id="needs.imageio">
<or>
<filename name="${optional.package}/image/ImageIO*"/>
<filename name="${optional.type.package}/imageio/"/>
</or>
</selector>
<selector id="needs.jmf">
<filename name="${optional.package}/sound/"/>
</selector>
<selector id="needs.jai">
<or>
<filename name="${optional.package}/image/Image.*"/>
<filename name="${optional.package}/image/ImageTest.*"/>
<filename name="${optional.type.package}/image/"/>
</or>
</selector>
<selector id="needs.jdepend">
<filename name="${optional.package}/jdepend/"/>
</selector>
<selector id="needs.swing">
<filename name="${optional.package}/splash/"/>
</selector>
<selector id="needs.jsch">
<filename name="${optional.package}/ssh/"/>
</selector>
<!-- needs TraceListenerEx3 interface implemented by PrintTraceListener -->
<selector id="needs.apache-xalan2">
<filename name="${optional.package}/Xalan2TraceSupport*"/>
</selector>
<selector id="needs.xz">
<or>
<filename name="${optional.package}/xz/"/>
<filename name="${type.package}/optional/xz/"/>
</or>
</selector>
<selector id="needs.graaljs">
<filename name="${optional.package}/script/graal/*"/>
</selector>
<selector id="ant.launcher">
<filename name="${ant.package}/launch/"/>
</selector>
<selector id="ant.core">
<not>
<or>
<selector refid="needs.antlr"/>
<selector refid="needs.apache-bcel"/>
<selector refid="needs.apache-bsf"/>
<selector refid="needs.apache-log4j"/>
<selector refid="needs.apache-oro"/>
<selector refid="needs.apache-regexp"/>
<selector refid="needs.apache-resolver"/>
<selector refid="needs.apache-xalan2"/>
<selector refid="needs.commons-logging"/>
<selector refid="needs.commons-net"/>
<selector refid="needs.imageio"/>
<selector refid="needs.jai"/>
<selector refid="needs.javamail"/>
<selector refid="needs.jakartamail"/>
<selector refid="needs.jdepend"/>
<selector refid="needs.jmf"/>
<selector refid="needs.jsch"/>
<selector refid="needs.junit"/>
<selector refid="needs.junit4"/>
<selector refid="needs.junitlauncher"/>
<selector refid="needs.netrexx"/>
<selector refid="needs.swing"/>
<selector refid="needs.xz"/>
<selector refid="ant.launcher"/>
</or>
</not>
</selector>
<patternset id="onlinetests">
<exclude name="**/GetTest.java" if="offline"/>
<exclude name="**/HttpTest.java" if="offline"/>
</patternset>
<patternset id="teststhatfail">
<!-- Property 'run.failing.tests' should force Ant to run these tests. -->
<!-- Because the whole patternset can not be excluded, you have to add -->
<!-- an unless-attribute on each exclude-element. -->
<exclude unless="run.failing.tests" name="${optional.package}/BeanShellScriptTest.java"/>
<exclude unless="run.failing.tests" name="${optional.package}/jdepend/JDependTest.java"/>
</patternset>
<!-- tests that need an XML Schema-supporting parser to work -->
<selector id="needs.xmlschema">
<or>
<filename name="${optional.package}/SchemaValidateTest.*"/>
<filename name="${optional.package}/XmlValidateTest.*"/>
</or>
</selector>
<!--
===================================================================
Set up a patternsets that matches the parts of our JUnit testsuite
that may be useful for task developers.
===================================================================
-->
<patternset id="useful.tests">
<include name="${ant.package}/AntAssert*"/>
<include name="${ant.package}/BuildFileTest*"/>
<include name="${ant.package}/BuildFileRule*"/>
<include name="${ant.package}/FileUtilities*"/>
<include name="${ant.package}/MagicTestNames*"/>
<include name="${regexp.package}/RegexpMatcherTest*"/>
<include name="${regexp.package}/RegexpTest*"/>
<include name="${optional.package}/AbstractXSLTLiaisonTest*"/>
<include name="${ant.package}/types/AbstractFileSetTest*"/>
</patternset>
<!--
===================================================================
Check to see what optional dependencies are available
===================================================================
-->
<target name="check-optional-packages">
<condition property="ignoresystemclasses">
<not>
<equals arg1="${build.sysclasspath}" arg2="only"/>
</not>
</condition>
<property name="ignoresystemclasses" value="false"/>
<available property="jdk9+" classname="java.lang.module.ModuleDescriptor"/>
<condition property="jdk10+">
<javaversion atleast="10"/>
</condition>
<available property="kaffe" classname="kaffe.util.NotImplemented"/>
<available property="harmony"
classname="org.apache.harmony.luni.util.Base64"/>
<available property="bsf.present"
classname="org.apache.bsf.BSFManager"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="netrexx.present"
classname="netrexx.lang.Rexx"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="apache.resolver.present"
classname="org.apache.xml.resolver.tools.CatalogResolver"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="recent.xalan2.present"
classname="org.apache.xalan.trace.TraceListenerEx3"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="junit.present"
classname="junit.framework.TestCase"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="junit4.present"
classname="org.junit.Test"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="junitlauncher.present"
classname="org.junit.platform.launcher.Launcher"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="junit.engine.vintage.present"
classname="org.junit.vintage.engine.VintageTestEngine"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="junit.engine.jupiter.present"
classname="org.junit.jupiter.engine.JupiterTestEngine"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="antunit.present"
classname="org.apache.ant.antunit.AntUnit"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="commons.net.present"
classname="org.apache.commons.net.ftp.FTPClient"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="antlr.present"
classname="antlr.Tool"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="apache.regexp.present"
classname="org.apache.regexp.RE"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="apache.oro.present"
classname="org.apache.oro.text.regex.Perl5Matcher"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="imageio.present"
classname="javax.imageio.ImageIO"
classpathref="classpath"/>
<available property="jmf.present"
classname="javax.sound.sampled.Clip"
classpathref="classpath"/>
<available property="jai.present"
classname="javax.media.jai.JAI"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="jdepend.present"
classname="jdepend.framework.JDepend"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="log4j.present"
classname="org.apache.log4j.Logger"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="commons.logging.present"
classname="org.apache.commons.logging.LogFactory"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="xalan.envcheck"
classname="org.apache.xalan.xslt.EnvironmentCheck"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="which.present"
classname="org.apache.env.Which"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="xerces.present"
classname="org.apache.xerces.parsers.SAXParser"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="bcel.present"
classname="org.apache.bcel.Constants"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="javamail.present"
classname="javax.mail.Transport"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="jakartamail.present"
classname="jakarta.mail.Transport"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="graaljs.present"
classname="com.oracle.truffle.js.scriptengine.GraalJSScriptEngine"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<condition property="javaxmail.complete">
<and>
<available classname="javax.activation.DataHandler"/>
<available classname="javax.mail.Transport"/>
</and>
</condition>
<condition property="jakartamail.complete">
<and>
<available classname="jakarta.activation.DataHandler"/>
<available classname="jakarta.mail.Transport"/>
</and>
</condition>
<condition property="javamail.complete">
<or>
<isset property="javaxmail.complete"/>
<isset property="jakartamail.complete"/>
</or>
</condition>
<condition property="tests.and.ant.share.classloader">
<or>
<equals arg1="${junit.fork}" arg2="true"/>
<equals arg1="${build.sysclasspath}" arg2="only"/>
</or>
</condition>
<condition property="sun.tools.present">
<and>
<available classname="sun.tools.native2ascii.Main"/>
<available classname="com.sun.tools.javah.Main"/>
</and>
</condition>
<condition property="tests.are.on.system.classpath">
<or>
<resourcecount count="1">
<intersect>
<path path="${java.class.path}"/>
<file file="${build.tests}"/>
</intersect>
</resourcecount>
<istrue value="${junit.fork}"/>
</or>
</condition>
<echo level="verbose"> tests.are.on.system.classpath=${tests.are.on.system.classpath}</echo>
<condition property="jasper.present">
<and>
<available classname="org.apache.jasper.compiler.Compiler"/>
<available classname="org.apache.jasper.JasperException"/>
</and>
</condition>
<condition property="swing.present">
<or>
<not>
<isset property="kaffe"/>
</not>
<available classname="javax.swing.ImageIcon"
classpathref="classpath"/>
</or>
</condition>
<available property="rhino.present"
classname="org.mozilla.javascript.Scriptable"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="beanshell.present"
classname="bsh.StringUtil"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="xerces1.present"
classname="org.apache.xerces.framework.XMLParser"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="jsch.present"
classname="com.jcraft.jsch.Session"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="xz.present"
classname="org.tukaani.xz.XZOutputStream"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<property name="build.compiler" value="modern"/>
<!-- check for XSD support in the parser -->
<condition property="xmlschema.present">
<or>
<parsersupports feature="http://apache.org/xml/features/validation/schema"/>
<parsersupports feature="http://java.sun.com/xml/jaxp/properties/schemaSource"/>
</or>
</condition>
<!--
Java8 introduced a HTML checker 'doclint' which is very strict and breaks
the build if there is a HTML error in the JavaDoc.
-->
<condition
property="javadoc.doclint.none"
value="-Xdoclint:none"
else="">
<not><isset property="withDoclint"/></not>
</condition>
</target>
<!--
===================================================================
Prepare the build
===================================================================
-->
<target name="prepare" depends="check-optional-packages">
<tstamp>
<format property="year" pattern="yyyy"/>
</tstamp>
<filterchain id="ant.filters">
<expandproperties/>
</filterchain>
</target>
<!--
===================================================================
Build the code
===================================================================
-->
<target name="build" depends="prepare, compile, compile-jdk9+" unless="skip.build"
description="--> compiles the source code">
<!-- Builds and verifies that the classes belonging in the confined package of
junitlauncher task do not depend on classes they aren't meant to -->
<!-- first wipe out the "confined" package that might have been built already
due to the javac above -->
<delete dir="${build.classes}/${optional.package}/junitlauncher/confined/"/>
<javac srcdir="${java.dir}"
includeantruntime="false"
destdir="${build.classes}"
debug="${debug}"
deprecation="${deprecation}"
includes="${optional.package}/junitlauncher/confined/**"
target="${javac.target}"
source="${javac.source}"
release="${javac.release}"
optimize="${optimize}">
<compilerarg line="-proc:none"/>
<classpath>
<!-- A very limited classpath which only doesn't include optional libraries,
which the classes in confined package aren't meant to depend on -->
<fileset dir="${build.classes}">
<!-- exclude the org/apache/tools/ant/taskdefs/optional/junitlauncher package
from the classpath, since the confined package isn't meant to depend on
classes in this package -->
<exclude name="org/apache/tools/ant/taskdefs/optional/junitlauncher/*"/>
</fileset>
</classpath>
</javac>
<copy todir="${build.classes}">
<fileset dir="${java.dir}">
<include name="**/*.properties"/>
<include name="**/*.dtd"/>
<include name="**/*.xml"/>
</fileset>
<fileset dir="${resource.dir}"/>
</copy>
<copy todir="${build.classes}"
overwrite="true" encoding="UTF-8">
<fileset dir="${java.dir}">
<include name="**/version.txt"/>
<include name="**/defaultManifest.mf"/>
</fileset>
<filterchain refid="ant.filters"/>
</copy>
<copy todir="${build.classes}/${optional.package}/junit/xsl">
<fileset dir="${etc.dir}">
<include name="junit-frames.xsl"/>
<include name="junit-noframes.xsl"/>
<include name="junit-frames-saxon.xsl"/>
<include name="junit-noframes-saxon.xsl"/>
</fileset>
</copy>
</target>
<target name="compile" depends="prepare">
<mkdir dir="${build.classes}"/>
<javac srcdir="${java.dir}"
includeantruntime="false"
destdir="${build.classes}"
debug="${debug}"
deprecation="${deprecation}"
excludes="${optional.package}/junitlauncher/confined/**"
target="${javac.target}"
source="${javac.source}"
release="${javac.release}"
optimize="${optimize}">
<compilerarg line="-proc:none"/>
<classpath refid="classpath"/>
<selector id="conditional-patterns">
<not>
<or>
<selector refid="needs.jdk9+"/>
<selector refid="not.in.kaffe" if="kaffe"/>
<selector refid="needs.apache-resolver" unless="apache.resolver.present"/>
<selector refid="needs.junit" unless="junit.present"/> <!-- TODO should perhaps use -source 1.4? -->
<selector refid="needs.junit4" unless="junit4.present"/>
<selector refid="needs.junitlauncher" unless="junitlauncher.present"/>
<selector refid="needs.junit.engine.vintage" unless="junit.engine.vintage.present"/>
<selector refid="needs.junit.engine.jupiter" unless="junit.engine.jupiter.present"/>
<selector refid="needs.apache-regexp" unless="apache.regexp.present"/>
<selector refid="needs.apache-oro" unless="apache.oro.present"/>
<selector refid="needs.apache-bcel" unless="bcel.present"/>
<selector refid="needs.apache-log4j" unless="log4j.present"/>
<selector refid="needs.commons-logging" unless="commons.logging.present"/>
<selector refid="needs.apache-bsf" unless="bsf.present"/>
<selector refid="needs.javamail" unless="javamail.present"/>
<selector refid="needs.jakartamail" unless="jakartamail.present"/>
<selector refid="needs.netrexx" unless="netrexx.present"/>
<selector refid="needs.commons-net" unless="commons.net.present"/>
<selector refid="needs.antlr" unless="antlr.present"/>
<selector refid="needs.imageio" unless="imageio.present"/>
<selector refid="needs.jmf" unless="jmf.present"/>
<selector refid="needs.jai" unless="jai.present"/>
<selector refid="needs.jdepend" unless="jdepend.present"/>
<selector refid="needs.swing" unless="swing.present"/>
<selector refid="needs.jsch" unless="jsch.present"/>
<selector refid="needs.xz" unless="xz.present"/>
<selector refid="needs.xmlschema" unless="xmlschema.present"/>
<selector refid="needs.apache-xalan2" unless="recent.xalan2.present"/>
</or>
</not>
</selector>
</javac>
</target>
<target name="compile-jdk9+" depends="prepare" if="jdk9+">
<mkdir dir="${build.classes}"/>
<javac srcdir="${java.dir}"
includeantruntime="false"
destdir="${build.classes}"
debug="${debug}"
deprecation="${deprecation}"
target="${javac.target}"
source="${javac.source}"
optimize="${optimize}">
<compilerarg line="-proc:none"/>
<classpath refid="classpath"/>
<selector id="conditional-patterns-jdk9+">
<or>
<selector refid="needs.jdk9+"/>
</or>
</selector>
</javac>
</target>
<!--
===================================================================
Create the all of the Apache Ant jars
===================================================================
-->
<target name="jars" depends="build"
description="--> creates the Apache Ant jars">
<copy todir="${build.dir}">
<fileset dir="${basedir}">
<include name="LICENSE"/>
<include name="LICENSE.xerces"/>
<include name="LICENSE.dom"/>
<include name="LICENSE.sax"/>
<include name="NOTICE"/>
</fileset>
<mapper type="glob" from="*" to="*.txt"/>
</copy>
<jar destfile="${build.lib}/${name}-launcher.jar"
basedir="${build.classes}" index="true"
whenmanifestonly="fail">
<selector refid="ant.launcher"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
<manifest>
<attribute name="Main-Class" value="org.apache.tools.ant.launch.Launcher"/>
</manifest>
</jar>
<jar destfile="${build.lib}/${name}.jar"
basedir="${build.classes}" index="true"
whenmanifestonly="fail">
<!-- Verification: (cd dist/lib; for j in *.jar; do jar tf $j; done) | egrep -v '/$|META-INF/MANIFEST\.MF' | sort | uniq -d -->
<selector refid="ant.core"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
<manifest>
<attribute name="Main-Class" value="org.apache.tools.ant.Main"/>
<section name="${ant.package}/">
<attribute name="Extension-Name"
value="org.apache.tools.ant"/>
<attribute name="Specification-Title"
value="Apache Ant"/>
<attribute name="Specification-Version"
value="${manifest-version}"/>
<attribute name="Specification-Vendor"
value="Apache Software Foundation"/>
<attribute name="Implementation-Title"
value="org.apache.tools.ant"/>
<attribute name="Implementation-Version"
value="${manifest-version}"/>
<attribute name="Implementation-Vendor"
value="Apache Software Foundation"/>
</section>
</manifest>
<fileset dir="${manual.dir}">
<include name="images/ant_logo_large.gif"/>
</fileset>
</jar>
<jar destfile="${build.lib}/${bootstrap.jar}"
basedir="${build.classes}"
whenmanifestonly="fail">
<include name="${ant.package}/Main.class"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
<manifest>
<attribute name="Main-Class" value="org.apache.tools.ant.Main"/>
<attribute name="Class-Path" value="ant.jar xalan.jar"/>
</manifest>
</jar>
<macrodef name="optional-jar">
<attribute name="dep"/>
<sequential>
<jar destfile="${build.lib}/${optional.jars.prefix}-@{dep}.jar"
basedir="${build.classes}" index="true"
whenmanifestonly="${optional.jars.whenmanifestonly}">
<selector refid="needs.@{dep}"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
<manifest>
<section name="${optional.package}/">
<attribute name="Extension-Name"
value="org.apache.tools.ant"/>
<attribute name="Specification-Title"
value="Apache Ant"/>
<attribute name="Specification-Version"
value="${manifest-version}"/>
<attribute name="Specification-Vendor"
value="Apache Software Foundation"/>
<attribute name="Implementation-Title"
value="org.apache.tools.ant"/>
<attribute name="Implementation-Version"
value="${manifest-version}"/>
<attribute name="Implementation-Vendor"
value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</sequential>
</macrodef>
<optional-jar dep="apache-resolver"/>
<optional-jar dep="junit"/>
<optional-jar dep="junit4"/>
<optional-jar dep="junitlauncher"/>
<optional-jar dep="apache-regexp"/>
<optional-jar dep="apache-oro"/>
<optional-jar dep="apache-bcel"/>
<optional-jar dep="apache-log4j"/>
<optional-jar dep="commons-logging"/>
<optional-jar dep="apache-bsf"/>
<optional-jar dep="javamail"/>
<optional-jar dep="jakartamail"/>
<optional-jar dep="netrexx"/>
<optional-jar dep="commons-net"/>
<optional-jar dep="antlr"/>
<optional-jar dep="imageio"/>
<optional-jar dep="jmf"/>
<optional-jar dep="jai"/>
<optional-jar dep="swing"/>
<optional-jar dep="jsch"/>
<optional-jar dep="jdepend"/>
<optional-jar dep="apache-xalan2"/>
<optional-jar dep="xz"/>
</target>
<!-- Creates jar of test utility classes -->
<target name="test-jar" depends="compile-tests"
description="--> creates the Apache Ant Test Utilities jar">
<fail unless="junit.present">
We cannot build the test jar unless JUnit is present,
as JUnit is needed to compile the test classes.
</fail>
<jar destfile="${build.lib}/${name}-testutil.jar" index="true"
basedir="${build.tests}">
<patternset refid="useful.tests"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</target>
<!--
===================================================================
Create the all of the Apache Ant source jars
===================================================================
-->
<target name="jars-sources" description="--> creates the Apache Ant source jars">
<mkdir dir="${build.lib-src}"/>
<jar destfile="${build.lib-src}/${name}-launcher.jar"
basedir="${java.dir}"
whenmanifestonly="fail">
<selector refid="ant.launcher"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
<jar destfile="${build.lib-src}/${name}.jar"
basedir="${java.dir}"
whenmanifestonly="fail">
<selector refid="ant.core"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
<jar destfile="${build.lib-src}/${bootstrap.jar}"
basedir="${java.dir}"
whenmanifestonly="fail">
<include name="${ant.package}/Main.java"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
<macrodef name="optional-src-jar">
<attribute name="dep"/>
<sequential>
<jar destfile="${build.lib-src}/${optional.jars.prefix}-@{dep}.jar"
basedir="${java.dir}"
whenmanifestonly="${optional.jars.whenmanifestonly}">
<selector refid="needs.@{dep}"/>
<metainf dir="${build.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</sequential>
</macrodef>
<optional-src-jar dep="apache-resolver"/>
<optional-src-jar dep="junit"/>
<optional-src-jar dep="junit4"/>
<optional-src-jar dep="junitlauncher"/>
<optional-src-jar dep="apache-regexp"/>
<optional-src-jar dep="apache-oro"/>
<optional-src-jar dep="apache-bcel"/>
<optional-src-jar dep="apache-log4j"/>
<optional-src-jar dep="commons-logging"/>
<optional-src-jar dep="apache-bsf"/>
<optional-src-jar dep="javamail"/>
<optional-src-jar dep="jakartamail"/>