-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
134 lines (110 loc) · 3.47 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
<!-- Targets for working from terminal window:
build (default) - generates java files and compiles them
test - runs junit test cases
Targets for working from Eclipse:
gen - generates java files
General targets:
clean - removes all generated files and all class files
doc - generate javadoc documentation
-->
<project
name = "php"
default = "build"
basedir = "." >
<property name = "tools.dir" value = "tools" />
<property name = "parser.name" value = "phpParser" />
<property name = "scanner.name" value = "phpScanner" />
<property name = "package.ast" value = "AST" />
<property name = "gen.dir" value = "AST" />
<property name = "spec.dir" value = "spec" />
<property name = "test-reports.dir" value = "test-reports" />
<property name = "junit.jar" value = "${tools.dir}/junit-4.11.jar" />
<taskdef
name = "jastadd"
classname = "jastadd.JastAddTask"
classpath = "${tools.dir}/jastadd2.jar" />
<taskdef
name = "jflex"
classname = "JFlex.anttask.JFlexTask"
classpath = "${tools.dir}/JFlex.jar" />
<taskdef
name = "beaver"
classname = "beaver.comp.run.AntTask"
classpath = "${tools.dir}/beaver.jar" />
<target name = "build" depends = "gen" >
<javac
debug = "true"
srcdir = "."
classpath = ".:${tools.dir}/junit.jar:${tools.dir}/beaver.jar" />
</target>
<target name="gen">
<jastadd
package = "${package.ast}"
outdir = "."
lineColumnNumbers = "true"
rewrite = "true"
>
<fileset dir = "${spec.dir}" >
<include name = "*.ast" />
<include name = "*.jrag" />
<include name = "*.jadd" />
</fileset>
</jastadd>
<echo message = "Running jflex"/>
<jflex
file = "${spec.dir}/php.flex"
outdir = "${gen.dir}"
nobak = "yes" />
<echo message = "Generating parser phase 1, translating .lalr to .beaver ..."/>
<concat
destfile = "${gen.dir}/${parser.name}.all"
binary = "true"
force = "false" >
<filelist dir = ".">
<file name = "${spec.dir}/preamble.parser" />
<file name = "${spec.dir}/php.parser" />
</filelist>
</concat>
<!-- Running JastAddParser -->
<java
classpath="${tools.dir}/JastAddParser.jar:${tools.dir}/beaver.jar"
classname="Main"
fork="true">
<arg value="--no-beaver-symbol" />
<arg value="${gen.dir}/${parser.name}.all" />
<arg value="${gen.dir}/${parser.name}.beaver" />
</java>
<echo message = "Generating parser phase 2, translating .beaver to .java ..."/>
<beaver
file = "${gen.dir}/${parser.name}.beaver"
terminalNames = "yes"
compress = "no"
useSwitch = "yes" />
</target>
<target name = "clean" >
<delete dir="${test-reports.dir}"/>
<delete dir="${gen.dir}"/>
<delete>
<fileset dir = ".">
<include name= "**/*.class"/>
</fileset>
</delete>
</target>
<target name="test" depends="build" >
<mkdir dir="${test-reports.dir}" />
<junit>
<classpath>
<pathelement path="." />
<pathelement path="${tools.dir}/junit.jar" />
<pathelement path="${tools.dir}/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>
</project>