-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.xml
1332 lines (1222 loc) · 53.6 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
<project name="polyglot" default="compile" basedir="."
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<description>
Polyglot build file
</description>
<!-- set global properties for this build -->
<!-- prefix for reading environment properties -->
<property environment="env"/>
<!-- read local definitions that override this file, if any -->
<property file="config.properties"/>
<!-- source directory -->
<property name="src" location="${basedir}/src"/>
<!-- directory for class file targets -->
<property name="classes" location="${basedir}/classes"/>
<!-- directory for jar files -->
<property name="lib" location="${basedir}/lib"/>
<!-- binaries directory -->
<property name="bin" location="${basedir}/bin"/>
<!-- tools directory -->
<property name="tools.dir" location="${basedir}/tools"/>
<!-- pth (Polyglot Test Harness) directory -->
<property name="pth.dir" location="${tools.dir}/pth"/>
<property name="pth.classes" location="${pth.dir}/classes"/>
<property name="pth.src" location="${pth.dir}/src"/>
<!-- ppg (Polyglot Parser Generator) directory -->
<property name="ppg.dir" location="${tools.dir}/ppg"/>
<property name="ppg.classes" location="${ppg.dir}/classes"/>
<property name="ppg.src" location="${ppg.dir}/src"/>
<!-- efg (ExtFactory generator) directory -->
<property name="efg.dir" location="${tools.dir}/efg"/>
<property name="efg.classes" location="${efg.dir}/classes"/>
<property name="efg.src" location="${efg.dir}/src"/>
<!-- java_cup directory -->
<property name="cup.dir" location="${tools.dir}/java_cup"/>
<property name="cup.classes" location="${cup.dir}/classes"/>
<property name="cup.src" location="${cup.dir}/src"/>
<!-- examples directory -->
<property name="examples.dir" location="${basedir}/examples"/>
<property name="pao.dir" location="${examples.dir}/pao"/>
<property name="coffer.dir" location="${examples.dir}/coffer"/>
<property name="carray.dir" location="${examples.dir}/carray"/>
<property name="covarRet.dir" location="${examples.dir}/covarRet"/>
<property name="carray_jl5.dir" location="${examples.dir}/carray_jl5"/>
<property name="gitrepo"
value="https://github.com/polyglot-compiler/polyglot.git"/>
<!-- temporary directory -->
<property name="tmp" location="${basedir}/tmp"/>
<!-- Set of source files to include in the distribution. -->
<fileset id="dist-src-files"
dir="${src}"
includes="polyglot/**/*.java,polyglot/qq/qq.ppg,polyglot/qq/qq.flex,polyglot/qq/qq_ppg.cup,polyglot/parse/java12.cup,polyglot/parse/java.flex,polyglot/**/package.html,polyglot/ext/jl5/parse/jl5_ppg.cup,polyglot/ext/jl5/parse/jl5.flex,polyglot/ext/jl5/parse/jl5.ppg,polyglot/ext/jl7/parse/jl?_ppg.cup,polyglot/ext/jl7/parse/jl7.flex,polyglot/ext/jl7/parse/jl?.ppg,polyglot/ext/jl8/parse/jl?_ppg.cup,polyglot/ext/jl8/parse/jl8.flex,polyglot/ext/jl8/parse/jl?.ppg"/>
<!-- Set of class files to include in the distribution. -->
<fileset id="dist-class-files"
dir="${classes}"
includes="polyglot/ast/**,polyglot/frontend/**,polyglot/lex/**,polyglot/main/**,polyglot/parse/**,polyglot/qq/**,polyglot/types/**,polyglot/util/**,polyglot/visit/**,ppg/**,polyglot/ext/param/**,polyglot/ext/jl5/**,polyglot/ext/jl7/**,polyglot/ext/jl8/**,polyglot/translate/**,polyglot/filemanager/**"/>
<!-- classpath to use when compiling polyglot -->
<path id="standard.classpath">
<pathelement location="${classes}"/>
<pathelement location="${lib}/java_cup.jar"/>
<pathelement location="${lib}/jflex.jar"/>
<pathelement location="${lib}/ppg.jar"/>
<pathelement location="${env.JAVA_HOME}/lib/tools.jar"/>
</path>
<!-- classpath to use when compiling pth -->
<path id="pth.classpath">
<pathelement location="${lib}/itextpdf.jar"/>
</path>
<!-- classpath to use when bootstrapping java_cup.jar -->
<path id="cup.jar.classpath">
<pathelement location="${classes}"/>
<pathelement location="${cup.dir}/lib/java_cup.jar"/>
</path>
<target name="configure-version" unless="jl.version">
<property file="${basedir}/build.properties" prefix="jl"/>
<property name="jl.version"
value="${jl.version.major}.${jl.version.minor}.${jl.version.patch}"/>
</target>
<target name="configure-buildstring" depends="configure-version"
unless="jl.version.build">
<tstamp>
<format property="now"
pattern="yyyy-MM-dd HH:mm:ss"
timezone="UTC"/>
</tstamp>
<property name="jl.version.build" value="${jl.version} (${now})"/>
</target>
<target name="configure"
description="Check the build configuration"
depends="check-jars,configure-buildstring,eclipse"
unless="configure.up-to-date">
<echo message="java version is ${java.version}"/>
<echo message="current directory is ${user.dir}"/>
<echo message="Java home directory is ${java.home}"/>
<echo message="Polyglot version is ${jl.version.build}"/>
<property name="configure.up-to-date" value="true"/>
</target>
<!-- Configures Eclipse's .classpath file. -->
<target name="eclipse" depends="eclipse-check"
unless="eclipse.up-to-date"
description="Configures Eclipse's .classpath file">
<property environment="env"/>
<condition property="tools.jar-entry"
value="<classpathentry kind="lib" path="${env.JAVA_HOME}/lib/tools.jar"/>"
else="">
<available file="${env.JAVA_HOME}/lib/tools.jar"/>
</condition>
<copy file="eclipse/classpath.in" tofile=".classpath">
<filterset>
<filter token="TOOLS.JAR" value="${tools.jar-entry}"/>
</filterset>
</copy>
</target>
<target name="eclipse-check">
<uptodate property="eclipse.up-to-date"
targetfile=".classpath"
srcfile="eclipse/classpath.in"/>
</target>
<target name="check-jars">
<available file="${cup.dir}/lib/java_cup.jar"
property="cup.jar.exists"/>
<available file="${lib}/jflex.jar" property="jflex.jar.exists"/>
<fail unless="cup.jar.exists"
message="${cup.dir}/lib/java_cup.jar not found."/>
<fail unless="jflex.jar.exists"
message="${lib}/jflex.jar not found."/>
</target>
<target name="check-pth-jars">
<available file="${lib}/itextpdf.jar" property="itextpdf.jar.exists"/>
<fail unless="itextpdf.jar.exists"
message="${lib}/itextpdf.jar not found."/>
</target>
<!-- create appropriate executables in the bin directory -->
<target name="bin" depends="configure" unless="bin.up-to-date">
<chmod perm="+x" file="${bin}/jlc"/>
<chmod perm="+x" file="${bin}/jl5c"/>
<chmod perm="+x" file="${bin}/jl7c"/>
<chmod perm="+x" file="${bin}/jl8c"/>
<chmod perm="+x" file="${bin}/pth"/>
<chmod perm="+x" file="${bin}/efg"/>
<property name="bin.up-to-date" value="true"/>
</target>
<!-- initialize the build -->
<target name="init" depends="configure">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<antcall target="mkdirs"/>
</target>
<target name="mkdirs">
<mkdir dir="${classes}"/>
<mkdir dir="${cup.classes}"/>
<mkdir dir="${ppg.classes}"/>
<mkdir dir="${pth.classes}"/>
<mkdir dir="${efg.classes}"/>
</target>
<!-- build everything -->
<target name="all" depends="jar-all" description="Build everything"/>
<!-- build the base compiler, qq, pth, and efg -->
<target name="compile"
depends="base,pth,efg"
description="Build the base compiler, qq, pth, and efg"/>
<!-- build the base compiler -->
<target name="base"
depends="bin,base-parser,compile-base"
description="Build the base compiler"/>
<target name="jl" depends="base" description="Build the base compiler"/>
<!-- compile everything -->
<target name="compile-all"
depends="base,compile-ppg,compile-pth,compile-efg,examples"
description="Compile the base compiler, ppg, pth, efg, and the examples"
/>
<!-- build all the jars -->
<target name="jar-all"
depends="jar,jar-pth,jar-ppg,jar-efg,jar-examples"
description="Build polyglot.jar ppg.jar pth.jar efg.jar and examples"/>
<!-- install the jars in the examples -->
<target name="install-jars-in-examples" depends="jar">
<copy file="${lib}/polyglot.jar" todir="${pao.dir}/lib"/>
<copy file="${lib}/polyglot.jar" todir="${coffer.dir}/lib"/>
<copy file="${lib}/polyglot.jar" todir="${covarRet.dir}/lib"/>
<copy file="${lib}/polyglot.jar" todir="${carray.dir}/lib"/>
<copy file="${lib}/polyglot.jar" todir="${carray_jl5.dir}/lib"/>
<copy file="${lib}/java_cup.jar" todir="${pao.dir}/lib"/>
<copy file="${lib}/java_cup.jar" todir="${coffer.dir}/lib"/>
<copy file="${lib}/java_cup.jar" todir="${carray.dir}/lib"/>
<copy file="${lib}/java_cup.jar" todir="${carray_jl5.dir}/lib"/>
<copy file="${lib}/jflex.jar" todir="${pao.dir}/lib"/>
<copy file="${lib}/jflex.jar" todir="${coffer.dir}/lib"/>
<copy file="${lib}/jflex.jar" todir="${carray.dir}/lib"/>
<copy file="${lib}/jflex.jar" todir="${carray_jl5.dir}/lib"/>
<copy file="${lib}/ppg.jar" todir="${pao.dir}/lib"/>
<copy file="${lib}/ppg.jar" todir="${coffer.dir}/lib"/>
<copy file="${lib}/ppg.jar" todir="${carray.dir}/lib"/>
<copy file="${lib}/ppg.jar" todir="${carray_jl5.dir}/lib"/>
</target>
<target name="serialuid" description="Build polyglot.util.SerialVersionUID">
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/util/SerialVersionUID.java"
includeAntRuntime="false">
<classpath refid="standard.classpath"/>
</javac>
</target>
<!-- build the examples -->
<target name="examples"
depends="pao,coffer,carray,carray_jl5"
description="Build the examples"/>
<target name="pao"
depends="install-jars-in-examples"
description="Build the pao example">
<ant inheritAll="false"
antfile="${pao.dir}/build.xml"
dir="${pao.dir}"
target="compile-all"/>
<ant inheritAll="false"
antfile="${pao.dir}/build.xml"
dir="${pao.dir}"
target="jar"/>
</target>
<target name="coffer"
depends="install-jars-in-examples"
description="Build the coffer example">
<ant inheritAll="false"
antfile="${coffer.dir}/build.xml"
dir="${coffer.dir}"
target="compile-all"/>
<ant inheritAll="false"
antfile="${coffer.dir}/build.xml"
dir="${coffer.dir}"
target="jar"/>
</target>
<target name="carray"
depends="install-jars-in-examples"
description="Build the carray example">
<ant inheritAll="false"
antfile="${carray.dir}/build.xml"
dir="${carray.dir}"
target="compile-all"/>
<ant inheritAll="false"
antfile="${carray.dir}/build.xml"
dir="${carray.dir}"
target="jar"/>
</target>
<target name="carray_jl5"
depends="carray,install-jars-in-examples"
description="Build the carray_jl5 example">
<copy file="${carray.dir}/lib/carray.jar"
todir="${carray_jl5.dir}/lib"/>
<ant inheritAll="false"
antfile="${carray_jl5.dir}/build.xml"
dir="${carray_jl5.dir}"
target="compile-all"/>
<ant inheritAll="false"
antfile="${carray_jl5.dir}/build.xml"
dir="${carray_jl5.dir}"
target="jar"/>
</target>
<!-- clean the examples -->
<target name="clean-examples" description="Clean the examples">
<ant inheritAll="false"
antfile="${pao.dir}/build.xml"
dir="${pao.dir}"
target="clean"/>
<ant inheritAll="false"
antfile="${coffer.dir}/build.xml"
dir="${coffer.dir}"
target="clean"/>
<ant inheritAll="false"
antfile="${carray.dir}/build.xml"
dir="${carray.dir}"
target="clean"/>
<ant inheritAll="false"
antfile="${carray_jl5.dir}/build.xml"
dir="${carray_jl5.dir}"
target="clean"/>
</target>
<!-- clobber the examples -->
<target name="clobber-examples" description="Clobber the examples">
<ant inheritAll="false"
antfile="${pao.dir}/build.xml"
dir="${pao.dir}"
target="clobber"/>
<ant inheritAll="false"
antfile="${coffer.dir}/build.xml"
dir="${coffer.dir}"
target="clobber"/>
<ant inheritAll="false"
antfile="${carray.dir}/build.xml"
dir="${carray.dir}"
target="clobber"/>
<ant inheritAll="false"
antfile="${carray_jl5.dir}/build.xml"
dir="${carray_jl5.dir}"
target="clobber"/>
<delete file="${pao.dir}/lib/polyglot.jar"/>
<delete file="${coffer.dir}/lib/polyglot.jar"/>
<delete file="${covarRet.dir}/lib/polyglot.jar"/>
<delete file="${carray.dir}/lib/polyglot.jar"/>
<delete file="${carray_jl5.dir}/lib/polyglot.jar"/>
<delete file="${pao.dir}/lib/java_cup.jar"/>
<delete file="${coffer.dir}/libjava_cup.jar"/>
<delete file="${carray.dir}/libjava_cup.jar"/>
<delete file="${carray_jl5.dir}/lib"/>
<delete file="${pao.dir}/lib/jflex.jar"/>
<delete file="${coffer.dir}/lib/jflex.jar"/>
<delete file="${carray.dir}/lib/jflex.jar"/>
<delete file="${carray_jl5.dir}/lib/jflex.jar"/>
<delete file="${pao.dir}/lib/ppg.jar"/>
<delete file="${coffer.dir}/lib/ppg.jar"/>
<delete file="${carray.dir}/lib/ppg.jar"/>
<delete file="${carray_jl5.dir}/lib/ppg.jar"/>
</target>
<!-- jar the examples -->
<target name="jar-examples"
depends="examples"
description="Build pao.jar and coffer.jar">
<ant inheritAll="false"
antfile="${pao.dir}/build.xml"
dir="${pao.dir}"
target="jar"/>
<ant inheritAll="false"
antfile="${coffer.dir}/build.xml"
dir="${coffer.dir}"
target="jar"/>
<ant inheritAll="false"
antfile="${carray.dir}/build.xml"
dir="${carray.dir}"
target="jar"/>
<ant inheritAll="false"
antfile="${carray_jl5.dir}/build.xml"
dir="${carray_jl5.dir}"
target="jar"/>
</target>
<target name="clean-all"
depends="clean,clean-examples"
description="Clean the base compiler and the examples"/>
<target name="clobber-all"
depends="clobber,clobber-examples"
description="Clobber the base compiler and the examples"/>
<target name="dust" depends="clobber-all">
<delete file="${lib}/polyglot.jar"/>
<delete file="${lib}/java_cup.jar"/>
<delete file="${lib}/ppg.jar"/>
<delete file="${lib}/pth.jar"/>
<delete file="${lib}/efg.jar"/>
</target>
<target name="clean"
description="Cleans up the directory tree: deletes the distribution directory and the classes directories">
<!-- Delete the ${classes} and ${dist} directory trees -->
<delete dir="${lib}/polyglot.jar"/>
<delete dir="${classes}" includeemptydirs="true" failonerror="false"/>
<delete dir="${pth.classes}"
includeemptydirs="true"
failonerror="false"/>
<delete dir="${ppg.classes}"
includeemptydirs="true"
failonerror="false"/>
<delete dir="${efg.classes}"
includeemptydirs="true"
failonerror="false"/>
<delete dir="${cup.classes}"
includeemptydirs="true"
failonerror="false"/>
<delete dir="${tmp}"
includeemptydirs="true"
failonerror="false"/>
<antcall target="mkdirs"/>
</target>
<target name="clean-jars" description="Clean up the jars">
<delete dir="${lib}/polyglot.jar"/>
</target>
<target name="clobber"
depends="clean,clobber-examples"
description="Cleans up the directory tree and deletes generated files">
<delete>
<fileset dir="${src}">
<include name="polyglot/parse/Grm.java"/>
<include name="polyglot/parse/sym.java"/>
<include name="polyglot/parse/Lexer_c.java"/>
<include name="polyglot/qq/Grm.java"/>
<include name="polyglot/qq/sym.java"/>
<include name="polyglot/qq/Lexer_c.java"/>
<include name="polyglot/qq/qq_ppg.cup"/>
<include name="polyglot/ext/jl5/parse/Grm.java"/>
<include name="polyglot/ext/jl5/parse/jl5_ppg.cup"/>
<include name="polyglot/ext/jl5/parse/sym.java"/>
<include name="polyglot/ext/jl5/parse/Lexer_c.java"/>
<include name="polyglot/ext/jl5/qq/Grm.java"/>
<include name="polyglot/ext/jl5/qq/sym.java"/>
<include name="polyglot/ext/jl5/qq/Lexer_c.java"/>
<include name="polyglot/ext/jl5/qq/qq_ppg.cup"/>
<include name="polyglot/ext/jl7/parse/Grm.java"/>
<include name="polyglot/ext/jl7/parse/jl7_ppg.cup"/>
<include name="polyglot/ext/jl7/parse/sym.java"/>
<include name="polyglot/ext/jl7/parse/Lexer_c.java"/>
<include name="polyglot/ext/jl8/parse/Grm.java"/>
<include name="polyglot/ext/jl8/parse/jl8_ppg.cup"/>
<include name="polyglot/ext/jl8/parse/sym.java"/>
<include name="polyglot/ext/jl8/parse/Lexer_c.java"/>
</fileset>
</delete>
<delete>
<fileset dir="${pth.src}">
<include name="polyglot/pth/Grm.java"/>
<include name="polyglot/pth/sym.java"/>
<include name="polyglot/pth/Lexer_c.java"/>
</fileset>
</delete>
<delete>
<fileset dir="${efg.src}">
<include name="efg/parse/Grm.java"/>
<include name="efg/parse/sym.java"/>
<include name="efg/parse/Lexer_c.java"/>
</fileset>
</delete>
<delete>
<fileset dir="${ppg.src}">
<include name="ppg/parse/Parser.java"/>
<include name="ppg/parse/sym.java"/>
<include name="ppg/lex/Lexer.java"/>
</fileset>
</delete>
<delete>
<fileset dir="${cup.src}">
<include name="java_cup/Lexer.java"/>
<include name="java_cup/parser.java"/>
<include name="java_cup/sym.java"/>
</fileset>
</delete>
</target>
<!-- compile the base compiler except for the quasiquoter and generated parser -->
<target name="compile-base" depends="init,base-parser">
<javac source="8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/**"
excludes="polyglot/ext/jl5/**,polyglot/ext/jl7/**,polyglot/ext/jl8/**,polyglot/qq/**,polyglot/parse/Lexer_c.java,polyglot/parse/sym.java,polyglot/parse/Grm.java"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- Compile the JL5 code -->
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl5/**"
excludes="polyglot/ext/jl5/parse/Lexer_c.java,polyglot/ext/jl5/parse/sym.java,polyglot/ext/jl5/parse/Grm.java"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- Compile the JL7 code -->
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl7/**"
excludes="polyglot/ext/jl7/parse/Lexer_c.java,polyglot/ext/jl7/parse/sym.java,polyglot/ext/jl7/parse/Grm.java"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- Compile the JL8 code -->
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl8/**"
excludes="polyglot/ext/jl8/parse/Lexer_c.java,polyglot/ext/jl8/parse/sym.java,polyglot/ext/jl8/parse/Grm.java"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
</target>
<target name="cup"
depends="init"
description="Builds the extended CUP parser generator">
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${cup.src}/java_cup"/>
<param name="lexer.class" value="Lexer"/>
<param name="jflex.file" value="Lexer.jflex"/>
</antcall>
<antcall target="cup-parser-using-jar">
<param name="parser.dir" value="${cup.src}/java_cup"/>
<param name="cup.file" value="parser.cup"/>
<param name="parser.class" value="parser"/>
<param name="symbol.class" value="sym"/>
</antcall>
<javac source="1.8"
target="1.8"
srcdir="${cup.src}"
destdir="${cup.classes}"
debug="on"
includes="java_cup/**,parser/**"
includeantruntime="false">
<classpath refid="cup.jar.classpath"/>
</javac>
<!-- install a jar file in the polyglot lib directory -->
<jar destfile="${lib}/java_cup.jar">
<fileset dir="${cup.classes}"/>
<fileset dir="${cup.src}" includes="java_cup/**,parser/**"/>
<manifest>
<attribute name="Main-Class" value="java_cup.Main"/>
<attribute name="Built-Date" value="${now}"/>
</manifest>
</jar>
</target>
<!-- Build a CUP parser based on parameters supplied to the target.
@param parser.dir The directory, relative to $basedir, in which
the CUP file is located.
@param parser.class The name to be passed to CUP with -parser.
@param symbol.class The name to be passed to CUP with -symbols.
@param cup.file The name of the CUP file.
-->
<target name="cup-parser"
depends="cup,cup-parser-deps,serialuid"
unless="cup-parser.up-to-date">
<java classname="java_cup.Main"
fork="true"
dir="${parser.dir}"
failonerror="true">
<classpath refid="standard.classpath"/>
<arg value="-nopositions"/>
<arg value="-parser"/>
<arg value="${parser.class}"/>
<arg value="-symbols"/>
<arg value="${symbol.class}"/>
<arg value="${cup.file}"/>
</java>
</target>
<!-- The following target builds a cup parser using the version of
cup already sitting in the java_cup.jar file. This is needed to
bootstrap the build of cup. -->
<target name="cup-parser-using-jar"
depends="cup-parser-deps,serialuid"
unless="cup-parser-using-jar.up-to-date">
<java classname="java_cup.Main"
fork="true"
dir="${parser.dir}"
failonerror="true">
<classpath refid="cup.jar.classpath"/>
<arg value="-nopositions"/>
<arg value="-parser"/>
<arg value="${parser.class}"/>
<arg value="-symbols"/>
<arg value="${symbol.class}"/>
<arg value="${cup.file}"/>
</java>
<!-- Hack to suppress warnings in parser. -->
<replaceregexp
file="${parser.dir}/${parser.class}.java"
match="@SuppressWarnings\([^)]*\)"
replace="@SuppressWarnings("all")"
flags="g"
byline="true"
/>
</target>
<!-- Set the property cup-parser.up-to-date if the parser is in fact
up to date. Called by the cup-parser-using-jar target.
-->
<target name="cup-parser-deps">
<dependset>
<srcfileset dir="${parser.dir}" includes="${cup.file}"/>
<targetfileset dir="${parser.dir}">
<include name="${parser.class}.java"/>
<include name="${symbol.class}.java"/>
</targetfileset>
</dependset>
<uptodate property="cup-parser.up-to-date">
<srcfiles dir="${cup.src}/java_cup"/>
<srcfiles dir="${parser.dir}" includes="${cup.file}"/>
<compositemapper>
<mergemapper to="${parser.dir}/${parser.class}.java"/>
<mergemapper to="${parser.dir}/${symbol.class}.java"/>
</compositemapper>
</uptodate>
<uptodate property="cup-parser-using-jar.up-to-date">
<srcfiles dir="${cup.dir}/lib"/>
<srcfiles dir="${parser.dir}" includes="${cup.file}"/>
<compositemapper>
<mergemapper to="${parser.dir}/${parser.class}.java"/>
<mergemapper to="${parser.dir}/${symbol.class}.java"/>
</compositemapper>
</uptodate>
</target>
<!-- Build a PPG parser based on parameters supplied to the target.
@param parser.dir The directory, relative to $basedir, in which
the PPG file is located.
@param ppg.file The name of the PPG file.
@param cup.file The name of the CUP file to output.
@param parser.class The name to be passed to CUP with -parser.
@param symbol.class The name to be passed to CUP with -symbols.
-->
<target name="ppg-parser" depends="ppg-parser.deps,serialuid">
<java classname="ppg.PPG"
fork="true"
failonerror="true"
unless:set="ppg-parser.up-to-date">
<classpath refid="standard.classpath"/>
<arg value="${parser.dir}/${ppg.file}"/>
<arg value="-o"/>
<arg value="${parser.dir}/${cup.file}"/>
</java>
<antcall target="cup-parser"/>
</target>
<!-- Set the property ppg-parser.up-to-date if the parser is in fact
up to date. Called by the ppg-parser target.
-->
<target name="ppg-parser.deps">
<dependset>
<srcfileset dir="${parser.dir}">
<include name="${ppg.file}"/>
</srcfileset>
<srcfileset file="${base-parser}"/>
<targetfileset dir="${parser.dir}">
<include name="${cup.file}"/>
<include name="${parser.class}.java"/>
<include name="${symbol.class}.java"/>
</targetfileset>
</dependset>
<uptodate property="ppg-parser.up-to-date">
<srcfiles dir="${ppg.src}"/>
<srcfiles file="${base-parser}"/>
<srcfiles dir="${parser.dir}" includes="${ppg.file}"/>
<compositemapper>
<mergemapper to="${parser.dir}/${cup.file}"/>
<mergemapper to="${parser.dir}/${parser.class}.java"/>
<mergemapper to="${parser.dir}/${symbol.class}.java"/>
</compositemapper>
</uptodate>
</target>
<!-- Build a JFlex lexer based on parameters supplied to the target.
@param lexer.dir The directory, relative to $basedir, in which
the JFlex file is located.
@param lexer.class The name of the lexer as declared with %class
in the JFlex file.
@param jflex.file The name of the JFlex file.
-->
<target name="jflex-lexer"
depends="jflex-lexer-deps"
unless="jflex-lexer.up-to-date">
<java classname="jflex.Main"
fork="true"
dir="${lexer.dir}"
failonerror="true">
<classpath refid="standard.classpath"/>
<arg value="--noinputstreamctor"/>
<arg value="${jflex.file}"/>
</java>
</target>
<!-- Set the property jflex-lexer.up-to-date if the lexer is in fact
up to date. Called by the jflex.lexer target.
-->
<target name="jflex-lexer-deps">
<dependset>
<srcfileset dir="${lexer.dir}" includes="${jflex.file}"/>
<targetfileset dir="${lexer.dir}" includes="${lexer.class}.java"/>
</dependset>
<available property="jflex-lexer.up-to-date"
file="${lexer.dir}/${lexer.class}.java"/>
</target>
<target name="base-parser"
depends="bin,cup,ppg,init"
description="Build the base compiler parser">
<!-- generate parser source -->
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${src}/polyglot/parse"/>
<param name="lexer.class" value="Lexer_c"/>
<param name="jflex.file" value="java.flex"/>
</antcall>
<antcall target="cup-parser">
<param name="parser.dir" value="${src}/polyglot/parse"/>
<param name="cup.file" value="java12.cup"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
</antcall>
<copy file="${src}/polyglot/parse/java12.cup"
todir="${classes}/polyglot/parse"/>
<!-- generate QQ parser source -->
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${src}/polyglot/qq"/>
<param name="lexer.class" value="Lexer_c"/>
<param name="jflex.file" value="qq.flex"/>
</antcall>
<antcall target="ppg-parser">
<param name="parser.dir" value="${src}/polyglot/qq"/>
<param name="ppg.file" value="qq.ppg"/>
<param name="base-parser"
value="${src}/polyglot/parse/java12.cup"/>
<param name="cup.file" value="qq_ppg.cup"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
</antcall>
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/parse/**,polyglot/qq/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- JL5 compiler parser -->
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${src}/polyglot/ext/jl5/parse"/>
<param name="lexer.class" value="Lexer_c"/>
<param name="jflex.file" value="jl5.flex"/>
</antcall>
<antcall target="ppg-parser">
<param name="parser.dir" value="${src}/polyglot/ext/jl5/parse"/>
<param name="ppg.file" value="jl5.ppg"/>
<param name="base-parser" value="${src}/polyglot/parse/java12.cup"/>
<param name="cup.file" value="jl5_ppg.cup"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
</antcall>
<copy file="${src}/polyglot/parse/java12.cup"
todir="${classes}/polyglot/ext/jl5/parse"/>
<copy file="${src}/polyglot/ext/jl5/parse/jl5.ppg"
todir="${classes}/polyglot/ext/jl5/parse"/>
<copy file="${src}/polyglot/ext/jl5/parse/jl5_ppg.cup"
todir="${classes}/polyglot/ext/jl5/parse"/>
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl5/parse/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- JL5 QQ parser -->
<antcall target="ppg-parser">
<param name="parser.dir" value="${src}/polyglot/ext/jl5/qq"/>
<param name="ppg.file" value="qq.ppg"/>
<param name="base-parser"
value="${src}/polyglot/ext/jl5/parse/jl5_ppg.cup"/>
<param name="cup.file" value="qq_ppg.cup"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
</antcall>
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl5/qq/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- JL7 compiler parser -->
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${src}/polyglot/ext/jl7/parse"/>
<param name="lexer.class" value="Lexer_c"/>
<param name="jflex.file" value="jl7.flex"/>
</antcall>
<antcall target="ppg-parser">
<param name="parser.dir" value="${src}/polyglot/ext/jl7/parse"/>
<param name="ppg.file" value="jl7.ppg"/>
<param name="cup.file" value="jl7_ppg.cup"/>
<param name="base-parser"
value="${src}/polyglot/ext/jl5/parse/jl5_ppg.cup"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
</antcall>
<copy file="${src}/polyglot/parse/java12.cup"
todir="${classes}/polyglot/ext/jl7/parse"/>
<copy file="${src}/polyglot/ext/jl5/parse/jl5.ppg"
todir="${classes}/polyglot/ext/jl7/parse"/>
<copy file="${src}/polyglot/ext/jl5/parse/jl5_ppg.cup"
todir="${classes}/polyglot/ext/jl7/parse"/>
<copy file="${src}/polyglot/ext/jl7/parse/jl7.ppg"
todir="${classes}/polyglot/ext/jl7/parse"/>
<copy file="${src}/polyglot/ext/jl7/parse/jl7_ppg.cup"
todir="${classes}/polyglot/ext/jl7/parse"/>
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl7/parse/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
<!-- JL8 compiler parser -->
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${src}/polyglot/ext/jl8/parse"/>
<param name="lexer.class" value="Lexer_c"/>
<param name="jflex.file" value="jl8.flex"/>
</antcall>
<antcall target="ppg-parser">
<param name="parser.dir" value="${src}/polyglot/ext/jl8/parse"/>
<param name="ppg.file" value="jl8.ppg"/>
<param name="cup.file" value="jl8_ppg.cup"/>
<param name="base-parser"
value="${src}/polyglot/ext/jl7/parse/jl7_ppg.cup"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
</antcall>
<copy file="${src}/polyglot/parse/java12.cup"
todir="${classes}/polyglot/ext/jl8/parse"/>
<copy file="${src}/polyglot/ext/jl5/parse/jl5.ppg"
todir="${classes}/polyglot/ext/jl8/parse"/>
<copy file="${src}/polyglot/ext/jl5/parse/jl5_ppg.cup"
todir="${classes}/polyglot/ext/jl8/parse"/>
<copy file="${src}/polyglot/ext/jl8/parse/jl8.ppg"
todir="${classes}/polyglot/ext/jl8/parse"/>
<copy file="${src}/polyglot/ext/jl8/parse/jl8_ppg.cup"
todir="${classes}/polyglot/ext/jl8/parse"/>
<javac source="1.8"
target="1.8"
srcdir="${src}"
destdir="${classes}"
debug="on"
includes="polyglot/ext/jl8/parse/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
</target>
<target name="jar" description="Build polyglot.jar" depends="jar-base"/>
<target name="jar-base" depends="jl,ppg,configure-buildstring">
<delete file="${lib}/polyglot.jar" failonerror="false"/>
<jar destfile="${lib}/polyglot.jar">
<fileset refid="dist-class-files"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="polyglot.main.Main"/>
<attribute name="Implementation-Version" value="${jl.version}"/>
<attribute name="Built-Date" value="${now}"/>
<attribute name="Class-Path"
value="java_cup.jar polyglot.jar ppg.jar"/>
</manifest>
</jar>
</target>
<target name="javadoc"
description="Runs javadoc over the Polyglot source code"
depends="jl">
<echo>javadoc starting... ${src}</echo>
<javadoc destdir="doc/api" encoding="utf-8">
<packageset dir="${src}" defaultexcludes="yes">
<include name="polyglot/**"/>
</packageset>
<packageset dir="${ppg.src}" defaultexcludes="yes">
<include name="ppg/**"/>
<exclude name="ppg/*/**"/>
</packageset>
<packageset dir="${pth.src}" defaultexcludes="yes">
<include name="polyglot/pth/**"/>
</packageset>
<packageset dir="${efg.src}" defaultexcludes="yes">
<include name="polyglot/efg/**"/>
</packageset>
<classpath refid="standard.classpath"/>
<classpath refid="pth.classpath"/>
</javadoc>
</target>
<!-- compile pth (Polyglot Test Harness) -->
<target name="compile-pth" depends="compile-base,check-pth-jars">
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${pth.src}/polyglot/pth"/>
<param name="lexer.class" value="Lexer_c"/>
<param name="jflex.file" value="script.flex"/>
</antcall>
<antcall target="cup-parser">
<param name="parser.dir" value="${pth.src}/polyglot/pth"/>
<param name="parser.class" value="Grm"/>
<param name="symbol.class" value="sym"/>
<param name="cup.file" value="script.cup"/>
</antcall>
<copy file="${pth.src}/polyglot/pth/script.cup"
todir="${pth.classes}/polyglot/pth"/>
<javac source="1.8"
target="1.8"
srcdir="${pth.src}"
destdir="${pth.classes}"
debug="on"
includes="polyglot/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
<classpath refid="pth.classpath"/>
</javac>
</target>
<!-- create jar pth (Polyglot Test Harness) -->
<target name="jar-pth" depends="compile-pth" description="Builds pth.jar">
<jar jarfile="${lib}/pth.jar"
basedir="${pth.classes}"
includes="polyglot/pth/**"/>
</target>
<!-- create pth (Polyglot Test Harness) -->
<target name="pth"
depends="jar-pth"
description="Builds the pth (Polyglot Test Harness) tool"/>
<!-- compile ppg (Polyglot Parser Generator) -->
<target name="compile-ppg"
description="Build the Polyglot parser generator">
<antcall target="jflex-lexer">
<param name="lexer.dir" value="${ppg.src}/ppg/lex"/>
<param name="lexer.class" value="Lexer"/>
<param name="jflex.file" value="ppg.flex"/>
</antcall>
<antcall target="cup-parser">
<param name="parser.dir" value="${ppg.src}/ppg/parse"/>
<param name="parser.class" value="Parser"/>
<param name="symbol.class" value="Constant"/>
<param name="cup.file" value="ppg.cup"/>
</antcall>
<javac source="1.8"
target="1.8"
srcdir="${ppg.src}"
destdir="${ppg.classes}"
debug="on"
includes="ppg/**"
includeantruntime="false">
<classpath refid="standard.classpath"/>
</javac>
</target>
<!-- create jar ppg (Polyglot Parser Generator) -->
<target name="jar-ppg" depends="compile-ppg" description="Builds ppg.jar">
<jar jarfile="${lib}/ppg.jar"