-
Notifications
You must be signed in to change notification settings - Fork 356
/
build.xml
1513 lines (1285 loc) · 63.5 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
<!--
This is an Ant build file for compiling the Checker Framework.
-->
<project name="checker" default="dist" basedir=".">
<description>
Builds the Checker Framework.
</description>
<property file="build.${os.name}.properties"/>
<property file="build.properties"/>
<property file="${basedir}/../build-common.properties"/>
<import file="../build-common.xml"/>
<!-- Setting this via the command line "-Drun.tests.should.fork=false"
causes the tests to crash. -->
<property name="run.tests.should.fork" value="true"/>
<property name="halt.on.test.failure" value="true"/>
<property name="javadoc.private" value="false"/>
<property environment="env"/>
<!--
NOTE LT_BIN IN THE NEXT FEW TARGETS IS SOLELY FOR bin-devel/javac and Jenkins.
The original path to the langtools dir does not work on Jenkins.
This is here so we get an empty value if it is not set
-->
<property name="LT_BIN" value=""/>
<!-- Used to have:
depends="touch-jdk"
When is that truly necessary? -->
<target name="prep" depends="prep-all"
description="Create required directories">
<mkdir dir="${build}"/>
<mkdir dir="${tests.build}"/>
<mkdir dir="${tests.build}/testclasses"/>
<mkdir dir="${api.doc}" />
<symlink link="${checkerframework}/docs/api" resource="../checker/${api.doc}" overwrite="true" failonerror="false"/>
<available property="framework.project"
file="${framework.loc}/build.xml"/>
<antcall target="-prep-framework-compile"/>
<!-- Ant's copy task does not retain file permissions,
so use <exec executable="cp"> instead.
<copy file="bin-devel/git.post-merge" tofile="../.git/hooks/post-merge" preservelastmodified="true" />
<copy file="bin-devel/git.pre-commit" tofile="../.git/hooks/pre-commit" preservelastmodified="true" />
-->
<exec executable="cp">
<arg value="-p"/>
<arg value="bin-devel/git.post-merge"/>
<arg value="../.git/hooks/post-merge"/>
</exec>
<exec executable="cp">
<arg value="-p"/>
<arg value="bin-devel/git.pre-commit"/>
<arg value="../.git/hooks/pre-commit"/>
</exec>
</target>
<target name="-prep-framework-compile" if="framework.project"
description="Compile framework project">
<ant dir="${framework.loc}">
<target name="dist"/>
</ant>
</target>
<target name="clean" description="Remove generated files"
depends="clean-nocleanjdk,clean-jdk">
</target>
<target name="clean-jdk" description="Remove generated jdkX.jar files">
<delete file="dist/jdk8.jar"/>
<delete file="dist/jdk9.jar"/>
<delete file="jdk/jdk8.jar"/>
<delete file="jdk/jdk9.jar"/>
</target>
<target name="clean-nocleanjdk" description="Remove generated files, but not the jdkX.jar files">
<ant dir="${framework.loc}">
<target name="clean"/>
</ant>
<delete dir="${build}"/>
<delete dir="${api.doc}"/>
<delete dir="${temp.dir}"/>
<delete file="${checker.lib}"/>
<delete file="${checker.qual.lib}"/>
<delete file="${checker.qual.sources.lib}"/>
<delete file="${checker.qual7.lib}"/>
<delete file="${checker.qual7.sources.lib}"/>
<delete file="${checker.compat.qual.lib}"/>
<delete file="${checker.compat.qual.sources.lib}"/>
<delete file="${checker.sources.lib}"/>
<delete file="${checker.javadoc.lib}"/>
<delete failonerror="false">
<fileset dir="${tests.build}" includes="**/*.class"/>
<fileset dir="jdk" includes="**/*.class"/>
<fileset dir="${docs.loc}/examples" includes="**/*.class"/>
</delete>
<delete dir="${dist}"/>
<delete dir="dist" failonerror="false"/>
<ant dir="${checkerframework}">
<target name="clean-tags"/>
</ant>
<exec executable="make" dir="${docs.loc}/manual" failonerror="true">
<arg value="very_clean"/>
</exec>
<exec executable="make" dir="${dataflow.loc}/manual" failonerror="true">
<arg value="clean"/>
</exec>
</target>
<target name="clean-nojar" description="Remove generated class files, but not the .jar files">
<delete dir="${build}"/>
</target>
<!-- Dependendencies on other projects (such as javacutil)
mirrors javadoc dependencies. If changing project
dependencies, change the Javadoc dependencies to keep
them in sync (and vice versa). -->
<target name="build.check.uptodate"
description="Set properties: filesets and build.uptodate">
<fileset id="src.files" dir="${src}">
<include name="**/*.java"/>
<exclude name="**/package-info.java"/>
</fileset>
<fileset id="dataflow.src.astub.files" dir="${dataflow.loc}/${src}">
<include name="**/*.properties"/>
<include name="**/*.astub"/>
</fileset>
<fileset id="framework.src.astub.files" dir="${framework.loc}/${src}">
<include name="**/*.properties"/>
<include name="**/*.astub"/>
</fileset>
<fileset id="checker.src.astub.files" dir="${checker.loc}/${src}">
<include name="**/*.properties"/>
<include name="**/*.astub"/>
</fileset>
<!-- I can't figure out how to combine filesets (or even selectors)
to get just one *.uptodate property, so do them individually
and then combine with <condition>. -->
<!-- Probably should depend on a file rather than a directory. -->
<uptodate property="src.files.uptodate" targetfile="${build}">
<srcfiles refid="src.files"/>
<mapper type="glob" from="*.java" to="../${build}/*.class"/>
</uptodate>
<uptodate property="src.astub.files.uptodate" targetfile="${build}">
<srcfiles refid="dataflow.src.astub.files"/>
<srcfiles refid="framework.src.astub.files"/>
<srcfiles refid="checker.src.astub.files"/>
</uptodate>
<uptodate property="framework.lib.uptodate" targetfile="${build}" srcfile="${framework.lib}"/>
<condition property="build.uptodate">
<and>
<isset property="src.files.uptodate"/>
<isset property="src.astub.files.uptodate"/>
<isset property="framework.lib.uptodate"/>
</and>
</condition>
<!--
<echo message="src.files.uptodate: ${src.files.uptodate}"/>
<echo message="src.astub.files.uptodate: ${src.astub.files.uptodate}"/>
<echo message="framework.lib.uptodate: ${framework.lib.uptodate}"/>
<echo message="build.uptodate: ${build.uptodate}"/>
-->
</target>
<target name="build" depends="prep,build.check.uptodate"
unless="build.uptodate"
description="Compile files. Does not update any jars">
<copy todir="${build}" preservelastmodified="true">
<fileset refid="dataflow.src.astub.files"/>
<fileset refid="framework.src.astub.files"/>
<fileset refid="checker.src.astub.files"/>
</copy>
<pathconvert pathsep=" " property="src.files.spaceseparated">
<path>
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
<!-- Recompile dependent projects with annotations-in-comments
enabled, in order to get classes with qualified types. -->
<fileset dir="${javacutil.loc}/${src}">
<include name="**/*.java"/>
<!-- Exclude ManualTaglet to not depend on javadoc. -->
<exclude name="**/javacutil/dist/**"/>
</fileset>
<fileset dir="${dataflow.loc}/${src}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${framework.loc}/${src}">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<echo message="Compiling all source files."/>
<echo message="${src.files.spaceseparated}" file="${tmpdir}/srcfiles-checker.txt"/>
<java fork="true"
failonerror="true"
classpath="${javac.lib}:${framework.lib}:${stubparser.lib}:${junit.lib}:${hamcrest.lib}:${annotation-file-utilities.lib}"
classname="com.sun.tools.javac.Main">
<arg value="-g"/>
<!-- Make sure we only have Java 8 source code and generate Java 8 bytecode. -->
<arg value="-source"/>
<arg value="8"/>
<arg value="-target"/>
<arg value="8"/>
<!-- To not get a warning about missing bootstrap
classpath for Java 8 (once we use Java 9). -->
<arg value="-Xlint:-options"/>
<arg value="-encoding"/>
<arg value="utf-8"/>
<arg value="-sourcepath"/>
<arg value="${src}"/>
<arg value="-d"/>
<arg value="${build}"/>
<arg value="@${tmpdir}/srcfiles-checker.txt"/>
<arg value="-version"/>
<arg value="-Xlint"/>
<arg value="-Werror"/>
</java>
<delete file="${tmpdir}/srcfiles-checker.txt"/>
<!--
Touch doesn't work on a directory, so can't do:
<touch file="${build}"/>
Instead, create and remove a file, which modifies the directory.
-->
<touch file="${build}/.timestamp"/>
<delete file="${build}/.timestamp"/>
</target>
<!-- TODO: add a type-checking target that doesn't use
-XDTA:noannotations in comments. -->
<!-- Dependendencies on other projects (such as dataflow)
mirrors javadoc dependencies. If changing project
dependencies, change the Javadoc dependencies to keep
them in sync (and vice versa). -->
<target name="javadoc" depends="prep,prep-ManualTaglet,build.check.uptodate" description="Create Javadoc documentation">
<!-- This relative path is wrong; running "ant -find" from a
subdirectory fails. -->
<!-- With Ant 1.9.4 or later, add to each javadoc task:
failonwarning="true"
but Travis is stuck on Ant 1.8.2 as of 6/2016 -->
<javadoc sourcepath="${javacutil.loc}/${src}:${dataflow.loc}/${src}:${framework.loc}/${src}:${annotation-file-utilities.loc}/${src}"
destdir="${api.doc}"
private="${javadoc.private}"
encoding="UTF-8"
additionalParam="-Xdoclint:all,-missing"
failonerror="true"
executable="${javadoc.bin}"
classpath="${build}:${javac.lib}:${javadoc.lib}:${junit.lib}:${hamcrest.lib}:${annotation-file-utilities.lib}:${stubparser.lib}"
excludepackagenames="org.checkerframework.framework.stub">
<package name="org.checkerframework.javacutil.*"/>
<package name="org.checkerframework.dataflow.*"/>
<package name="org.checkerframework.framework.*"/>
<package name="org.checkerframework.common.*"/>
<package name="org.checkerframework.checker.*"/>
<fileset dir="${checker.loc}/${src}">
<include name="**/*.java"/>
</fileset>
<link href="https://docs.oracle.com/javase/8/docs/api/"/>
<link href="https://docs.oracle.com/javase/8/docs/jdk/api/javac/tree/"/>
<taglet name="org.checkerframework.javacutil.dist.ManualTaglet"
path="${build}:${javacutil.loc}/${build}:${javacutil.lib}"/>
</javadoc>
<property name="favicon.targetfile" value="favicon-checkerframework.png"/>
<copy file="../docs/logo/Checkmark/CFCheckmark_favicon.png" tofile="${api.doc}/${favicon.targetfile}" />
<exec executable="../docs/logo/add-favicon" failonerror="true">
<arg value="${api.doc}"/>
<arg value="${favicon.targetfile}"/>
</exec>
</target>
<target name="javadoc.jar" depends="javadoc" description="Create jar of all javadoc documentation">
<jar destfile="${checker.javadoc.lib}" basedir="${api.doc}"></jar>
</target>
<!-- This creates checker-source.jar -->
<target name="sources.jar" description="Create a jar of all source files except those in the jdk directory.">
<property name="checker-sources-tmp" value="${tmpdir}/checker-sources"/>
<mkdir dir="${checker-sources-tmp}"/>
<copy todir="${checker-sources-tmp}">
<!-- Copying like this removes the */src portion of the file -->
<fileset dir="${checker.loc}/${src}"/>
<fileset dir="${framework.loc}/${src}"/>
<fileset dir="${dataflow.loc}/${src}"/>
<fileset dir="${javacutil.loc}/${src}"/>
</copy>
<jar destfile="${checker.sources.lib}" basedir="${checker-sources-tmp}"/>
</target>
<!-- This creates checker.jar -->
<target name="jar" depends="build,checker-qual-jar,checker-compat-qual-jar"
description="Create checker.jar file">
<mkdir dir="dist" />
<!-- Only unjar the afu and stubparser - everything else is recompiled. -->
<!-- jar up compilation results to protect against being
overwritten by unjarring annotation-file-utilities.lib.
See https://github.com/typetools/checker-framework/issues/894 -->
<jar destfile="${checker.lib.tmp}" basedir="${build}" excludes="polyall/,tests/,lubglb/,jtreg/,reports/"/>
<unjar src="${annotation-file-utilities.lib}" dest="${build}" />
<!-- Also delete anything in the org/checkerframework package in case it has be removed
from the framework-->
<delete includeemptydirs="true">
<fileset dir="${build}/org/checkerframework"/>
</delete>
<!-- Work-around for Issue 894, see above. -->
<unjar src="${checker.lib.tmp}" dest="${build}" />
<delete file="${checker.lib.tmp}"/>
<unjar src="${stubparser.lib}" dest="${build}" />
<jar destfile="${checker.lib}" basedir="${build}" excludes="polyall/,tests/,lubglb/,jtreg/,reports/">
<manifest>
<attribute name="Main-Class" value="org.checkerframework.framework.util.CheckerMain"/>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
</target>
<!-- This creates checker-qual.jar and checker-qual-source.jar-->
<target name="checker-qual-jar"
description="Create checker-qual.jar file for annotations">
<property name="checker-qual-sources-tmp" value="${tmpdir}/checker-qual-sources"/>
<property name="checker-qual-classes-tmp" value="${tmpdir}/checker-qual-classes"/>
<mkdir dir="${checker-qual-sources-tmp}"/>
<mkdir dir="${checker-qual-classes-tmp}"/>
<copy todir="${checker-qual-sources-tmp}">
<!-- Copying like this removes the $CHECKERFRAMEWORK/checker/src portion of the file
names so that the top level directory is org.-->
<fileset dir="${checker.loc}/${src}">
<include name="org/checkerframework/**/qual/*.java"/>
<include name="**/FormatUtil.java"/>
<include name="**/NullnessUtil.java"/>
<include name="**/RegexUtil.java"/>
<include name="**/UnitsTools.java"/>
<include name="**/SignednessUtil.java"/>
<include name="**/I18nFormatUtil.java"/>
<exclude name="${checker.jdk8orhigher.sources}"/>
</fileset>
<fileset dir="${dataflow.loc}/${src}">
<include name="org/checkerframework/**/qual/*.java"/>
</fileset>
<fileset dir="${framework.loc}/${src}">
<include name="org/checkerframework/**/qual/*.java"/>
</fileset>
</copy>
<pathconvert pathsep=" " property="qual.src.files.spaceseparated">
<path>
<fileset dir="${checker-qual-sources-tmp}">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<delete file="${tmpdir}/srcfiles-checker.txt"/>
<echo message="${qual.src.files.spaceseparated}" file="${tmpdir}/srcfiles-checker.txt"/>
<echo message="Compiling qualifiers."/>
<java fork="true"
failonerror="true"
classname="com.sun.tools.javac.Main"
classpath="${javac.lib}">
<arg value="-g"/>
<!-- Make sure we only have Java 7 source code and generate Java 7 bytecode. -->
<arg value="-source"/>
<arg value="7"/>
<arg value="-target"/>
<arg value="7"/>
<!-- To not get a warning about missing bootstrap
classpath for Java 7. -->
<arg value="-Xlint:-options"/>
<arg value="-encoding"/>
<arg value="utf-8"/>
<arg value="-d"/>
<arg value="${checker-qual-classes-tmp}"/>
<arg value="@${tmpdir}/srcfiles-checker.txt"/>
<arg value="-version"/>
<arg value="-Xlint"/>
<arg value="-Werror"/>
</java>
<delete file="${tmpdir}/srcfiles-checker.txt"/>
<!--Jar classes and source files-->
<jar destfile="${checker.qual7.lib}" basedir="${checker-qual-classes-tmp}">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
<jar destfile="${checker.qual7.sources.lib}" basedir="${checker-qual-sources-tmp}">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
<!-- Compile and copy Java 8 sources -->
<copy todir="${checker-qual-sources-tmp}">
<!-- Copying like this removes the $CHECKERFRAMEWORK/checker/src portion of the file
names so that the top level directory is org.-->
<fileset dir="${checker.loc}/${src}">
<include name="${checker.jdk8orhigher.sources}"/>
</fileset>
</copy>
<pathconvert pathsep=" " property="qual.src8.files.spaceseparated">
<path>
<fileset dir="${checker-qual-sources-tmp}">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<echo message="${qual.src8.files.spaceseparated}" append="true" file="${tmpdir}/srcfiles-checker.txt"/>
<!-- Remove annotations in comments-->
<replaceregexp match="\/\*@([^*]+)\*\/" replace="@\1" flags="g">
<fileset dir="${checker-qual-sources-tmp}">
<include name="**/*.java"/>
</fileset>
</replaceregexp>
<replaceregexp match="\/\*>>>([^*]+)\*\/" replace="\1" flags="g">
<fileset dir="${checker-qual-sources-tmp}">
<include name="**/*.java"/>
</fileset>
</replaceregexp>
<java fork="true"
failonerror="true"
classname="com.sun.tools.javac.Main"
classpath="${javac.lib}">
<arg value="-g"/>
<arg value="-source"/>
<arg value="8"/>
<arg value="-target"/>
<arg value="8"/>
<!-- To not get a warning about missing bootstrap
classpath for Java 8 (once we use Java 9). -->
<arg value="-Xlint:-options"/>
<arg value="-encoding"/>
<arg value="utf-8"/>
<arg value="-d"/>
<arg value="${checker-qual-classes-tmp}"/>
<arg value="@${tmpdir}/srcfiles-checker.txt"/>
<arg value="-Xlint"/>
<arg value="-Werror"/>
</java>
<delete file="${tmpdir}/srcfiles-checker.txt"/>
<copy todir="${checker-qual-sources-tmp}">
<!-- Copying like this removes the $CHECKERFRAMEWORK/checker/src portion of the file
names so that the top level directory is org.-->
<fileset dir="${checker.loc}/${src}">
<include name="${checker.jdk8orhigher.sources}"/>
</fileset>
</copy>
<!--Jar classes and source files-->
<jar destfile="${checker.qual.lib}" basedir="${checker-qual-classes-tmp}">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
<jar destfile="${checker.qual.sources.lib}" basedir="${checker-qual-sources-tmp}">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
<delete dir="${checker-qual-sources-tmp}" failonerror="false"/>
<delete dir="${checker-qual-classes-tmp}" failonerror="false"/>
</target>
<!-- This creates checker-compat-qual.jar and checker-compat-qual-source.jar-->
<target name="checker-compat-qual-jar"
description="Create checker-compat-qual.jar file for compatibility annotations">
<property name="checker-compat-qual-sources-tmp" value="${tmpdir}/checker-compat-qual-sources"/>
<property name="checker-compat-qual-classes-tmp" value="${tmpdir}/checker-compat-qual-classes"/>
<mkdir dir="${checker-compat-qual-sources-tmp}"/>
<mkdir dir="${checker-compat-qual-classes-tmp}"/>
<copy todir="${checker-compat-qual-sources-tmp}">
<!-- Copying like this removes the $CHECKERFRAMEWORK/checker/src portion of the file
names so that the top level directory is org.-->
<fileset dir="${src}">
<include name="**/compatqual/*.java"/>
</fileset>
</copy>
<pathconvert pathsep=" " property="compat.qual.src.files.spaceseparated">
<path>
<fileset dir="${checker-compat-qual-sources-tmp}">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<echo message="Compiling compatibility qualifiers."/>
<echo message="${compat.qual.src.files.spaceseparated}" file="${tmpdir}/srcfiles-checker.txt"/>
<java fork="true"
failonerror="true"
classname="com.sun.tools.javac.Main"
classpath="${javac.lib}">
<arg value="-g"/>
<!-- Make sure we only generate Java 6 bytecode. -->
<arg value="-source"/>
<arg value="6"/>
<arg value="-target"/>
<arg value="6"/>
<!-- To not get a warning about missing bootstrap
classpath for Java 6. -->
<arg value="-Xlint:-options"/>
<arg value="-encoding"/>
<arg value="utf-8"/>
<arg value="-d"/>
<arg value="${checker-compat-qual-classes-tmp}"/>
<arg value="@${tmpdir}/srcfiles-checker.txt"/>
<arg value="-version"/>
<arg value="-Xlint"/>
<arg value="-Werror"/>
</java>
<delete file="${tmpdir}/srcfiles-checker.txt"/>
<jar destfile="${checker.compat.qual.lib}" basedir="${checker-compat-qual-classes-tmp}">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
<jar destfile="${checker.compat.qual.sources.lib}"
basedir="${checker-compat-qual-sources-tmp}">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://checkerframework.org/"/>
</manifest>
</jar>
<delete dir="${checker-compat-qual-sources-tmp}" failonerror="false"/>
<delete dir="${checker-compat-qual-classes-tmp}" failonerror="false"/>
</target>
<target name="build-tests" depends="prep" description="Compile tests">
<pathconvert pathsep=" " property="src.tests">
<path>
<fileset dir="${tests}">
<include name="src/**/*.java"/>
</fileset>
</path>
</pathconvert>
<java fork="true"
failonerror="true"
classpath="${build}:${javac.lib}:${junit.lib}:${hamcrest.lib}"
classname="com.sun.tools.javac.Main">
<arg value="-g"/>
<arg value="-source"/>
<arg value="8"/>
<arg value="-target"/>
<arg value="8"/>
<!-- To not get a warning about missing bootstrap
classpath for Java 8 (once we use Java 9). -->
<arg value="-Xlint:-options"/>
<arg value="-encoding"/>
<arg value="utf-8"/>
<arg value="-sourcepath"/>
<arg value="${tests}"/>
<arg value="-d"/>
<arg value="${tests.build}"/>
<arg line="${src.tests}"/>
</java>
</target>
<!-- TODO: DUPLICATED FOR ALL_TESTS -->
<!-- Per the <test> element, output goes to ${build.reports} -->
<target name="-run-tests" description="Generalized test runner">
<condition property="should.emit.debug.str" value="true" else="false">
<isset property="emit.test.debug"/>
</condition>
<condition property="debugger.str" value="-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" else="">
<isset property="debugger.on"/>
</condition>
<mkdir dir="${build.reports}"/>
<!-- non-debugging version: -->
<!--
<junit fork="${run.tests.should.fork}"
dir="${basedir}"
printsummary="false"
haltonfailure="${halt.on.test.failure}"
haltonerror="${halt.on.test.failure}"
maxmemory="2500M"
>
<formatter type="xml"/>
-->
<!-- end of non-debugging version. -->
<!-- debugging version: -->
<junit fork="${run.tests.should.fork}"
dir="${basedir}"
haltonfailure="${halt.on.test.failure}"
haltonerror="${halt.on.test.failure}"
maxmemory="2500M"
showoutput="true"
printsummary="withOutAndErr"
>
<formatter type="plain" usefile="false"/>
<jvmarg value="-Demit.test.debug=true"/>
<!-- end of debugging version. -->
<!-- plain output for debugging -->
<jvmarg line="${debugger.str}"/> <!-- may be empty string -->
<sysproperty key="JDK_JAR" value="${basedir}/dist/${jdkName}"/>
<sysproperty key="emit.test.debug" value="${should.emit.debug.str}"/>
<jvmarg value="-ea"/>
<classpath>
<pathelement path="${build}"/>
<pathelement path="${tests.build}"/>
<pathelement path="${javac.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${hamcrest.lib}"/>
</classpath>
<test name="${param}" todir="${build.reports}"/>
</junit>
</target>
<target name="all-tests" depends="all-tests-nojtreg, jtreg-tests"
description="Run tests for all checkers and the framework"/>
<!-- Used to guarantee that targets executed from other ant scripts do not cause unnecessary rebuilds -->
<target name="all-tests-nobuildjdk" depends="all-tests-nojtreg-nobuildjdk, jtreg-tests"
description="Run tests for all checkers and the framework, WITHOUT updating jdkX.jar">
</target>
<target name="all-tests-nojtreg" depends="jdk.jar, all-tests-nojtreg-nobuildjdk"
description="Run tests for all checkers and the framework, except jtreg tests"/>
<!-- Used to guarantee that targets executed from other ant scripts do not cause unnecessary rebuilds -->
<target name="all-tests-nojtreg-nobuildjdk" depends="jar, jdk.jar.exists, all-tests-nojtreg-nobuild"
description="Run tests for all checkers and the framework, except jtreg tests, WITHOUT updating jdkX.jar">
</target>
<!-- Used to guarantee that targets executed from other ant scripts do not cause unnecessary rebuilds -->
<target name="all-tests-nojtreg-nobuild"
depends="junit-tests-nojtreg-nobuild,nonjunit-tests-nojtreg-nobuild"
description="Run tests for all checkers, WITHOUT building anything">
</target>
<!-- Used to guarantee that targets executed from other ant scripts do not cause unnecessary rebuilds -->
<target name="junit-tests-nojtreg-nobuild" depends="build-tests"
description="Run junit tests for all checkers, WITHOUT building anything">
<condition property="should.emit.debug.str" value="true" else="false">
<isset property="emit.test.debug"/>
</condition>
<condition property="debugger.str" value="-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" else="">
<isset property="debugger.on"/>
</condition>
<!-- Delete directory because we will rerun all tests -->
<delete dir="${build.reports}"/>
<!-- Copied from -run-tests target -->
<mkdir dir="${build.reports}"/>
<junit fork="${run.tests.should.fork}"
dir="${basedir}"
printsummary="false"
haltonerror="${halt.on.test.failure}"
haltonfailure="${halt.on.test.failure}">
<jvmarg value="-ea"/>
<jvmarg line="${debugger.str}"/> <!-- may be empty string -->
<sysproperty key="JDK_JAR" value="${basedir}/dist/${jdkName}"/>
<sysproperty key="emit.test.debug" value="${should.emit.debug.str}"/>
<classpath>
<pathelement path="${build}"/>
<pathelement path="${tests.build}"/>
<pathelement path="${javac.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${hamcrest.lib}"/>
</classpath>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest todir="${build.reports}">
<fileset dir="${tests}/${src}">
<include name="tests/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- Used to guarantee that targets executed from other ant scripts do not cause unnecessary rebuilds -->
<target name="nonjunit-tests-nojtreg-nobuild" depends="build-tests"
description="Run tests, other than junit tests for all checkers, WITHOUT building anything">
<condition property="should.emit.debug.str" value="true" else="false">
<isset property="emit.test.debug"/>
</condition>
<condition property="debugger.str" value="-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" else="">
<isset property="debugger.on"/>
</condition>
<ant dir="${framework.loc}" inheritAll="false">
<target name="all-tests-nojtreg-nobuild"/>
</ant>
<!-- Delete directory because we will rerun all tests -->
<delete dir="${build.reports}"/>
<!-- Copied from -run-tests target -->
<mkdir dir="${build.reports}"/>
<antcall target="nullness-extra-tests-nobuildjdk"/>
<antcall target="command-line-tests"/>
<!--TODO: This breaks during the release process because the latest Maven artifacts haven't been created.
This target is called in .travis-build.sh -->
<!--<antcall target="example-tests-nobuildjdk"/>-->
<antcall target="check-tutorial"/>
<antcall target="check-compilermsgs"/>
<antcall target="check-purity"/>
<!-- Eventually we would also want this:
<antcall target="check-nullness"/>
-->
</target>
<target name="aggregate-tests" depends="jar,build-tests"
description="Run tests for the aggregate checkers">
<antcall target="-run-tests">
<param name="param" value="tests.NestedAggregateCheckerTest"/>
</antcall>
</target>
<target name="command-line-tests" depends="jar,build-tests"
description="Run tests that need a special command line">
<exec executable="make" failonerror="${halt.on.test.failure}">
<env key="JAVAC" value="${basedir}/bin/javac"/>
<arg value="-C"/>
<arg value="tests/command-line/"/>
</exec>
</target>
<target name="compilermsg-tests" depends="jar,build-tests"
description="Run tests for the Compiler Messages Checker">
<antcall target="-run-tests">
<param name="param" value="tests.CompilerMessagesTest"/>
</antcall>
</target>
<target name="fenum-tests" depends="jar,build-tests"
description="Run tests for the Fenum Checker">
<antcall target="-run-tests">
<param name="param" value="tests.FenumTest"/>
</antcall>
<antcall target="-run-tests">
<param name="param" value="tests.FenumSwingTest"/>
</antcall>
</target>
<target name="i18n-tests" depends="jar,build-tests"
description="Run tests for the I18n Checker">
<antcall target="-run-tests">
<param name="param" value="tests.I18nTest"/>
</antcall>
<antcall target="-run-tests">
<param name="param" value="tests.I18nUncheckedDefaultsTest"/>
</antcall>
</target>
<target name="index-tests" depends="jar,jdk.jar.exists,build-tests"
description="Run tests for the Index Checker">
<antcall target="-run-tests">
<param name="param" value="tests.IndexTest"/>
</antcall>
</target>
<target name="interning-tests" depends="jar,build-tests"
description="Run tests for the Interning Checker">
<antcall target="-run-tests">
<param name="param" value="tests.InterningTest"/>
</antcall>
</target>
<target name="lock-tests" depends="jar,jdk.jar.exists,build-tests"
description="Run tests for the Lock Checker">
<antcall target="-run-tests">
<param name="param" value="tests.LockTest"/>
</antcall>
</target>
<target name="lock-safedefaults-tests" depends="jar,build-tests"
description="Run tests for the Lock Checker with unchecked code defaults turned on for source code">
<antcall target="-run-tests">
<param name="param" value="tests.LockSafeDefaultsTest"/>
</antcall>
</target>
<target name="lubglb-tests" depends="jar,build-tests"
description="Run tests for the Lubglb Checker">
<antcall target="-run-tests">
<param name="param" value="tests.LubGlbTest"/>
</antcall>
</target>
<target name="nullness-tests"
depends="jdk.jar,nullness-tests-nobuildjdk"
description="Run tests for the Nullness Checker">
</target>
<target name="nullness-tests-nobuildjdk"
depends="jar,jdk.jar.exists,build-tests,nullness-base-tests,nullness-base-tests-with-asserts,nullness-concurrent-tests,nullness-skipuses-tests,nullness-skipdefs-tests,nullness-uninit-tests,nullness-uninit-tests-with-asserts,nullness-assume-assertions-are-enabled-tests,nullness-extra-tests-nobuildjdk,nullness-reflection-tests,nullness-invariantarrays-tests,nullness-safedefaultsbytecode-tests,nullness-safedefaultssourcecode-tests,nullness-checkcastelementtype"
description="Run tests for the Nullness Checker, WITHOUT updating jdkX.jar">
</target>
<target name="nullness-base-tests" depends="jar,build-tests"
description="Run base tests for the FBC Nullness Checker">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessFbcTest"/>
</antcall>
</target>
<target name="nullness-uninit-tests" depends="jar,build-tests"
description="Run base tests for the rawness Nullness Checker">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessRawnessTest"/>
</antcall>
</target>
<target name="nullness-base-tests-with-asserts" depends="jar,build-tests"
description="Run base tests for the FBC Nullness Checker, with assertions">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessFbcTestWithAsserts"/>
</antcall>
</target>
<target name="nullness-assume-assertions-are-enabled-tests" depends="jar,build-tests"
description="Run base tests for the Nullness Checker, assuming assertions are disabled">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessAssumeAssertionsAreDisabled"/>
</antcall>
</target>
<target name="nullness-uninit-tests-with-asserts" depends="jar,build-tests"
description="Run base tests for the rawness Nullness Checker, with assertions">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessRawnessTestWithAsserts"/>
</antcall>
</target>
<target name="nullness-checkcastelementtype" depends="jar,build-tests"
description="Run base tests for the rawness Nullness Checker, with assertions">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessCheckCastElementTypeTest"/>
</antcall>
</target>
<target name="signedness-tests" depends="jar,build-tests"
description="Run tests for the Signedness Checker">
<antcall target="-run-tests">
<param name="param" value="tests.SignednessTest"/>
</antcall>
<antcall target="-run-tests">
<param name="param" value="tests.SignednessUncheckedDefaultsTest"/>
</antcall>
</target>
<!-- Differs from other targets in that it is defined via a Makefile and
is not run via the "-run-tests" Antfile target, as other tests are. -->
<target name="nullness-extra-tests" depends="dist,build-tests,nullness-extra-tests-nobuildjdk"
description="Run extra tests for the Nullness Checker"/>
<target name="nullness-extra-tests-nobuildjdk" depends="dist-nobuildjdk,jdk.jar.exists,build-tests"
description="Run extra tests for the Nullness Checker, WITHOUT updating jdkX.jar">
<exec executable="chmod" failonerror="true">
<arg value="+x"/>
<arg value="${basedir}/bin/javac"/>
</exec>
<exec executable="make" failonerror="${halt.on.test.failure}">
<env key="JAVAC" value="${basedir}/bin/javac"/>
<env key="JAVAP" value="${jsr308.langtools.dist}/bin/javap"/>
<arg value="-C"/>
<arg value="tests/nullness-extra/"/>
</exec>
</target>
<target name="nullness-skipuses-tests" depends="jar,build-tests"
description="Run skipuses tests for the Nullness Checker">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessSkipUsesTest"/>
</antcall>
</target>
<target name="nullness-skipdefs-tests" depends="jar,build-tests"
description="Run skipdefs tests for the Nullness Checker">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessSkipDefsTest"/>
</antcall>
</target>
<target name="nullness-concurrent-tests" depends="jar,build-tests"
description="Run concurrent semantics tests for the Nullness Checker">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessConcurrentTest"/>
</antcall>
</target>
<target name="nullness-invariantarrays-tests" depends="jar,build-tests"
description="Run tests for the Nullness Checker using -AinvariantArrays">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessInvariantArraysTest"/>
</antcall>
</target>
<target name="nullness-reflection-tests" depends="jar,build-tests"
description="Run tests for the Nullness Checker using reflection resolution">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessReflectionTest"/>
</antcall>
</target>
<target name="nullness-safedefaultsbytecode-tests" depends="jar,build-tests"
description="Run tests for the Nullness Checker using -AuseDefaultsForUncheckedCode=-source,bytecode">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessSafeDefaultsBytecodeTest"/>
</antcall>
</target>
<target name="nullness-safedefaultssourcecodelib-tests" depends="jar,build-tests"
description="Create libraries for tests for the Nullness Checker using -AuseDefaultsForUncheckedCode=source,bytecode">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessSafeDefaultsSourceCodeLibTest"/>
</antcall>
</target>
<target name="nullness-safedefaultssourcecode-tests" depends="jar,build-tests,nullness-safedefaultssourcecodelib-tests"
description="Run tests for the Nullness Checker using -AuseDefaultsForUncheckedCode=source">
<antcall target="-run-tests">
<param name="param" value="tests.NullnessSafeDefaultsSourceCodeTest"/>