-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
784 lines (745 loc) · 32.8 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
<!--
// Copyright 2013 Bill Campbell, Swami Iyer and Bahar Akbal-Delibas
-->
<project default="testParser">
<property name="APP_FULL_NAME" value="j-- (A Non-trivial Subset of Java)" />
<property name="SRC_DIR" value="src" />
<property name="CLASS_DIR" value="classes" />
<property name="LIB_DIR" value="lib" />
<property name="JAVADOC_DIR" value="javadoc" />
<property name="J2H_DIR" value="java2html" />
<property name="PASS_TESTS_STEP0_DIR" value="${basedir}/tests/pass/step0" />
<property name="PASS_TESTS_STEP1_DIR" value="${basedir}/tests/pass/step1" />
<property name="PASS_TESTS_STEP2_DIR" value="${basedir}/tests/pass/step2" />
<property name="PASS_TESTS_STEP3_DIR" value="${basedir}/tests/pass/step3" />
<property name="PASS_TESTS_STEP4_DIR" value="${basedir}/tests/pass/step4" />
<property name="PASS_TESTS_STEP5_DIR" value="${basedir}/tests/pass/step5" />
<property name="PASS_TESTS_DIR" value="${basedir}/tests/pass" />
<property name="FAIL_TESTS_DIR" value="${basedir}/tests/fail" />
<property name="GEN_CLASS_DIR" value="${basedir}/${CLASS_DIR}" />
<!-- help: Lists main targets -->
<target name="help">
<echo message="package: Creates a distributable for j--"/>
<echo message="testStep0: Tests the scanner (step0)" />
<echo message="testStep1: Tests the scanner (step1)" />
<echo message="testStep2: Tests the handwritten parser (step2)" />
<echo message="testStep3: Tests the JavaCC scanner and parser (step3)" />
<echo message="testStep4: Tests type checking (step4)" />
<echo message="testStep5: Tests code generation (step5)" />
<echo message="runCompilerTests: Compiles and runs j-- (JVM) tests"/>
<echo message="runCompilerTestsJavaCC: Compiles and runs j-- (JVM) tests using JavaCC frontend"/>
<echo message="testScanner: Tokenizes j-- tests"/>
<echo message="testJavaCCScanner: Tokenizes j-- tests using JavaCC scanner"/>
<echo message="testParser: Parses j-- tests"/>
<echo message="testJavaCCParser: Parses j-- tests using JavaCC parser"/>
<echo message="testPreAnalysis: Pre-analyzes j-- tests"/>
<echo message="testAnalysis: Analyzes j-- tests"/>
<echo message="help: Lists main targets"/>
</target>
<!-- javacc: Generates JavaCC scanner and parser. -->
<target name="javacc">
<echo message="Generating JavaCC files..."/>
<javacc target="${SRC_DIR}/jminusminus/j--.jj"
outputdirectory="${SRC_DIR}/jminusminus"
javacchome="${LIB_DIR}"
static="false" />
</target>
<!-- compile: Compiles the jminusminus and SPIM source files. -->
<target name="compile">
<echo message="Compiling j-- source files..."/>
<mkdir dir="${CLASS_DIR}" />
<javac srcdir="${SRC_DIR}"
destdir="${CLASS_DIR}"
includes="jminusminus/**"
excludes="jminusminus/JavaCCMain.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
</javac>
</target>
<!--
compileJavaCC: Compiles the jminusminus source files including
JavaCC frontend.
-->
<target name="compileJavaCC">
<echo message="Compiling j-- source files..."/>
<mkdir dir="${CLASS_DIR}" />
<javac srcdir="${SRC_DIR}"
destdir="${CLASS_DIR}"
includes="jminusminus/**"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
</javac>
</target>
<!-- compile: Compiles the SPIM runtime files. -->
<target name="compileSPIM">
<echo message="Compiling j-- source files..."/>
<mkdir dir="${CLASS_DIR}" />
<javac srcdir="${SRC_DIR}"
destdir="${CLASS_DIR}"
includes="spim/**"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
</javac>
</target>
<!--
jar: Bundles the jminusminus classes and SPIM runtime
classes into respective jar files.
-->
<target name="jar">
<echo message="Bundling class files into jar files..."/>
<jar destfile="${LIB_DIR}/j--.jar" basedir="${CLASS_DIR}" includes="jminusminus/**"/>
<jar destfile="${LIB_DIR}/spim.jar" basedir="${CLASS_DIR}" includes="spim/**"/>
</target>
<!-- javadoc: Generates javadoc for jminusminus and spim runtime classes. -->
<target name="javadoc">
<echo message="Generating javadoc for j-- classes..."/>
<mkdir dir="${JAVADOC_DIR}" />
<javadoc overview="${SRC_DIR}/overview.html"
package="Yes"
sourcepath="${SRC_DIR}" destdir="${JAVADOC_DIR}"
packagenames="jminusminus.*,spim.*"
windowtitle="${APP_FULL_NAME}"
doctitle="${APP_FULL_NAME}">
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
</target>
<!-- j2h: Generates browsable code using java2html. -->
<target name="j2h">
<echo message="Generating browsable code for j--..."/>
<mkdir dir="${J2H_DIR}" />
<java jar="${LIB_DIR}/j2h.jar"
fork="true"
failonerror="true"
maxmemory="128m">
<arg value="-m"/>
<arg value="4"/>
<arg value="-d"/>
<arg value="${J2H_DIR}"/>
<arg value="-js"/>
<arg value="${SRC_DIR}"/>
</java>
</target>
<!--
package: Makes a distributable package for the compiler which includes the
sources, binaries, documentation and junit test framework.
-->
<target name="package"
depends="clean,javacc,compileJavaCC,compileSPIM,jar,javadoc,j2h">
<echo message="Making a distributable j--.zip..."/>
<zip destfile="j--.zip"
basedir="../"
includes="j--/**"
excludes="j--/${CLASS_DIR}/**,j--/*.zip" />
</target>
<target name="testStep5" depends="javacc,compileJavaCC,compile,compileSPIM,jar">
<echo message="Compiling and running j-- (JVM) programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JMinusMinusTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP5_DIR}" />
<sysproperty key="FAIL_TESTS_DIR" value="${FAIL_TESTS_DIR}" />
<sysproperty key="GEN_CLASS_DIR" value="${GEN_CLASS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests"
sourcepath=""
destdir="${CLASS_DIR}"
includes="junit/**"
excludes="junit/JavaCCScannerTest.java,junit/JavaCCParserTest.java,junit/JMinusMinusTestJavaCC.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTestRunner"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JMinusMinusTestJavaCC.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP5_DIR}" />
<sysproperty key="FAIL_TESTS_DIR" value="${FAIL_TESTS_DIR}" />
<sysproperty key="GEN_CLASS_DIR" value="${GEN_CLASS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTestJavaCC"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests"
sourcepath=""
destdir="${CLASS_DIR}"
includes="junit/**"
excludes="clemitter/**,pass/**,fail/**"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTestRunner"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
runCompilerTests: We first compile the tests in tests/pass and
tests/fail directories using the jminusminus compiler. We
use a JUnit test JMinusMinusTest.java to run the jminusminus
compiler on each of the tests. We then run the
JMinusMinusTestRunner JUnit test suite, which includes a JUnit test
case for each jminusminus test file under tests/pass directory.
For example, there is a GCDTest.java test case under tests/junit
corresponding to the jminusminus test GCD.java under tests/pass.
-->
<target name="runCompilerTests" depends="compile,compileSPIM,jar">
<echo message="Compiling and running j-- (JVM) programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JMinusMinusTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP5_DIR}" />
<sysproperty key="FAIL_TESTS_DIR" value="${FAIL_TESTS_DIR}" />
<sysproperty key="GEN_CLASS_DIR" value="${GEN_CLASS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests"
sourcepath=""
destdir="${CLASS_DIR}"
includes="junit/**"
excludes="junit/JavaCCScannerTest.java,junit/JavaCCParserTest.java,junit/JMinusMinusTestJavaCC.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTestRunner"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
runCompilerTestsJavaCC: Same as run compilerTests, but using
JavaCC frontend.
-->
<target name="runCompilerTestsJavaCC"
depends="javacc,compileJavaCC,compileSPIM,jar">
<echo message=
"Compiling and running j-- (JVM) programs using JavaCC frontend..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JMinusMinusTestJavaCC.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP5_DIR}" />
<sysproperty key="FAIL_TESTS_DIR" value="${FAIL_TESTS_DIR}" />
<sysproperty key="GEN_CLASS_DIR" value="${GEN_CLASS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTestJavaCC"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests"
sourcepath=""
destdir="${CLASS_DIR}"
includes="junit/**"
excludes="clemitter/**,pass/**,fail/**"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JMinusMinusTestRunner"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<target name="testStep0" depends="compile,jar">
<echo message="Running handwritten scanner on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/ScannerTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP0_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.ScannerTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<target name="testStep1" depends="compile,jar">
<echo message="Running handwritten scanner on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/ScannerTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP1_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.ScannerTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
testScanner: Tests handwritten scanner by running it on all tests under
tests/pass directory.
-->
<target name="testScanner" depends="compile,jar">
<echo message="Running handwritten scanner on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/ScannerTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP1_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.ScannerTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
testJavaCCScanner: Tests JavaCC scanner by running it on all tests
under tests/pass directory.
-->
<target name="testJavaCCScanner" depends="javacc,compileJavaCC,jar">
<echo message="Running JavaCC scanner on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JavaCCScannerTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP3_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JavaCCScannerTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<target name="testStep2" depends="compile,jar">
<echo message="Running handwritten parser on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/ParserTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP2_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.ParserTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
testParser: Tests hand-written parser by running it on all tests
under tests/pass directory.
-->
<target name="testParser" depends="compile,jar">
<echo message="Running handwritten parser on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/ParserTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP2_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.ParserTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<target name="testStep3" depends="javacc,compileJavaCC,jar">
<echo message="Running JavaCC scanner and parser on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JavaCCScannerTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP3_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JavaCCScannerTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JavaCCParserTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP3_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JavaCCParserTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
testJavaCCParser: Tests JavaCC parser by running it on all tests
under tests/pass directory.
-->
<target name="testJavaCCParser" depends="javacc,compileJavaCC,jar">
<echo message="Running JavaCC parser on the j-- programs..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/JavaCCParserTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.JavaCCParserTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<target name="testStep4" depends="compile,jar">
<echo message="Running compiler on j-- programs up to analysis"/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/PreAnalysisTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP4_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.PreAnalysisTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/AnalysisTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_STEP4_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.AnalysisTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
testPreAnalysis: Runs the jminusminus compiler on each test under
tests/pass up to the stage where the AST has been pre-analyzed.
-->
<target name="testPreAnalysis" depends="compile,jar">
<echo message="Running compiler on j-- programs up to pre-analysis..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/PreAnalysisTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.PreAnalysisTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!--
testAnalysis: Runs the jminusminus compiler on each test under
tests/pass up to the stage where the AST has been analyzed.
-->
<target name="testAnalysis" depends="compile,jar">
<echo message="Running compiler on j-- programs up to analysis..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/AnalysisTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${PASS_TESTS_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.AnalysisTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<target name="testAnalysisSingle" depends="compile,jar">
<echo message="Running compiler on j-- programs up to analysis..."/>
<javac srcdir="${basedir}/tests/"
destdir="${CLASS_DIR}"
includes="junit/AnalysisTest.java"
includeantruntime="false"
debug="on">
<!-- Uncomment the following to see compiler warnings. -->
<!-- <compilerarg value="-Xlint" /> -->
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<sysproperty key="PASS_TESTS_DIR" value="${SINGLE_TEST_DIR}" />
<classpath>
<pathelement location="${LIB_DIR}/junit.jar" />
<pathelement location="${basedir}/${CLASS_DIR}" />
</classpath>
<test name="junit.AnalysisTest"
haltonfailure="no">
<formatter type="plain" usefile="false"/>
</test>
</junit>
</target>
<!-- clean: Removes generated files and folders. -->
<target name="clean">
<echo message="Removing generated files and folders..."/>
<delete file="${SRC_DIR}/jminusminus/Token.java" />
<delete file="${SRC_DIR}/jminusminus/TokenMgrError.java" />
<delete file="${SRC_DIR}/jminusminus/ParseException.java" />
<delete file="${SRC_DIR}/jminusminus/JavaCCParser.java" />
<delete file="${SRC_DIR}/jminusminus/JavaCCParserTokenManager.java" />
<delete file="${SRC_DIR}/jminusminus/JavaCCParserConstants.java" />
<delete file="${SRC_DIR}/jminusminus/SimpleCharStream.java" />
<delete>
<fileset dir="${basedir}" includes="**/*.class"/>
</delete>
<delete file="j--.zip" />
<delete file="${LIB_DIR}/j--.jar" />
<delete file="${LIB_DIR}/spim.jar" />
<delete dir="${CLASS_DIR}" />
<delete dir="${JAVADOC_DIR}" />
<delete dir="${J2H_DIR}" />
</target>
</project>