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

Annotation of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.30 - (hide annotations)
Wed May 28 14:19:25 2003 UTC (16 years, 5 months ago) by tim
Branch: MAIN
Changes since 1.29: +16 -12 lines
File MIME type: text/xml
Windows uses emulation by default.

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

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