/[cvs]/jsr166/build.xml
ViewVC logotype

Contents of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (show annotations)
Wed May 28 14:09:03 2003 UTC (16 years, 4 months ago) by tim
Branch: MAIN
Changes since 1.28: +21 -36 lines
File MIME type: text/xml
Build native jar separately from emulation jar.

1 <project name="jsr166" default="usage">
2
3 <description>
4 ------------------------------------------------------------------------------
5 Build file for JSR-166
6
7 Usage: ant [target]
8
9 User-specific settings are read from user.properties.
10 See user.properties.sample for examples.
11 ------------------------------------------------------------------------------
12 </description>
13
14 <target name="usage" description="Advises user to run with -projecthelp">
15 <echo>Run "ant -projecthelp" for full usage information.</echo>
16 </target>
17
18
19 <!-- User-specific settings -->
20 <property file="user.properties"/>
21
22
23 <!-- Compilation options -->
24 <property name="build.sourcelevel" value="1.5"/>
25 <property name="build.docsourcelevel" value="1.4"/>
26 <property name="build.debug" value="true"/>
27 <property name="build.debuglevel" value="source,lines,vars"/>
28 <property name="build.deprecation" value="false"/>
29
30 <!-- Build locations -->
31 <property name="build.dir" location="build"/>
32 <property name="build.classes.dir" location="${build.dir}/classes"/>
33 <property name="build.emulation.dir" location="${build.dir}/emulation"/>
34 <property name="build.testcases.dir" location="${build.dir}/testcases"/>
35 <property name="build.lib.dir" location="${build.dir}/lib"/>
36 <property name="build.ant.dir" location="${build.dir}/ant"/>
37 <property name="build.javadocs.dir" location="${build.dir}/javadocs"/>
38 <property name="build.stripped.dir" location="${build.dir}/stripped"/>
39 <property name="build.reports.dir" location="${build.dir}/reports"/>
40 <property name="build.doccheck.dir" location="${build.dir}/doccheck"/>
41 <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
42
43 <!-- Source locations -->
44 <property name="src.dir" location="${basedir}/src/main"/>
45 <property name="emulation.src.dir" location="${basedir}/src/emulation"/>
46 <property name="test.src.dir" location="${basedir}/src/test"/>
47 <property name="ant.src.dir" location="${basedir}/etc/ant"/>
48 <property name="stylesheet.dir" location="${basedir}/etc/xsl"/>
49 <property name="lib.dir" location="${basedir}/lib"/>
50 <property name="dist.dir" location="${basedir}/dist"/>
51
52 <!-- Distribution locations -->
53 <property name="dist.javadocs.dir" location="${dist.dir}/docs"/>
54
55 <!-- Jar locations -->
56 <property name="product.jar" location="${build.lib.dir}/jsr166.jar"/>
57 <property name="javac.jar" location="${lib.dir}/javac.jar"/>
58 <property name="collect.jar" location="${lib.dir}/collect.jar"/>
59 <property name="junit.jar" location="${lib.dir}/junit.jar"/>
60 <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
61
62
63
64 <!--
65 ! Bootclasspath munging for source compilation.
66 -->
67
68 <path id="javac.bootclasspath.prefix">
69 <!-- <pathelement location="${src.dir}"/> -->
70 <pathelement location="${javac.jar}"/>
71 </path>
72
73 <path id="javac.bootclasspath">
74 <!-- <pathelement location="${src.dir}"/> -->
75 <pathelement location="${collect.jar}"/>
76 <pathelement location="${rt.jar}"/>
77 </path>
78
79 <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
80 <property name="javac.bootclasspath.prefix" refid="javac.bootclasspath.prefix"/>
81
82 <!-- Turn the flattened bootclasspath prefix into a javac argument -->
83 <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>
84
85
86
87 <!--
88 ! Bootclasspath munging for testing, so JUnit can test our local
89 ! modifications to java.*.
90 -->
91
92 <path id="test.classpath">
93 <pathelement location="${product.jar}"/>
94 <pathelement location="${build.testcases.dir}"/>
95 <pathelement location="${junit.jar}"/>
96 </path>
97
98 <!-- Flatten test classpath into a platform-appropriate string -->
99 <property name="test.classpath" refid="test.classpath"/>
100
101 <!-- Turn the flattened test classpath into a javac argument -->
102 <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>
103
104
105
106 <!-- Files excluded from emulation and dist-docs -->
107 <patternset id="emulation.excludes">
108 <exclude name="java/util/Random.*"/>
109 <exclude name="sun/misc/Unsafe.*"/>
110 </patternset>
111
112
113
114 <!-- Main targets -->
115
116 <target name="compile"
117 depends="init"
118 description="Compiles main sources to build folder">
119
120 <mkdir dir="${build.classes.dir}"/>
121
122 <javac srcdir="${src.dir}"
123 destdir="${build.classes.dir}"
124 debug="${build.debug}"
125 debuglevel="${build.debuglevel}"
126 deprecation="${build.deprecation}"
127 source="${build.sourcelevel}"
128 fork="true">
129
130 <bootclasspath refid="javac.bootclasspath"/>
131 <compilerarg line="${javac.args} ${build.warnings.option}"/>
132
133 </javac>
134
135 </target>
136
137
138 <target name="jar"
139 depends="native-jar, emulation-jar"
140 description="Builds library jar from compiled sources"/>
141
142
143 <target name="test"
144 depends="init, check-junit, report-tests"
145 description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
146
147
148 <target name="checkstyle"
149 depends="filter-src"
150 description="Reports on style errors in Java source (verbose, mostly chaff)">
151
152 <taskdef resource="checkstyletask.properties"
153 classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
154
155 <checkstyle>
156 <formatter type="plain"/> <!-- also available: type="xml" -->
157 <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
158 </checkstyle>
159
160 </target>
161
162
163 <target name="doccheck"
164 depends="filter-src"
165 description="Reports on javadoc style errors (not working yet)">
166
167 <delete dir="${build.doccheck.dir}"/>
168 <mkdir dir="${build.doccheck.dir}"/>
169
170 <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
171 docletpath="${lib.dir}/doccheck.jar"
172 destdir="${build.doccheck.dir}">
173 <packageset dir="${build.filter.src.dir}"/>
174 </javadoc>
175
176 </target>
177
178
179 <target name="docs"
180 depends="filter-src"
181 description="Builds javadocs with custom tags to build folder">
182
183 <delete dir="${build.javadocs.dir}"/>
184 <mkdir dir="${build.javadocs.dir}"/>
185
186 <javadoc destdir="${build.javadocs.dir}"
187 link="http://java.sun.com/j2se/1.4.1/docs/api"
188 overview="${src.dir}/intro.html"
189 source="${build.docsourcelevel}">
190
191 <tag name="revised" description="Last revised:"/>
192 <tag name="spec" description="Specified by:"/>
193 <tag name="editor" description="Last edited by:"/>
194 <tag name="fixme" description="FIX ME:"/>
195
196 <packageset dir="${build.filter.src.dir}"/>
197
198 </javadoc>
199
200 </target>
201
202
203 <!--
204 # javac -s doesn't reliably generate compilable code. It generates
205 # bridge methods (marked as "synthetic") that can have identical
206 # signatures to existing methods except for the return value.
207 -->
208 <target name="strip"
209 depends="init">
210
211 <mkdir dir="${build.stripped.dir}"/>
212
213 <javac srcdir="${src.dir}"
214 destdir="${build.stripped.dir}"
215 debug="${build.debug}"
216 debuglevel="${build.debuglevel}"
217 deprecation="${build.deprecation}"
218 source="${build.sourcelevel}"
219 fork="true">
220
221 <bootclasspath refid="javac.bootclasspath"/>
222 <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
223
224 </javac>
225
226 </target>
227
228
229 <target name="dist"
230 depends="init, dist-clean, dist-jar, dist-docs"
231 description="Puts all distributable products in single hierarchy"/>
232
233
234 <target name="clean"
235 description="Removes all build products">
236
237 <delete dir="${build.dir}"/>
238 <delete dir="${build.classes.dir}"/>
239 <delete dir="${build.lib.dir}"/>
240
241 </target>
242
243
244 <target name="dist-clean"
245 description="Removes all build and distribution products">
246
247 <delete dir="${dist.dir}"/>
248
249 </target>
250
251
252 <target name="dist-docs"
253 depends="filter-src"
254 description="Builds javadocs without custom tags to dist folder">
255
256 <delete dir="${dist.javadocs.dir}"/>
257 <mkdir dir="${dist.javadocs.dir}"/>
258
259 <javadoc destdir="${dist.javadocs.dir}"
260 link="http://java.sun.com/j2se/1.4.1/docs/api"
261 overview="${src.dir}/intro.html"
262 source="${build.docsourcelevel}">
263
264 <packageset dir="${build.filter.src.dir}"/>
265
266 </javadoc>
267
268 </target>
269
270
271
272 <!-- Internal targets -->
273
274 <target name="set-warnings-if" if="build.warnings">
275
276 <property name="build.warnings.option" value="-warnunchecked"/>
277
278 </target>
279
280
281 <target name="set-warnings-unless" unless="build.warnings">
282
283 <property name="build.warnings.option" value=""/>
284
285 </target>
286
287
288 <target name="init"
289 depends="set-warnings-if, set-warnings-unless">
290
291 <!-- Version is kept in a separate file -->
292 <loadfile property="version" srcFile="version.properties"/>
293 <echo>Building JSR-166 version ${version}</echo>
294
295 </target>
296
297
298 <target name="init-jar">
299
300 <mkdir dir="${build.lib.dir}"/>
301
302 </target>
303
304
305 <target name="native-jar"
306 depends="compile, init-jar"
307 unless="build.emulation">
308
309 <jar destfile="${product.jar}">
310 <fileset dir="${build.classes.dir}"/>
311 </jar>
312
313 </target>
314
315
316 <target name="base-jar"
317 depends="compile, init-jar">
318
319 </target>
320
321
322 <target name="compile-emulation"
323 depends="init"
324 if="build.emulation">
325
326 <mkdir dir="${build.emulation.dir}"/>
327
328 <javac srcdir="${emulation.src.dir}"
329 destdir="${build.emulation.dir}"
330 debug="${build.debug}"
331 debuglevel="${build.debuglevel}"
332 deprecation="${build.deprecation}"
333 source="${build.sourcelevel}"
334 fork="true">
335
336 <bootclasspath refid="javac.bootclasspath"/>
337 <compilerarg line="${javac.args} ${build.warnings.option}"/>
338
339 </javac>
340
341 </target>
342
343
344 <target name="emulation-jar"
345 depends="init-jar, compile-emulation"
346 if="build.emulation">
347
348
349 <jar destfile="${product.jar}" duplicate="add">
350 <fileset dir="${build.classes.dir}">
351 <patternset refid="emulation.excludes"/>
352 </fileset>
353 <fileset dir="${build.emulation.dir}"/>
354 </jar>
355
356 </target>
357
358
359 <target name="dist-jar"
360 depends="clean, jar">
361
362 <copy file="${product.jar}" todir="${dist.dir}"/>
363
364 </target>
365
366
367 <target name="compile-ant-filter"
368 depends="init">
369
370 <mkdir dir="${build.ant.dir}"/>
371
372 <javac srcdir="${ant.src.dir}"
373 destdir="${build.ant.dir}"
374 source="1.4"
375 />
376
377 </target>
378
379
380 <target name="filter-src"
381 depends="compile-ant-filter">
382
383 <mkdir dir="${build.filter.src.dir}"/>
384
385 <copy todir="${build.filter.src.dir}">
386 <fileset dir="${src.dir}">
387 <patternset refid="emulation.excludes"/>
388 </fileset>
389 <filterchain>
390 <filterreader classname="jsr166.ant.filters.ReplaceFilter"
391 classpath="${build.ant.dir}">
392 <!--
393 # These arguments are to get rid of angle-bracketed type
394 # parameters so that javadoc can run on the result. The
395 # following heuristic that seems to work:
396 #
397 # For all lines not starting with space(s)-asterisk-space(s),
398 # replace <something> with a space, where there may be more
399 # than one right angle bracket at the end, and "something"
400 # must not contain parens or pipes. (This may need some
401 # tweaking.)
402 -->
403 <param name="notmatching" value="^\s+\*\s.*$"/>
404 <param name="pattern" value="&lt;[^|>()]+?>+"/>
405 <param name="replacement" value=" "/>
406 </filterreader>
407 <filterreader classname="jsr166.ant.filters.ReplaceFilter"
408 classpath="${build.ant.dir}">
409 <!--
410 # These arguments are to uncomment lines beginning with
411 # "//@" so that javadoc can see imports that are needed
412 # to resolve links but that shouldn't be in the compiled
413 # code.
414 -->
415 <param name="matching" value="^//@.*$"/>
416 <param name="pattern" value="^//@"/>
417 <param name="replacement" value=""/>
418 </filterreader>
419 </filterchain>
420 </copy>
421
422 </target>
423
424
425 <target name="compile-tests"
426 depends="jar">
427
428 <mkdir dir="${build.testcases.dir}"/>
429
430 <javac srcdir="${test.src.dir}"
431 destdir="${build.testcases.dir}"
432 debug="${build.debug}"
433 debuglevel="${build.debuglevel}"
434 deprecation="${build.deprecation}"
435 source="${build.sourcelevel}"
436 fork="true">
437
438 <bootclasspath refid="javac.bootclasspath"/>
439 <compilerarg line="${javac.args} ${build.warnings.option}"/>
440 <classpath refid="test.classpath"/>
441
442 </javac>
443
444 </target>
445
446
447 <target name="run-tests"
448 depends="compile-tests">
449
450 <!-- May be overridden by user.properties -->
451 <property name="testcase" value="*"/>
452
453 <mkdir dir="${build.reports.dir}"/>
454
455 <junit printsummary="true"
456 showoutput="true"
457 errorProperty="junit.failed"
458 failureProperty="junit.failed"
459 dir="${build.reports.dir}"
460 fork="true">
461
462 <jvmarg value="${test.javac.args}"/>
463
464 <formatter type="xml"/>
465
466 <batchtest todir="${build.reports.dir}">
467 <fileset dir="${test.src.dir}">
468 <include name="**/${testcase}Test.java"/>
469 </fileset>
470 </batchtest>
471
472 </junit>
473
474 </target>
475
476
477 <target name="report-tests"
478 depends="run-tests">
479
480 <!-- Sets junit.report.format to frames if Xalan is present,
481 otherwise sets it to noframes. -->
482 <available property="junit.report.format"
483 value="frames"
484 classname="org.apache.xalan.lib.Redirect"
485 />
486 <property name="junit.report.format" value="noframes"/>
487
488 <junitreport todir="${build.reports.dir}">
489 <fileset dir="${build.reports.dir}">
490 <include name="TEST-*.xml"/>
491 </fileset>
492 <report styledir="${stylesheet.dir}"
493 format="${junit.report.format}"
494 todir="${build.reports.dir}"
495 />
496 </junitreport>
497
498 <fail message="Test Cases Failed" if="junit.failed"/>
499
500 </target>
501
502
503 <target name="check-junit">
504
505 <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
506 <available property="junit.available"
507 classname="junit.framework.Protectable"/>
508
509 <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
510 unless="junit.available"/>
511
512 </target>
513
514
515
516 <!-- Anthill targets -->
517
518 <target name="anthill-build"
519 depends="jar, test, docs, dist-docs"/>
520
521 <target name="anthill-publish">
522
523 <copy todir="${deployDir}/docs/private">
524 <fileset dir="${build.javadocs.dir}"/>
525 </copy>
526
527 <copy todir="${deployDir}/docs/public">
528 <fileset dir="${dist.javadocs.dir}"/>
529 </copy>
530
531 <copy tofile="${deployDir}/index.html"
532 file="${basedir}/etc/anthill-index.html"/>
533
534 <copy todir="${deployDir}/notes">
535 <fileset dir="${basedir}/etc/notes"/>
536 </copy>
537
538 </target>
539
540
541 </project>

dl@cs.oswego.edu
ViewVC Help
Powered by ViewVC 1.1.27