-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
246 lines (220 loc) · 6.35 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
<!--
$Id: build.xml 57 2009-09-20 21:15:18Z wri $
-->
<project name="parser" default="build" basedir=".">
<!-- Following is the timer task
source: http://www.jeckle.de/freeStuff/AntTimerTask/index.html
-->
<taskdef name="timer"
classname="de.jeckle.AntExtension.Timer"
classpath="lib/att.jar"
/>
<!-- global properties -->
<property name="src" location="src"/>
<property name="grammar" location="grammar"/>
<property name="build" location="build"/>
<property name="tests" location="tests"/>
<property name="lib" location="lib"/>
<property name="log4j" value="log4j-1.2.16.jar" />
<property name="testfile" value="${grammar}/ebnf_test.ebnf"/>
<path id="lib.path">
<fileset dir="lib">
<include name="${log4j}"/>
</fileset>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${build}/gen"/>
<mkdir dir="${build}/class"/>
<mkdir dir="${build}/lib"/>
<mkdir dir="${build}/doc"/>
<mkdir dir="${build}/test"/>
</target>
<target name="compile" depends="init" >
<javac
srcdir="${src}"
destdir="${build}/class"
includeantruntime="false"
>
<classpath refid="lib.path"/>
<!-- don't compile the main test program at this point -->
<exclude name="nl/axizo/EBNF/EBNFMain.java" />
<!-- No Test classes for the regular build -->
<exclude name="nl/axizo/**/*Test.java" />
</javac>
</target>
<target name="build" depends="compile" >
<jar jarfile="${build}/lib/parser.jar" basedir="${build}/class"/>
</target>
<target name="run" depends="build" >
<timer name="run">
<copy file="${src}/log4j.properties"
tofile="${build}/class/log4j.properties"
/>
<java
classname="nl.axizo.EBNF.EBNFInitial"
dir="${build}/gen"
fork="true"
failonerror="true"
>
<arg value="${grammar}/ebnf.ebnf"/>
<classpath>
<!-- Following for log4j.properties -->
<pathelement location="${build}/class"/>
<pathelement location="${build}/lib/parser.jar"/>
<path refid="lib.path"/>
</classpath>
</java>
</timer>
</target>
<target name="parse" depends="build" >
<description>
This task is same as 'run', with the addition
two parameters
</description>
<timer name="run">
<copy file="${src}/log4j.properties"
tofile="${build}/class/log4j.properties"
/>
<java
classname="nl.axizo.EBNF.EBNFInitial"
dir="${build}/gen"
fork="true"
failonerror="true"
>
<arg value="-p"/>
<arg value="nodes_parseonly.txt"/>
<arg value="${grammar}/ebnf.ebnf"/>
<classpath>
<!-- Following for log4j.properties -->
<pathelement location="${build}/class"/>
<pathelement location="${build}/lib/parser.jar"/>
<path refid="lib.path"/>
</classpath>
</java>
</timer>
</target>
<target name="doc" depends="build">
<javadoc
destdir="${build}/doc"
access="private"
>
<doctitle><![CDATA[<h1>Parser Technical Documentation</h1>]]></doctitle>
<fileset dir="${src}">
<exclude name="**/*Test*" />
<exclude name="**/*.properties" />
</fileset>
<fileset dir="${build}/gen" />
<classpath>
<path refid="lib.path"/>
</classpath>
</javadoc>
</target>
<target name="compile_test" depends="run" >
<echo>Compiling test</echo>
<!-- Compile the generated parser -->
<!-- TODO: Check if copying really necessary -->
<copy file="${src}/nl/axizo/EBNF/EBNFMain.java"
tofile="${build}/gen/nl/axizo/EBNF/EBNFMain.java"
/>
<javac destdir="${build}/class"
includeantruntime="false"
>
<src path="${build}/gen"/>
<classpath>
<pathelement location="${dist}/lib/parser.jar"/>
</classpath>
</javac>
</target>
<target name="test" depends="build, compile_test" >
<!-- And run the compiled result -->
<echo>Running test with input ${testfile}</echo>
<timer name="test">
<java
classname="nl.axizo.EBNF.EBNFMain"
dir="${build}/test"
fork="true"
failonerror="true"
>
<!-- Enable following for profiling output - this is the jip profiler -->
<jvmarg value="-javaagent:${lib}/profile.jar" />
<!-- up-dir needed because we start in a subdir -->
<!-- arg value="-p"/>
<arg value="nodes_test.txt"/ -->
<arg value="${testfile}"/>
<classpath>
<path refid="lib.path"/>
<pathelement location="${build}/lib/parser.jar"/>
<pathelement location="${build}/class"/>
</classpath>
</java>
</timer>
</target>
<!-- ************************
* Start Test Suite *
************************ -->
<target name="create_test_suite" depends="compile_test, build" >
<echo>Creating test suite</echo>
<description>Tests use the generated EBNF parser output</description>
<java
classname="nl.axizo.EBNF.EBNFMain"
dir="${build}/test"
fork="true"
failonerror="true"
>
<!-- Enable following for profiling output -->
<!-- jvmarg value="-javaagent:/home/wri/project/lib/jip/profile/profile.jar" / -->
<!-- up-dir needed because we start in a subdir -->
<arg value="${tests}/digits.ebnf"/>
<classpath>
<pathelement location="${build}/lib/parser.jar"/>
<pathelement location="${build}/gen"/>
<path refid="lib.path"/>
</classpath>
</java>
</target>
<!-- TODO: Following does not work yet because junit is
not present on system -->
<target name="test_suite" depends="create_test_suite" >
<echo>Compiling test suite</echo>
<!-- Compile the parsers used for testing -->
<javac destdir="${build}/test"
includeantruntime="false"
>
<src path="${build}/test"/>
<classpath>
<pathelement location="${build}/lib/parser.jar"/>
</classpath>
</javac>
<echo>Compiling the testing classes</echo>
<javac destdir="${build}/test"
includeantruntime="false"
>
<src path="${src}"/>
<include name="**/*Test.java" />
<classpath>
<pathelement location="${dist}/lib/parser.jar"/>
<pathelement location="${build}/test"/>
<path refid="lib.path"/>
</classpath>
</javac>
<echo>Running test suite</echo>
<junit printsummary="yes" fork="yes" haltonfailure="yes" showoutput="yes">
<formatter type="plain"/>
<test name="nl.axizo.test.ParserTest"/>
<classpath>
<pathelement location="${dist}/lib/parser.jar"/>
<pathelement location="${build}/test"/>
</classpath>
</junit>
</target>
<target name="clean" >
<delete includeemptydirs="true">
<fileset dir="${build}">
<include name="**/*" />
</fileset>
</delete>
</target>
</project>