-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.xml
426 lines (349 loc) · 18.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
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Master Build file for BSF
Notes:
This is the build file for use with the Jakarta Ant build tool.
Optional additions:
Rhino -> http://www.mozilla.org/rhino/
NetRexx -> http://www2.hursley.ibm.com/netrexx/
Jython -> http://www.jython.org/
Jacl -> http://www.scriptics.com/java/
Xalan -> http://xml.apache.org/xalan/
ASF (Win32) -> http://msdn.microsoft.com/scripting/ (currently unsupported)
PerlScript -> http://www.activestate.com/ (currently unsupported)
BeanShell -> http://www.beanshell.org/ (3rd party BSF engine)
JRuby -> http://www.jruby.org/ (3rd party BSF engine)
JudoScript -> http://www.judoscript.com/ (3rd party BSF engine)
Build Instructions:
To build, run
java org.apache.tools.ant.Main <target>
on the directory where this file is located with the target you want.
Most useful targets:
- compile -> creates the "bsf.jar" package in "./build/lib" (default target)
- samples -> creates/compiles the samples into "./build/samples"
- javadocs -> creates the javadocs in "./build/javadocs"
- build-site -> creates the website in "./docs"
- bindist -> creates the complete binary distribution in "./dist/"
- srcdist -> creates the complete src distribution in "./dist/"
- dist -> creates both the binary and the src distributions in "./dist/"
- all -> creates the binary and src distributions, and builds the site
- clean -> removes all the generated files and directories
Authors:
Sam Ruby <[email protected]>
Matthew J. Duftler <[email protected]>
Victor J. Orlikowski <[email protected]>
Charles Murcko <[email protected]>
Olivier Gruber <[email protected]>
Copyright:
Copyright (c) Apache Software Foundation 2004-2006. All Rights Reserved
==================================================================== -->
<project name="BSF Build" default="compile" basedir=".">
<property name="build.properties.file" value="build-properties.xml"/>
<import file="${build.properties.file}" />
<!-- =================================================================== -->
<!-- Source files to be compiled -->
<!-- =================================================================== -->
<patternset id="java.source.files">
<!-- Optionally includes engines based on dependencies being present -->
<include name="**/bsf/*.java" />
<include name="**/util/**/*.java" />
<include name="**/jacl/**" if="jacl.present" />
<include name="**/javascript/**" if="rhino.present" />
<include name="**/jexl/**" if="jexl.present" />
<include name="**/jython/**" if="jython.present" />
<include name="**/netrexx/**" if="netrexx.present" />
<include name="**/xslt/**" if="xalan.present" />
<include name="**/test/**" if="junit.present" />
</patternset>
<path id="compile.classpath">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
<pathelement location="${build.dest}" />
</path>
<path id="test.classpath">
<path refid="compile.classpath"/>
<pathelement location="${build.tests}"/>
</path>
<target name="init" depends="clean">
<tstamp />
<!-- ================================================================= -->
<!-- Sets version and time/date specific values -->
<!-- ================================================================= -->
<filter token="RELEASE_DATE_TIME" value="${TODAY} / ${TSTAMP}" />
<filter token="VERSION" value="${project.version}" />
</target>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}" />
<!-- ================================================================= -->
<!-- Determines what optional components are available -->
<!-- ================================================================= -->
<available property="jacl.present" classpathref="compile.classpath" classname="tcl.lang.JACL" />
<available property="jexl.present" classpathref="compile.classpath" classname="org.apache.commons.jexl.Script" />
<available property="jython.present" classpathref="compile.classpath" classname="org.python.util.jython" />
<available property="netrexx.present" classpathref="compile.classpath" classname="netrexx.lang.Rexx" />
<available property="rhino.present" classpathref="compile.classpath" classname="org.mozilla.javascript.Scriptable" />
<available property="xalan.present" classpathref="compile.classpath" classname="org.apache.xalan.xslt.EnvironmentCheck" />
<available property="junit.present" classpathref="compile.classpath" classname="junit.framework.TestCase" />
<uptodate property="javac.notRequired" targetfile="${build.lib}/${project.name}.jar">
<srcfiles dir="${src.dir}">
<patternset refid="javac.source.files" />
</srcfiles>
</uptodate>
<uptodate property="javadoc.required" targetfile="${build.lib}/${project.name}.jar">
<srcfiles dir="${build.dir}" includes="**/*.html" />
</uptodate>
<antcall target="checkDependencies" />
</target>
<!-- =================================================================== -->
<!-- Prepares the site build process -->
<!-- =================================================================== -->
<target name="prepare-site" depends="init">
<path id="anakia.classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar" />
</fileset>
</path>
<available property="AnakiaTask.present" classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="anakia.classpath" />
</available>
<antcall target="checkAnakiaTask" />
</target>
<!-- =================================================================== -->
<!-- Warn the user about items not present, for whatever purpose. -->
<!-- =================================================================== -->
<target name="checkJacl" unless="jacl.present">
<echo message="Warning: Jacl dependencies were not resolved." />
</target>
<target name="checkJexl" unless="jexl.present">
<echo message="Warning: JEXL dependencies were not resolved." />
</target>
<target name="checkJython" unless="jython.present">
<echo message="Warning: Jython dependencies were not resolved." />
</target>
<target name="checkNetRexx" unless="netrexx.present">
<echo message="Warning: NetRexx dependencies were not resolved." />
</target>
<target name="checkRhino" unless="rhino.present">
<echo message="Warning: Rhino dependencies were not resolved." />
</target>
<target name="checkXalan" unless="xalan.present">
<echo message="Warning: Xalan dependencies were not resolved." />
</target>
<target name="checkAnakiaTask" unless="AnakiaTask.present">
<echo>
Warning: AnakiaTask not present!
Please ensure that velocity.jar is in your classpath.
Documentation will not be generated.
</echo>
</target>
<target name="checkJUnit" unless="junit.present">
<echo message="Warning: JUnit dependencies were not resolved." />
</target>
<target name="checkDependencies" unless="javac.notRequired">
<antcall target="checkJacl" />
<antcall target="checkJexl" />
<antcall target="checkJython" />
<antcall target="checkNetRexx" />
<antcall target="checkRhino" />
<antcall target="checkXalan" />
<antcall target="checkJUnit" />
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" description="Compiles the BSF *.java files." depends="prepare">
<mkdir dir="${build.dest}"/>
<javac srcdir="${src.dir}" destdir="${build.dest}" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</classpath>
<patternset refid="java.source.files"/>
</javac>
</target>
<!-- ================================================================= -->
<!-- Produces the jar file -->
<!-- ================================================================= -->
<target name="jar" depends="compile" description="Produces the jar file and copies to ${build.lib}">
<mkdir dir="${build.lib}" />
<copy todir="${build.dest}">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
<mkdir dir="${build.dest}/META-INF" />
<copy todir="${build.dest}/META-INF">
<fileset dir="${basedir}">
<include name="**/LICENSE.txt" />
<include name="**/NOTICE.txt" />
</fileset>
</copy>
<jar jarfile="${build.lib}/${project.name}.jar" basedir="${build.dest}" />
<uptodate property="javadoc.required" targetfile="${build.lib}/${project.name}.jar">
<srcfiles dir="${build.dir}" includes="**/*.html" />
</uptodate>
</target>
<!-- =================================================================== -->
<!-- Compiles the samples -->
<!-- =================================================================== -->
<target name="samples" description="Compiles the samples." depends="jar">
<copy todir="${build.samples}">
<fileset dir="${samples.dir}" />
</copy>
<javac srcdir="${build.samples.calc}" destdir="${build.samples.calc}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" />
<javac srcdir="${build.samples.scriptedui}" destdir="${build.samples.scriptedui}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" />
<javac srcdir="${build.samples.xsl}" destdir="${build.samples.xsl}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" />
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" description="Generates the API documentation." depends="compile">
<mkdir dir="${build.javadocs}" />
<!-- FIXME: Excluding some packages temporarily -->
<javadoc packagenames="${packages}" failonerror="true" excludepackagenames="org.apache.bsf.engines.java, org.apache.bsf.engines.javaclass" destdir="${build.javadocs}" author="true" version="false" use="true" windowtitle="${project.fullName} API" doctitle="${project.fullName}" source="${source.level}" additionalparam="-Xdoclint:none">
<classpath refid="compile.classpath" />
<fileset dir="${src.dir}">
<patternset refid="java.source.files"></patternset>
</fileset>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Creates the website -->
<!-- =================================================================== -->
<target name="build-site" if="AnakiaTask.present" description="Generates the website." depends="prepare-site">
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="anakia.classpath" />
</taskdef>
<anakia basedir="${site.src}" destdir="${site.dest}/" extension=".html" style="./site.vsl" projectFile="${site.projectFile}" excludes="**/stylesheets/**" includes="**/*.xml" lastModifiedCheck="false" templatePath="${templ.path}" velocityPropertiesFile="${velocity.props}"/>
<!--anakia basedir="${site.src}" destdir="${site.dest}/" extension=".html" style="./faq.vsl" projectFile="${site.projectFile}" includes="faq.xml" lastModifiedCheck="false" templatePath="${templ.path}" velocityPropertiesFile="${velocity.props}"/-->
<fixcrlf srcdir="${site.dest}/" includes="**/*.html" fixlast="false"/>
<copy todir="${site.dest}/images" filtering="no">
<fileset dir="${site.images}">
<include name="**/*.gif" />
<include name="**/*.jpeg" />
<include name="**/*.jpg" />
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Creates the binary distribution -->
<!-- =================================================================== -->
<target name="bindist" description="Creates the binary distribution(s)." depends="javadocs, samples">
<copy todir="${dist.dir.root}/docs/api">
<fileset dir="${build.javadocs}" />
</copy>
<copy todir="${dist.dir.root}/lib">
<fileset dir="${build.lib}" />
</copy>
<copy todir="${dist.dir.root}/samples">
<fileset dir="${build.samples}" />
</copy>
<copy file="AUTHORS.txt" tofile="${dist.dir.root}/AUTHORS.txt" />
<copy file="CHANGES.txt" tofile="${dist.dir.root}/CHANGES.txt" />
<copy file="INSTALL.txt" tofile="${dist.dir.root}/INSTALL.txt" />
<copy file="LICENSE.txt" tofile="${dist.dir.root}/LICENSE.txt" />
<copy file="NOTICE.txt" tofile="${dist.dir.root}/NOTICE.txt" />
<copy file="README.txt" tofile="${dist.dir.root}/README.txt" />
<copy file="RELEASE-NOTE.txt" tofile="${dist.dir.root}/RELEASE-NOTE.txt" />
<copy file="TODO.txt" tofile="${dist.dir.root}/TODO.txt" />
<!-- ================================================================= -->
<!-- Produces the tar/gzip file -->
<!-- ================================================================= -->
<tar tarfile="${dist.bin.file}.tar" basedir="${dist.dir}" excludes="*.zip,*.tar,*.gz" />
<gzip src="${dist.bin.file}.tar" zipfile="${dist.bin.file}.tar.gz" />
<delete file="${dist.bin.file}.tar" />
<!-- ================================================================= -->
<!-- Produces the zip file -->
<!-- ================================================================= -->
<zip zipfile="${dist.bin.file}.zip" basedir="${dist.dir}" excludes="*.zip,*.tar,*.gz" />
</target>
<!-- =================================================================== -->
<!-- Creates the source distribution -->
<!-- =================================================================== -->
<target name="srcdist" description="Creates the source distribution(s)." depends="init">
<copy todir="${dist.dir.root}/src">
<fileset dir="${src.dir}" />
</copy>
<copy file="AUTHORS.txt" tofile="${dist.dir.root}/AUTHORS.txt" />
<copy file="BUILDING.txt" tofile="${dist.dir.root}/BUILDING.txt" />
<copy file="CHANGES.txt" tofile="${dist.dir.root}/CHANGES.txt" />
<copy file="INSTALL.txt" tofile="${dist.dir.root}/INSTALL.txt" />
<copy file="LICENSE.txt" tofile="${dist.dir.root}/LICENSE.txt" />
<copy file="NOTICE.txt" tofile="${dist.dir.root}/NOTICE.txt" />
<copy file="README.txt" tofile="${dist.dir.root}/README.txt" />
<copy file="RELEASE-NOTE.txt" tofile="${dist.dir.root}/RELEASE-NOTE.txt" />
<copy file="TODO.txt" tofile="${dist.dir.root}/TODO.txt" />
<copy file="${build.file}" tofile="${dist.dir.root}/${build.file}" />
<copy file="${build.properties.file}" tofile="${dist.dir.root}/${build.properties.file}" />
<!-- ================================================================= -->
<!-- Produces the tar/gzip file -->
<!-- ================================================================= -->
<tar tarfile="${dist.src.file}.tar" basedir="${dist.dir}" excludes="*.zip,*.tar,*.gz" />
<gzip src="${dist.src.file}.tar" zipfile="${dist.src.file}.tar.gz" />
<delete file="${dist.src.file}.tar" />
<!-- ================================================================= -->
<!-- Produces the zip file -->
<!-- ================================================================= -->
<zip zipfile="${dist.src.file}.zip" basedir="${dist.dir}/" excludes="*.zip,*.tar,*.gz" />
</target>
<!-- =================================================================== -->
<!-- Compile unit tests -->
<!-- =================================================================== -->
<target name="compile-test" if="junit.present" depends="compile">
<mkdir dir="${build.tests}" />
<javac srcdir="${tests.dir}" destdir="${build.tests}" source="${source.level}">
<classpath>
<fileset dir="lib">
<include name="junit*.jar"/>
</fileset>
<pathelement location="${build.dest}" />
</classpath>
</javac>
</target>
<!-- =================================================================== -->
<!-- Performs unit tests -->
<!-- =================================================================== -->
<target name="test" if="junit.present" description="Performs unit tests on BSF." depends="compile-test">
<copy todir="${build.dest}" overwrite="true">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
<junit>
<classpath refid="test.classpath" />
<formatter type="brief" usefile="false" />
<test name="org.apache.bsf.BSFTest" />
</junit>
</target>
<!-- =================================================================== -->
<!-- Creates both distributions -->
<!-- =================================================================== -->
<target name="dist" description="Executes both bindist and srcdist." depends="bindist, srcdist" />
<!-- =================================================================== -->
<!-- Cleans everything -->
<!-- =================================================================== -->
<target name="clean" description="Removes build and dist directories.">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="all" depends="build-site, dist" />
</project>