ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
Revision: 1.31
Committed: Wed May 28 21:15:50 2003 UTC (20 years, 11 months ago) by tim
Content type: text/xml
Branch: MAIN
Changes since 1.30: +33 -18 lines
Log Message:
Source filtering was doing the HTML as well.
Prepare for latest version of generic compiler.

File Contents

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