ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
Revision: 1.27
Committed: Wed May 28 00:33:17 2003 UTC (20 years, 11 months ago) by tim
Content type: text/xml
Branch: MAIN
Changes since 1.26: +135 -22 lines
Log Message:
Emulation classes available by setting build.emulation property.
Dist-docs hides non-JSR166 classes, Random and Unsafe.

File Contents

# User Rev Content
1 tim 1.18 <project name="jsr166" default="usage">
2 tim 1.1
3     <description>
4 tim 1.18 Build file for JSR-166
5    
6 tim 1.27 JUnit 3.8 or better must be in ${ant.home}/lib for the test target to work.
7 tim 1.18 </description>
8 tim 1.11
9 tim 1.3
10 tim 1.18 <target name="usage" description="Prints this message">
11     <echo>
12     ant [target], where target is one of:
13    
14     usage (default) Prints this message
15     compile Compiles all sources to build folder
16     jar Builds library jar from compiled sources
17     test Runs all tests (requires JUnit 1.8 in ${ant.home}/lib)
18     docs Builds javadocs with custom tags to build folder
19     dist-docs Builds javadocs without custom tags to dist folder
20     dist Puts all distributable products in single hierarchy
21    
22     clean Removes all build products
23     dist-clean Removes all build and distribution products
24    
25     checkstyle Reports on style errors in Java source (verbose, mostly chaff)
26     doccheck Reports on javadoc style errors (not working yet)
27     </echo>
28     </target>
29 tim 1.11
30 tim 1.27 <!-- User-specific settings -->
31 tim 1.23 <property file="user.properties"/>
32 tim 1.27
33     <!-- Set build.warnings in user.properties to turn on -warnunchecked -->
34     <!-- <property name="build.warnings" value=""/> -->
35    
36 tim 1.1
37     <!-- Compilation options -->
38 tim 1.11 <property name="build.sourcelevel" value="1.5"/>
39 tim 1.25 <property name="build.docsourcelevel" value="1.4"/>
40 tim 1.1 <property name="build.debug" value="true"/>
41     <property name="build.debuglevel" value="source,lines,vars"/>
42 tim 1.13 <property name="build.deprecation" value="false"/>
43 tim 1.1
44     <!-- Build locations -->
45     <property name="build.dir" location="build"/>
46     <property name="build.classes.dir" location="${build.dir}/classes"/>
47 tim 1.27 <property name="build.emulation.dir" location="${build.dir}/emulation"/>
48 tim 1.1 <property name="build.testcases.dir" location="${build.dir}/testcases"/>
49     <property name="build.lib.dir" location="${build.dir}/lib"/>
50     <property name="build.ant.dir" location="${build.dir}/ant"/>
51 tim 1.9 <property name="build.javadocs.dir" location="${build.dir}/javadocs"/>
52 tim 1.16 <property name="build.stripped.dir" location="${build.dir}/stripped"/>
53 tim 1.1 <property name="build.reports.dir" location="${build.dir}/reports"/>
54 tim 1.16 <property name="build.doccheck.dir" location="${build.dir}/doccheck"/>
55 tim 1.1 <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
56    
57     <!-- Source locations -->
58 tim 1.22 <property name="src.dir" location="${basedir}/src/main"/>
59 tim 1.27 <property name="emulation.src.dir" location="${basedir}/src/emulation"/>
60 tim 1.22 <property name="test.src.dir" location="${basedir}/src/test"/>
61 tim 1.1 <property name="ant.src.dir" location="${basedir}/etc/ant"/>
62     <property name="stylesheet.dir" location="${basedir}/etc/xsl"/>
63     <property name="lib.dir" location="${basedir}/lib"/>
64 tim 1.9 <property name="dist.dir" location="${basedir}/dist"/>
65    
66     <!-- Distribution locations -->
67     <property name="dist.javadocs.dir" location="${dist.dir}/docs"/>
68 tim 1.1
69     <!-- Jar locations -->
70     <property name="product.jar" location="${build.lib.dir}/jsr166.jar"/>
71     <property name="javac.jar" location="${lib.dir}/javac.jar"/>
72     <property name="collect.jar" location="${lib.dir}/collect.jar"/>
73     <property name="junit.jar" location="${lib.dir}/junit.jar"/>
74     <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
75    
76 tim 1.27
77     <!--
78     ! Bootclasspath munging for source compilation.
79     -->
80    
81     <path id="javac.bootclasspath.prepend">
82     <!-- <pathelement location="${src.dir}"/> -->
83     <pathelement location="${javac.jar}"/>
84     </path>
85 tim 1.1
86 tim 1.11 <path id="javac.bootclasspath">
87 tim 1.27 <!-- <pathelement location="${src.dir}"/> -->
88 tim 1.2 <pathelement location="${collect.jar}"/>
89     <pathelement location="${rt.jar}"/>
90     </path>
91    
92 tim 1.27 <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
93     <property name="javac.bootclasspath.prepend" refid="javac.bootclasspath.prepend"/>
94    
95     <!-- Turn the flattened bootclasspath prefix into a javac argument -->
96     <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prepend}'/>
97    
98    
99     <!--
100     ! Bootclasspath munging for testing, so JUnit can test our local
101     ! modifications to java.*.
102     -->
103    
104 tim 1.2 <path id="test.classpath">
105     <pathelement location="${product.jar}"/>
106 tim 1.27 <pathelement location="${build.testcases.dir}"/>
107     <pathelement location="${junit.jar}"/>
108 tim 1.2 </path>
109    
110 tim 1.27 <!-- Flatten test classpath into a platform-appropriate string -->
111     <property name="test.classpath" refid="test.classpath"/>
112    
113     <!-- Turn the flattened test classpath into a javac argument -->
114     <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>
115    
116    
117 tim 1.1
118 tim 1.11 <!-- Main targets -->
119    
120     <target name="compile" depends="init"
121 tim 1.27 description="Compiles main sources to build folder">
122    
123 tim 1.1 <mkdir dir="${build.classes.dir}"/>
124 tim 1.27
125 tim 1.1 <javac srcdir="${src.dir}"
126     destdir="${build.classes.dir}"
127     debug="${build.debug}"
128     debuglevel="${build.debuglevel}"
129     deprecation="${build.deprecation}"
130     source="${build.sourcelevel}"
131     fork="true">
132    
133 tim 1.11 <bootclasspath refid="javac.bootclasspath"/>
134     <compilerarg line="${javac.args} ${build.warnings.option}"/>
135 tim 1.1
136     </javac>
137 tim 1.27
138 tim 1.1 </target>
139    
140    
141 tim 1.27 <target name="jar" depends="native-jar, emulation-jar"/>
142 tim 1.1
143    
144 tim 1.18 <target name="test" depends="init, check-junit, report-tests"
145 tim 1.27 description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)"
146     />
147 tim 1.1
148    
149 tim 1.16 <target name="checkstyle" 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     <target name="doccheck" depends="filter-src"
164 tim 1.18 description="Reports on javadoc style errors (not working yet)">
165 tim 1.27
166 tim 1.16 <delete dir="${build.doccheck.dir}"/>
167     <mkdir dir="${build.doccheck.dir}"/>
168 tim 1.27
169 tim 1.16 <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
170     docletpath="${lib.dir}/doccheck.jar"
171     destdir="${build.doccheck.dir}">
172 tim 1.22 <packageset dir="${build.filter.src.dir}"/>
173 tim 1.16 </javadoc>
174 tim 1.27
175 tim 1.16 </target>
176    
177    
178     <target name="docs" depends="filter-src"
179 tim 1.9 description="Builds javadocs with custom tags to build folder">
180 tim 1.27
181 tim 1.9 <delete dir="${build.javadocs.dir}"/>
182     <mkdir dir="${build.javadocs.dir}"/>
183 tim 1.27
184 tim 1.9 <javadoc destdir="${build.javadocs.dir}"
185 tim 1.8 link="http://java.sun.com/j2se/1.4.1/docs/api"
186     overview="${src.dir}/intro.html"
187 dholmes 1.24 source="${build.docsourcelevel}">
188 tim 1.8
189 tim 1.9 <tag name="revised" description="Last revised:"/>
190     <tag name="spec" description="Specified by:"/>
191     <tag name="editor" description="Last edited by:"/>
192     <tag name="fixme" description="FIX ME:"/>
193 tim 1.22 <packageset dir="${build.filter.src.dir}"/>
194 tim 1.8
195     </javadoc>
196 tim 1.27
197 tim 1.8 </target>
198    
199    
200 tim 1.22 <!--
201     # javac -s doesn't reliably generate compilable code. It generates
202     # bridge methods (marked as "synthetic") that can have identical
203     # signatures to existing methods except for the return value.
204     -->
205 tim 1.16 <target name="strip" depends="init">
206 tim 1.27
207 tim 1.16 <mkdir dir="${build.stripped.dir}"/>
208 tim 1.27
209 tim 1.16 <javac srcdir="${src.dir}"
210     destdir="${build.stripped.dir}"
211     debug="${build.debug}"
212     debuglevel="${build.debuglevel}"
213     deprecation="${build.deprecation}"
214     source="${build.sourcelevel}"
215     fork="true">
216    
217     <bootclasspath refid="javac.bootclasspath"/>
218     <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
219    
220     </javac>
221 tim 1.27
222 tim 1.16 </target>
223    
224    
225     <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
226     description="Puts all distributable products in single hierarchy"/>
227 tim 1.1
228    
229 tim 1.11 <target name="clean"
230     description="Removes all build products">
231 tim 1.27
232 tim 1.11 <delete dir="${build.dir}"/>
233     <delete dir="${build.classes.dir}"/>
234     <delete dir="${build.lib.dir}"/>
235 tim 1.27
236 tim 1.1 </target>
237    
238    
239 tim 1.11 <target name="dist-clean"
240     description="Removes all build and distribution products">
241 tim 1.27
242 tim 1.11 <delete dir="${dist.dir}"/>
243 tim 1.27
244 tim 1.9 </target>
245 tim 1.10
246    
247 tim 1.14 <!-- Anthill targets -->
248    
249     <!-- Should really run the tests instead of just the jar target -->
250 tim 1.27 <target name="anthill-build" depends="jar, test, docs, dist-docs"/>
251 tim 1.14
252     <target name="anthill-publish">
253     <copy todir="${deployDir}/docs/private">
254     <fileset dir="${build.javadocs.dir}"/>
255     </copy>
256     <copy todir="${deployDir}/docs/public">
257     <fileset dir="${dist.javadocs.dir}"/>
258     </copy>
259 tim 1.17 <copy tofile="${deployDir}/index.html"
260     file="${basedir}/etc/anthill-index.html"/>
261 tim 1.19 <copy todir="${deployDir}/notes">
262     <fileset dir="${basedir}/etc/notes"/>
263     </copy>
264 tim 1.14 </target>
265    
266    
267 tim 1.11 <!-- Internal targets -->
268 tim 1.9
269 tim 1.11 <target name="set-warnings-if" if="build.warnings">
270 tim 1.27
271 tim 1.11 <property name="build.warnings.option" value="-warnunchecked"/>
272 tim 1.27
273 tim 1.11 </target>
274 tim 1.9
275 tim 1.16
276 tim 1.11 <target name="set-warnings-unless" unless="build.warnings">
277 tim 1.27
278 tim 1.11 <property name="build.warnings.option" value=""/>
279 tim 1.27
280 tim 1.6 </target>
281    
282 tim 1.16
283 tim 1.11 <target name="init" depends="set-warnings-if, set-warnings-unless">
284 tim 1.27
285 tim 1.11 <!-- Version is kept in a separate file -->
286     <loadfile property="version" srcFile="version.properties"/>
287     <echo>Building JSR-166 version ${version}</echo>
288 tim 1.27
289     </target>
290    
291    
292     <target name="native-jar" depends="compile"
293     description="Builds library jar from compiled sources">
294    
295     <mkdir dir="${build.lib.dir}"/>
296    
297     <jar destfile="${product.jar}">
298     <fileset dir="${build.classes.dir}"/>
299     </jar>
300    
301     </target>
302    
303    
304     <target name="compile-emulation" depends="init"
305     if="build.emulation"
306     description="Compiles emulation sources to build folder">
307    
308     <mkdir dir="${build.emulation.dir}"/>
309    
310     <javac srcdir="${emulation.src.dir}"
311     destdir="${build.emulation.dir}"
312     debug="${build.debug}"
313     debuglevel="${build.debuglevel}"
314     deprecation="${build.deprecation}"
315     source="${build.sourcelevel}"
316     fork="true">
317    
318     <bootclasspath refid="javac.bootclasspath"/>
319     <compilerarg line="${javac.args} ${build.warnings.option}"/>
320    
321     </javac>
322    
323     </target>
324    
325    
326     <target name="emulation-jar" depends="native-jar, compile-emulation"
327     if="build.emulation">
328    
329     <jar destfile="${product.jar}" update="true" duplicate="add">
330     <fileset dir="${build.emulation.dir}"/>
331     </jar>
332    
333 tim 1.9 </target>
334    
335    
336 tim 1.11 <target name="dist-jar" depends="clean, jar">
337 tim 1.27
338 tim 1.11 <copy file="${product.jar}" todir="${dist.dir}"/>
339 tim 1.27
340 tim 1.11 </target>
341    
342    
343 tim 1.16 <target name="dist-docs" depends="filter-src"
344 tim 1.11 description="Builds javadocs without custom tags to dist folder">
345 tim 1.27
346 tim 1.11 <delete dir="${dist.javadocs.dir}"/>
347     <mkdir dir="${dist.javadocs.dir}"/>
348 tim 1.27
349 tim 1.11 <javadoc destdir="${dist.javadocs.dir}"
350     link="http://java.sun.com/j2se/1.4.1/docs/api"
351     overview="${src.dir}/intro.html"
352 tim 1.25 source="${build.docsourcelevel}">
353 tim 1.11
354 tim 1.22 <packageset dir="${build.filter.src.dir}"/>
355 tim 1.11
356     </javadoc>
357 tim 1.27
358 tim 1.11 </target>
359    
360 tim 1.1
361 tim 1.16 <target name="compile-ant-filter" depends="init">
362 tim 1.27
363 tim 1.1 <mkdir dir="${build.ant.dir}"/>
364 tim 1.27
365 tim 1.1 <javac srcdir="${ant.src.dir}"
366     destdir="${build.ant.dir}"
367     source="1.4"
368     />
369 tim 1.27
370 tim 1.1 </target>
371    
372    
373 tim 1.11 <target name="filter-src" depends="compile-ant-filter">
374 tim 1.27
375 tim 1.1 <mkdir dir="${build.filter.src.dir}"/>
376 tim 1.27
377 tim 1.1 <copy todir="${build.filter.src.dir}">
378     <fileset dir="${src.dir}">
379 tim 1.22 <include name="**/*.java"/>
380 tim 1.27 <exclude name="**/Random.java"/>
381     <exclude name="**/Unsafe.java"/>
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     <target name="compile-tests" depends="jar">
420 tim 1.27
421 tim 1.1 <mkdir dir="${build.testcases.dir}"/>
422 tim 1.27
423 tim 1.1 <javac srcdir="${test.src.dir}"
424     destdir="${build.testcases.dir}"
425     debug="${build.debug}"
426     debuglevel="${build.debuglevel}"
427     deprecation="${build.deprecation}"
428     source="${build.sourcelevel}"
429     fork="true">
430    
431 tim 1.11 <bootclasspath refid="javac.bootclasspath"/>
432     <compilerarg line="${javac.args} ${build.warnings.option}"/>
433 tim 1.2 <classpath refid="test.classpath"/>
434 tim 1.1
435     </javac>
436 tim 1.27
437 tim 1.1 </target>
438 tim 1.11
439 tim 1.1
440     <target name="run-tests" depends="compile-tests">
441 tim 1.27
442     <!-- May be overridden by user.properties -->
443     <property name="testcase" value="*"/>
444    
445 tim 1.1 <mkdir dir="${build.reports.dir}"/>
446 tim 1.27
447 tim 1.1 <junit printsummary="true"
448     showoutput="true"
449     errorProperty="junit.failed"
450     failureProperty="junit.failed"
451 tim 1.12 dir="${build.reports.dir}"
452     fork="true">
453    
454 tim 1.27 <jvmarg value="${test.javac.args}"/>
455 tim 1.1
456     <formatter type="xml"/>
457    
458     <batchtest todir="${build.reports.dir}">
459     <fileset dir="${test.src.dir}">
460 tim 1.23 <include name="**/${testcase}Test.java"/>
461 tim 1.1 </fileset>
462     </batchtest>
463    
464     </junit>
465 tim 1.27
466 tim 1.1 </target>
467    
468    
469     <target name="report-tests" depends="run-tests">
470     <!-- Sets junit.report.format to frames if Xalan is present,
471     otherwise sets it to noframes. -->
472     <available property="junit.report.format"
473     value="frames"
474     classname="org.apache.xalan.lib.Redirect"
475     />
476     <property name="junit.report.format" value="noframes"/>
477    
478     <junitreport todir="${build.reports.dir}">
479     <fileset dir="${build.reports.dir}">
480     <include name="TEST-*.xml"/>
481     </fileset>
482     <report styledir="${stylesheet.dir}"
483     format="${junit.report.format}"
484     todir="${build.reports.dir}"
485     />
486     </junitreport>
487    
488     <fail message="Test Cases Failed" if="junit.failed"/>
489 tim 1.18 </target>
490    
491    
492     <target name="check-junit">
493     <!-- FIXME: this test isn't specific enough -->
494     <available property="junit.available"
495     classname="junit.framework.TestCase"/>
496 tim 1.21 <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>
497 tim 1.1 </target>
498    
499    
500     </project>