-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
121 lines (104 loc) · 4.27 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
<!-- Targets for working from terminal window:
build (default) - generates java files and compiles them
test - runs junit test cases
clean - removes all generated files and class files
doc - generates API documentation
Targets for working from Eclipse:
gen - generates java files
genClean - removes all generated files and their class files
-->
<project name="Compiler" default="build" basedir=".">
<!-- "package" is the directory where generated files will be stored -->
<property name="package" value="AST"/>
<property name="document" value="doc"/>
<!-- "tools" is the directory where generators and libraries are located. -->
<property name="tools" value="tools"/>
<!-- where to put test reports -->
<property name = "test-reports.dir" value = "test-reports" />
<!-- "jflex" is an ant task class for the scanner generator in JFlex.jar -->
<taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="${tools}/JFlex.jar"/>
<!-- "beaver" is an ant task class for the parser generator in beaver.jar -->
<taskdef name="beaver" classname="beaver.comp.run.AntTask" classpath="${tools}/beaver.jar"/>
<!-- "jastadd" is an ant task class in jastadd2.jar -->
<taskdef classname="jastadd.JastAddTask" name="jastadd" classpath="${tools}/jastadd2.jar" />
<!-- TARGET build: compile sources -->
<target name="build" depends="gen">
<!-- compile all java files in srcdir and recursively in subdirectories -->
<javac debug="true" nowarn="true" srcdir="." classpath=".:${tools}/beaver-rt.jar:${tools}/junit.jar"
includeantruntime="false"/>
</target>
<!-- TARGET gen: generate source files -->
<target name="gen" depends="scanner,parser">
<!-- create a directory for the generated files -->
<mkdir dir="${basedir}/${package}"/>
<!-- run jastadd to generate AST files -->
<jastadd package="${package}" beaver="true" outdir="${basedir}" lineColumnNumbers="true">
<fileset dir=".">
<include name="**/spec/*.ast"/>
<include name="**/spec/*.jrag"/>
<include name="**/spec/*.jadd"/>
</fileset>
</jastadd>
</target>
<target name="scanner">
<!-- generate the scanner, translating .flex to .java -->
<jflex file="spec/ScalaScanner.flex" outdir="${package}" nobak="yes"/>
</target>
<target name="parser">
<!-- preprocess the parser, translating .parser to .beaver -->
<java
classpath="${tools}/JastAddParser.jar:${tools}/beaver-rt.jar"
classname="Main"
fork="true">
<arg value="--no-beaver-symbol" />
<arg value="spec/ScalaParser.parser" />
<arg value="${package}/ScalaParser.beaver" />
</java>
<!-- generate the parser, translating .beaver to .java -->
<beaver file="${package}/ScalaParser.beaver" terminalNames="yes" compress="no" useSwitch="yes"/>
</target>
<!-- Remove generated source files and .class files -->
<target name="clean" depends="cleanGen">
<!-- Delete all classfiles in dir and recursively in subdirectories -->
<delete>
<fileset dir="." includes="**/*.class"/>
</delete>
</target>
<!-- Remove generated source files -->
<target name="cleanGen">
<delete dir="${package}"/>
<delete dir="${test-reports.dir}"/>
<delete dir="${document}"/>
</target>
<target name="test" depends="build" >
<mkdir dir="${test-reports.dir}" />
<junit>
<classpath>
<pathelement path="." />
<pathelement path="${tools}/junit.jar" />
<pathelement path="${tools}/beaver.jar" />
</classpath>
<formatter type="brief" usefile="false" />
<formatter type="xml"/>
<batchtest todir="${test-reports.dir}">
<fileset dir=".">
<include name="tests/*.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="doc" depends="build" description="generate javadoc">
<mkdir dir="${document}"/>
<javadoc
destdir="${document}"
classpath=".:${tools}/beaver.jar"
sourcepath="."
packagenames="AST"
docletpath="${tools}/RagDoll.jar"
doclet="ragdoll.RagDollDoclet">
<arg value="-linksource"/>
<arg value="-ragroot"/>
<arg value="."/>
</javadoc>
</target>
</project>