-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.xml
350 lines (303 loc) · 11.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
<!--
=============================================================================
build.xml (ant build script)
JEP - Java Expression Parser
http://www.singularsys.com/jep
Setting up your system to compile JEP:
- Required: Set the JAVACCHOME environment variable to the location of the
library directory of JavaCC (e.g. C:\apps\javacc\bin\lib)
- Optional: This build file can ensure API compatibility with Java 1.2 by
using the bootclasspath option for cross-compilation when compiling. For
this a Java 1.2 JRE needs to be available on the system. The location
of the JRE is set in the JRE1_2HOME environment variable
(e.g. C:\jre1.2.2). The file {JRE1_2HOME}/lib/rt.jar must exist.
=============================================================================
-->
<project name="JEP" default="compile" basedir=".">
<property name="jep-ver" value="2.4.0"/>
<property name="ext-ver" value="1.1.0"/>
<!-- library locations -->
<property environment="env"/>
<property name="javacchome" value="${env.JAVACCHOME}"/>
<property name="oldjrehome" value="${env.JRE1_2HOME}"/>
<!-- set global properties for this build -->
<property name="src" value="src"/>
<property name="bin" value="bin"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="doc" value="doc"/>
<property name="lib" value="lib"/>
<property name="disttemp" value="disttemp"/>
<property name="jep-jar" value="jep-${jep-ver}.jar"/>
<property name="ext-jar" value="ext-${ext-ver}.jar"/>
<property name="jep-com-bin" value="jep-${jep-ver}-commercial-bin"/>
<property name="jep-com-src" value="jep-${jep-ver}-commercial-src"/>
<property name="jep-ext-com-bin" value="jep-${jep-ver}-ext-${ext-ver}-commercial-bin"/>
<property name="jep-ext-com-src" value="jep-${jep-ver}-ext-${ext-ver}-commercial-src"/>
<property name="jep-ext-gpl" value="jep-${jep-ver}-ext-${ext-ver}-gpl"/>
<property name="classpath" value="${lib}/junit.jar;${lib}/Jama-1.0.2.jar"/>
<property name="bootclasspath" value="${oldjrehome}/lib/rt.jar"/>
<!-- <property name="website" value="website"/> -->
<taskdef name="jjtree"
classname="org.apache.tools.ant.taskdefs.optional.javacc.JJTree" />
<taskdef name="javacc"
classname="org.apache.tools.ant.taskdefs.optional.javacc.JavaCC" />
<!--======================================================================-->
<!-- INIT -->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Echo environment variables -->
<echo message="JAVACCHOME = ${javacchome}"/>
<echo message="JRE1_2HOME = ${oldjrehome}"/>
<echo message="bootclasspath = ${bootclasspath}"/>
<!-- Ensure JavaCC is present -->
<!-- TODO get this working -->
<!-- classpath="${javacchome}/JavaCC.zip"
<available property="javacc.2.present"
classname="COM.sun.labs.javacc.Main">
<classpath>
<pathelement location="${javacchome}/JavaCC.zip"/>
</classpath>
</available>
<available property="javacc.3.present"
classname="org.javacc.parser.Main"
classpath="${javacchome}/javacc.jar" />
<condition property="javacc.present">
<or>
<istrue value="javacc.2.present"/>
<istrue value="javacc.3.present"/>
</or>
</condition>
<condition property="javacc.not.present">
<not>
<istrue value="javacc.present"/>
</not>
</condition>
<antcall target="print.javacc.not.present"/>-->
</target>
<!--
<target name="print.javacc.not.present" if="javacc.not.present">
<echo message="JavaCC 2 or 3 is not present. Parser.jjt will not be processed!"/>
</target>
-->
<!--======================================================================-->
<!-- JJTREE -->
<target name="jjtree" depends="init"><!-- if="javacc.present">
<echo message="javacc.present is true"/>-->
<jjtree
target="${src}/org/nfunk/jep/Parser.jjt"
outputdirectory="${src}/org/nfunk/jep/"
javacchome="${javacchome}"
/>
</target>
<!--======================================================================-->
<!-- JAVACC -->
<target name="javacc" depends="jjtree"><!--if="javacc.present">
<echo message="javacc.present is true"/>-->
<javacc
target="${src}/org/nfunk/jep/Parser.jj"
outputdirectory="${src}/org/nfunk/jep/"
javacchome="${javacchome}"
/>
</target>
<!--======================================================================-->
<!-- JAVACC -->
<target name="jjdoc" depends="javacc">
<mkdir dir="${doc}/grammar"/>
<jjdoc
target="${src}/org/nfunk/jep/Parser.jj"
outputfile="${doc}/grammar/grammar.html"
javacchome="${javacchome}"
/>
<jjdoc
target="${src}/org/nfunk/jep/Parser.jj"
outputfile="${doc}/grammar/grammar.txt"
text="true"
javacchome="${javacchome}"
/>
</target>
<!--======================================================================-->
<!-- COMPILE -->
<!-- Compiles with or without compatibility ensurance-->
<target name="compile" depends="compile-with-ce, compile-without-ce">
</target>
<!-- Compiles without ensuring compatibility if JRE1_2HOME is not set -->
<target name="compile-without-ce" depends="javacc" unless="env.JRE1_2HOME">
<echo message="Compiling without ensuring compatibility"/>
<!-- Create the build directory -->
<mkdir dir="${build}"/>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}"
destdir="${build}"
classpath="${classpath}"
deprecation="on"
source="1.2"
target="1.2"/>
</target>
<!-- Compiles with ensuring compatibility if JRE1_2HOME is set -->
<target name="compile-with-ce" depends="javacc" if="env.JRE1_2HOME">
<!-- Create the build directory -->
<mkdir dir="${build}"/>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}"
destdir="${build}"
classpath="${classpath}"
deprecation="on"
source="1.2"
target="1.2"
bootclasspath="${bootclasspath}"/>
</target>
<!--======================================================================-->
<!-- JAVADOC -->
<target name="javadoc" depends="init">
<delete dir="doc/javadoc"/>
<mkdir dir="doc/javadoc"/>
<javadoc packagenames="org.nfunk.jep.*,org.lsmp.*"
classpath="${classpath}"
sourcepath="src"
destdir="doc/javadoc"
windowtitle="JEP API"
breakiterator="yes"
source="1.4">
<bottom><![CDATA[<A HREF="http://www.singularsys.com/jep" TARGET="_blank">http://www.singularsys.com/jep</A> Copyright © 2006 Singular Systems]]></bottom>
</javadoc>
</target>
<!--======================================================================-->
<!-- JAR -->
<target name="jar" depends="compile">
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- JEP jar without examples or testing classes-->
<jar jarfile="${dist}/${jep-jar}"
basedir="${build}"
includes="org/nfunk/jep/**"/>
<!-- Extensions jar without examples or testing classes -->
<jar jarfile="${dist}/${ext-jar}"
basedir="${build}"
includes="org/lsmp/djep/**"/>
<!-- JEP Examples jar for web site -->
<!-- TODO: DJEP examples as well? -->
<jar jarfile="${dist}/jep-${jep-ver}-withexamples.jar"
basedir="${build}"
includes="org/nfunk/jep/**,org/nfunk/jepexamples/**"/>
</target>
<!--======================================================================-->
<!-- CLEAN -->
<target name="clean">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${doc}/grammar"/>
</target>
<!--======================================================================-->
<!-- FIXEOLS -->
<!-- Sets the EOL characters to Windows format for most files, and UNIX for
bash scripts -->
<target name="fixeols">
<!-- Windows EOL for most files -->
<fixcrlf
srcdir="."
eol="crlf"
eof="asis"
includes="**/*.java, **/*.html, **/*.bat, **/*.txt, **/*.xml"/>
<!-- Unix EOL for shell files -->
<fixcrlf
srcdir="${bin}"
eol="lf"
eof="remove"
includes="**/*.sh"/>
</target>
<!--======================================================================-->
<!-- DIST -->
<!-- Creates five temporary directories to which files are copied.
Then zip files are made from these directories -->
<target name="dist" depends="fixeols,jar,javadoc">
<!-- Create a temp dir for contents of packages-->
<delete dir="${disttemp}" />
<mkdir dir="${disttemp}/${jep-com-src}"/>
<mkdir dir="${disttemp}/${jep-com-bin}"/>
<mkdir dir="${disttemp}/${jep-ext-com-src}"/>
<mkdir dir="${disttemp}/${jep-ext-com-bin}"/>
<mkdir dir="${disttemp}/${jep-ext-gpl}"/>
<!-- Copy src files -->
<!-- define filterset -->
<filterset id="sourcefilters">
<filter token="header" value=" JEP ${jep-ver}, Extensions ${ext-ver}"/>
<filter token="date" value=" ${TODAY}"/>
<filter token="copyright" value=" (c) Copyright 2006, Nathan Funk and Richard Morris"/>
<filter token="license" value=" See LICENSE-*.txt for license information."/>
</filterset>
<!-- copy source files with filter to disttemp -->
<copy todir="${disttemp}">
<fileset dir="."
includes="${src}/**"/>
<filterset refid="sourcefilters"/>
</copy>
<!-- copy common files -->
<copy todir="${disttemp}" enablemultiplemappings="true">
<fileset dir="."
includes="
${doc}/**,
${bin}/**,
${lib}/**,
${dist}/${jep-jar},
build.xml,
CHANGES.txt,
COPYRIGHT.txt,
README.html"/>
<compositemapper>
<globmapper from="*" to="${jep-com-src}/*"/>
<globmapper from="*" to="${jep-com-bin}/*"/>
<globmapper from="*" to="${jep-ext-com-src}/*"/>
<globmapper from="*" to="${jep-ext-com-bin}/*"/>
<globmapper from="*" to="${jep-ext-gpl}/*"/>
</compositemapper>
</copy>
<!-- JEP Commercial Binary ================================== -->
<copy todir="${disttemp}/${jep-com-bin}">
<fileset dir="."
includes="${build}/org/nfunk/**, LICENSE-com-binary.txt"/>
</copy>
<!-- JEP Commercial Source ================================== -->
<copy todir="${disttemp}/${jep-com-src}">
<fileset dir="${disttemp}"
includes="${src}/org/nfunk/**"/>
</copy>
<copy todir="${disttemp}/${jep-com-src}">
<fileset dir="."
includes="${build}/org/nfunk/**, LICENSE-com-source.txt"/>
</copy>
<!-- JEP+EXT Commercial Binary ================================== -->
<copy todir="${disttemp}/${jep-ext-com-bin}">
<fileset dir="."
includes="${build}/**, ${dist}/${ext-jar}, LICENSE-com-binary.txt"/>
</copy>
<!-- JEP+EXT Commercial Source ================================== -->
<copy todir="${disttemp}/${jep-ext-com-src}">
<fileset dir="${disttemp}"
includes="${src}/**"/>
</copy>
<copy todir="${disttemp}/${jep-ext-com-src}">
<fileset dir="."
includes="${build}/**, ${dist}/${ext-jar}, LICENSE-com-source.txt"/>
</copy>
<!-- JEP+EXT GPL ================================================ -->
<copy todir="${disttemp}/${jep-ext-gpl}">
<fileset dir="${disttemp}"
includes="${src}/**"/>
</copy>
<copy todir="${disttemp}/${jep-ext-gpl}">
<fileset dir="."
includes="${build}/**, ${dist}/${ext-jar}, LICENSE-gpl.txt"/>
</copy>
<!-- zip files -->
<zip zipfile="${dist}/${jep-com-bin}.zip" basedir="${disttemp}/${jep-com-bin}" />
<zip zipfile="${dist}/${jep-com-src}.zip" basedir="${disttemp}/${jep-com-src}" />
<zip zipfile="${dist}/${jep-ext-com-bin}.zip" basedir="${disttemp}/${jep-ext-com-bin}" />
<zip zipfile="${dist}/${jep-ext-com-src}.zip" basedir="${disttemp}/${jep-ext-com-src}" />
<zip zipfile="${dist}/${jep-ext-gpl}.zip" basedir="${disttemp}/${jep-ext-gpl}" />
<!-- clean up temporary files
<delete dir="${disttemp}" />-->
</target>
</project>