ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
Revision: 1.60
Committed: Mon Dec 8 03:10:54 2003 UTC (20 years, 4 months ago) by tim
Content type: text/xml
Branch: MAIN
Changes since 1.59: +46 -45 lines
Log Message:
Test target now includes both tck and old, obsolete tests.
Removed build.nothreads.

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 tim 1.32 See user.properties.sample for an explanation of some useful settings.
11 tim 1.29 ------------------------------------------------------------------------------
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.1 <property name="build.debug" value="true"/>
26     <property name="build.debuglevel" value="source,lines,vars"/>
27 tim 1.13 <property name="build.deprecation" value="false"/>
28 tim 1.1
29     <!-- Build locations -->
30     <property name="build.dir" location="build"/>
31     <property name="build.classes.dir" location="${build.dir}/classes"/>
32     <property name="build.testcases.dir" location="${build.dir}/testcases"/>
33     <property name="build.lib.dir" location="${build.dir}/lib"/>
34     <property name="build.ant.dir" location="${build.dir}/ant"/>
35 tim 1.9 <property name="build.javadocs.dir" location="${build.dir}/javadocs"/>
36 tim 1.1 <property name="build.reports.dir" location="${build.dir}/reports"/>
37 tim 1.59 <property name="build.checkstyle.dir" location="${build.dir}/checkstyle"/>
38 tim 1.16 <property name="build.doccheck.dir" location="${build.dir}/doccheck"/>
39 tim 1.1 <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
40 tim 1.58 <property name="build.dc-filter.dir" location="${build.dir}/filterdocchk"/>
41 tim 1.1
42     <!-- Source locations -->
43 tim 1.22 <property name="src.dir" location="${basedir}/src/main"/>
44     <property name="test.src.dir" location="${basedir}/src/test"/>
45 tim 1.60 <property name="tck.src.dir" location="${test.src.dir}/tck"/>
46 tim 1.1 <property name="ant.src.dir" location="${basedir}/etc/ant"/>
47     <property name="stylesheet.dir" location="${basedir}/etc/xsl"/>
48     <property name="lib.dir" location="${basedir}/lib"/>
49 tim 1.9 <property name="dist.dir" location="${basedir}/dist"/>
50    
51     <!-- Distribution locations -->
52     <property name="dist.javadocs.dir" location="${dist.dir}/docs"/>
53 tim 1.1
54     <!-- Jar locations -->
55     <property name="product.jar" location="${build.lib.dir}/jsr166.jar"/>
56     <property name="junit.jar" location="${lib.dir}/junit.jar"/>
57 tim 1.59
58     <!-- Bootclasspath argument -->
59     <property name="bootclasspath.args" value="-Xbootclasspath/p:${product.jar}"/>
60 tim 1.27
61 tim 1.59 <!-- Test classpath -->
62     <path id="test.classpath">
63     <pathelement location="${build.testcases.dir}"/>
64     <pathelement location="${junit.jar}"/>
65     </path>
66 tim 1.28
67    
68    
69 tim 1.59 <!-- Main targets -->
70 tim 1.28
71 tim 1.11
72 tim 1.28 <target name="compile"
73 tim 1.60 depends="init, configure-compiler"
74 tim 1.27 description="Compiles main sources to build folder">
75    
76 tim 1.1 <mkdir dir="${build.classes.dir}"/>
77 tim 1.27
78 tim 1.60 <javac srcdir="${src.dir}"
79 tim 1.1 destdir="${build.classes.dir}"
80     debug="${build.debug}"
81     debuglevel="${build.debuglevel}"
82     deprecation="${build.deprecation}"
83     source="${build.sourcelevel}"
84     fork="true">
85    
86 tim 1.58 <compilerarg line="${build.args}"/>
87 tim 1.1
88     </javac>
89 tim 1.27
90 tim 1.1 </target>
91    
92    
93 tim 1.59
94 tim 1.28 <target name="jar"
95 tim 1.59 depends="compile"
96     description="Builds library jar from compiled sources">
97    
98     <mkdir dir="${build.lib.dir}"/>
99    
100     <jar destfile="${product.jar}">
101     <fileset dir="${build.classes.dir}"/>
102     </jar>
103    
104     </target>
105    
106 tim 1.1
107    
108 tim 1.28 <target name="test"
109 tim 1.32 depends="init, configure-tests, report-tests"
110 tim 1.29 description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
111 tim 1.1
112    
113 tim 1.59
114     <target name="docs"
115     description="Builds javadocs with custom tags to build folder">
116    
117     <delete dir="${build.javadocs.dir}"/>
118     <mkdir dir="${build.javadocs.dir}"/>
119    
120     <javadoc destdir="${build.javadocs.dir}"
121     link="http://java.sun.com/j2se/1.4.1/docs/api"
122     overview="${src.dir}/intro.html"
123     source="${build.sourcelevel}">
124    
125     <tag name="revised" description="Last revised:"/>
126     <tag name="spec" description="Specified by:"/>
127    
128     <packageset dir="${src.dir}"/>
129    
130     </javadoc>
131    
132     </target>
133    
134    
135    
136 tim 1.60 <target name="doccheck"
137     depends="filter-doccheck"
138     description="Reports on javadoc style errors">
139    
140     <delete dir="${build.doccheck.dir}"/>
141     <mkdir dir="${build.doccheck.dir}"/>
142    
143     <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
144     docletpath="${lib.dir}/doccheck.jar"
145     destdir="${build.doccheck.dir}">
146     <packageset dir="${build.dc-filter.dir}"/>
147     </javadoc>
148    
149     <echo>DocCheck output is in ${build.doccheck.dir}</echo>
150    
151     </target>
152    
153    
154    
155 tim 1.28 <target name="checkstyle"
156     depends="filter-src"
157 tim 1.18 description="Reports on style errors in Java source (verbose, mostly chaff)">
158 tim 1.27
159 tim 1.15 <taskdef resource="checkstyletask.properties"
160 tim 1.58 classpath="${lib.dir}/checkstyle-all-3.1.jar"/>
161 tim 1.15
162 tim 1.58 <mkdir dir="${build.checkstyle.dir}"/>
163    
164     <checkstyle config="etc/checkstyle/sun_checks.xml"
165     failOnViolation="false">
166     <formatter type="xml" toFile="${build.checkstyle.dir}/checkstyle-report.xml"/>
167 tim 1.15 <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
168     </checkstyle>
169 tim 1.58
170     <style in="${build.checkstyle.dir}/checkstyle-report.xml"
171     out="${build.checkstyle.dir}/checkstyle-report.html"
172     style="${stylesheet.dir}/checkstyle-frames.xsl"/>
173 tim 1.27
174 tim 1.15 </target>
175    
176 tim 1.59
177 tim 1.8
178 tim 1.28 <target name="dist"
179     depends="init, dist-clean, dist-jar, dist-docs"
180 tim 1.16 description="Puts all distributable products in single hierarchy"/>
181 tim 1.1
182 tim 1.58
183 tim 1.59
184 tim 1.42 <target name="release"
185     depends="dist"
186     description="Puts entire CVS tree, plus distribution productions, in a jar">
187    
188     <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>
189    
190     <jar basedir="${basedir}" destfile="${release.jar}">
191 tim 1.58 <!-- <exclude name="build/**"/> -->
192 tim 1.42 <exclude name="${release.jar}"/>
193     <exclude name="user.properties"/>
194     <exclude name="etc/notes/**"/>
195 tim 1.58 <exclude name="src/emulation/**"/>
196 tim 1.44 <exclude name="**/SyntaxTest.java"/>
197 tim 1.58 <exclude name="**/SuperfluousAbstract.java"/>
198 tim 1.42 </jar>
199    
200     </target>
201 tim 1.1
202 tim 1.59
203    
204 tim 1.11 <target name="clean"
205     description="Removes all build products">
206 tim 1.27
207 tim 1.11 <delete dir="${build.dir}"/>
208     <delete dir="${build.classes.dir}"/>
209     <delete dir="${build.lib.dir}"/>
210 tim 1.27
211 tim 1.1 </target>
212    
213    
214 tim 1.59
215 tim 1.11 <target name="dist-clean"
216     description="Removes all build and distribution products">
217 tim 1.27
218 tim 1.11 <delete dir="${dist.dir}"/>
219 tim 1.27
220 tim 1.9 </target>
221 tim 1.10
222    
223 tim 1.59
224 tim 1.28 <target name="dist-docs"
225     description="Builds javadocs without custom tags to dist folder">
226    
227     <delete dir="${dist.javadocs.dir}"/>
228     <mkdir dir="${dist.javadocs.dir}"/>
229    
230     <javadoc destdir="${dist.javadocs.dir}"
231 tim 1.59 link="http://java.sun.com/j2se/1.4.2/docs/api"
232 tim 1.28 overview="${src.dir}/intro.html"
233 tim 1.59 source="${build.sourcelevel}">
234 tim 1.28
235 tim 1.59 <packageset dir="${src.dir}"/>
236 tim 1.14
237 tim 1.28 </javadoc>
238 tim 1.14
239     </target>
240    
241    
242 tim 1.28
243 tim 1.11 <!-- Internal targets -->
244 tim 1.9
245 tim 1.16
246 tim 1.32 <target name="init">
247 tim 1.27
248 tim 1.11 <!-- Version is kept in a separate file -->
249     <loadfile property="version" srcFile="version.properties"/>
250     <echo>Building JSR-166 version ${version}</echo>
251 tim 1.54 <echo>java.home is ${java.home}</echo>
252 tim 1.27
253     </target>
254    
255    
256 tim 1.28 <target name="dist-jar"
257     depends="clean, jar">
258 tim 1.27
259 tim 1.11 <copy file="${product.jar}" todir="${dist.dir}"/>
260 tim 1.27
261 tim 1.11 </target>
262    
263    
264 tim 1.28 <target name="compile-ant-filter"
265     depends="init">
266 tim 1.27
267 tim 1.1 <mkdir dir="${build.ant.dir}"/>
268 tim 1.27
269 tim 1.1 <javac srcdir="${ant.src.dir}"
270     destdir="${build.ant.dir}"
271     source="1.4"
272     />
273 tim 1.27
274 tim 1.1 </target>
275    
276    
277 tim 1.28 <target name="filter-src"
278     depends="compile-ant-filter">
279 tim 1.27
280 tim 1.1 <mkdir dir="${build.filter.src.dir}"/>
281 tim 1.27
282 tim 1.1 <copy todir="${build.filter.src.dir}">
283     <fileset dir="${src.dir}">
284 tim 1.31 <include name="**/*.html"/>
285     </fileset>
286     </copy>
287    
288     <copy todir="${build.filter.src.dir}">
289     <fileset dir="${src.dir}">
290     <exclude name="**/*.html"/>
291 tim 1.59 <!-- Files excluded from dist-docs -->
292     <exclude name="java/util/Random.*"/>
293     <exclude name="sun/misc/Unsafe.*"/>
294 tim 1.1 </fileset>
295 tim 1.59 <!--
296 tim 1.1 <filterchain>
297 tim 1.59 -->
298 tim 1.36
299     <!--
300     # This filter gets rid of angle-bracketed type parameters
301     # so that javadoc can run on the result. The following
302     # heuristic seems to work:
303     #
304     # For all lines not starting with space(s)-asterisk-space(s),
305     # replace <something> with a space, where there may be more
306     # than one right angle bracket at the end, and "something"
307     # must not contain parens or pipes. (This may need some
308     # tweaking.)
309     -->
310    
311 tim 1.59 <!--
312 tim 1.1 <filterreader classname="jsr166.ant.filters.ReplaceFilter"
313     classpath="${build.ant.dir}">
314     <param name="notmatching" value="^\s+\*\s.*$"/>
315 tim 1.36 <param name="pattern" value="&lt;[^|>()]+?>+"/>
316 tim 1.1 <param name="replacement" value=" "/>
317     </filterreader>
318 tim 1.59 -->
319 tim 1.36
320 tim 1.59 <!--
321 tim 1.47 </filterchain>
322 tim 1.59 -->
323 tim 1.47 </copy>
324    
325     </target>
326    
327    
328     <target name="filter-doccheck"
329     depends="filter-src">
330 tim 1.36
331 tim 1.58 <mkdir dir="${build.dc-filter.dir}"/>
332 tim 1.36
333 tim 1.58 <copy todir="${build.dc-filter.dir}">
334 tim 1.47 <fileset dir="${build.filter.src.dir}">
335     <include name="**/*.html"/>
336     </fileset>
337     </copy>
338    
339     <property name="generic.declarations"
340     value="/** Fake type parameter. */ public interface E {} /** Fake type parameter. */ public interface T {} /** Fake type parameter. */ public interface K {} /** Fake type parameter. */ public interface V {}"
341     />
342    
343 tim 1.58 <copy todir="${build.dc-filter.dir}">
344 tim 1.47 <fileset dir="${build.filter.src.dir}">
345     <exclude name="**/*.html"/>
346     </fileset>
347     <filterchain>
348 tim 1.36 <!--
349 tim 1.47 # These two filters try to make the source look like
350 tim 1.36 # something that doccheck can process. The first removes
351     # -source 1.4 assertions and the second adds in a bunch
352     # of single letter public nested marker interfaces so that
353     # the generic type parameters are recognized.
354     -->
355    
356     <filterreader classname="jsr166.ant.filters.ReplaceFilter"
357     classpath="${build.ant.dir}">
358     <param name="matching" value="^\s*assert[\s ].*$"/>
359     <param name="pattern" value="assert"/>
360     <param name="replacement" value="//assert"/>
361     </filterreader>
362    
363     <filterreader classname="jsr166.ant.filters.ReplaceFilter"
364     classpath="${build.ant.dir}">
365 tim 1.47 <param name="matching" value="^([^*]*(class|interface|implements) .*|)\{.*$"/>
366 tim 1.36 <param name="pattern" value="$"/>
367     <param name="replacement" value=" ${generic.declarations}"/>
368     </filterreader>
369    
370 tim 1.1 </filterchain>
371     </copy>
372 tim 1.27
373 tim 1.1 </target>
374    
375    
376 tim 1.28 <target name="compile-tests"
377     depends="jar">
378 tim 1.27
379 tim 1.1 <mkdir dir="${build.testcases.dir}"/>
380 tim 1.37
381 tim 1.60 <javac srcdir="${tck.src.dir}"
382     destdir="${build.testcases.dir}"
383     debug="${build.debug}"
384     debuglevel="${build.debuglevel}"
385     deprecation="${build.deprecation}"
386     source="${build.sourcelevel}"
387     fork="true">
388    
389     <compilerarg value="${bootclasspath.args}"/>
390     <compilerarg line="${build.args}"/>
391    
392     <classpath refid="test.classpath"/>
393    
394     </javac>
395    
396     <javac srcdir="${test.src.dir}"
397 tim 1.1 destdir="${build.testcases.dir}"
398     debug="${build.debug}"
399     debuglevel="${build.debuglevel}"
400     deprecation="${build.deprecation}"
401     source="${build.sourcelevel}"
402     fork="true">
403    
404 tim 1.60 <include name="jsr166/test/**"/>
405    
406 tim 1.59 <compilerarg value="${bootclasspath.args}"/>
407 tim 1.57 <compilerarg line="${build.args}"/>
408 tim 1.59
409 tim 1.57 <classpath refid="test.classpath"/>
410 tim 1.1
411     </javac>
412 tim 1.27
413 tim 1.1 </target>
414 tim 1.11
415 tim 1.1
416 tim 1.28 <target name="run-tests"
417     depends="compile-tests">
418 tim 1.27
419     <!-- May be overridden by user.properties -->
420     <property name="testcase" value="*"/>
421    
422 tim 1.1 <mkdir dir="${build.reports.dir}"/>
423 tim 1.27
424 tim 1.1 <junit printsummary="true"
425     showoutput="true"
426     errorProperty="junit.failed"
427     failureProperty="junit.failed"
428 tim 1.12 dir="${build.reports.dir}"
429     fork="true">
430    
431 tim 1.59 <jvmarg value="${bootclasspath.args}"/>
432    
433     <classpath refid="test.classpath"/>
434 tim 1.1
435     <formatter type="xml"/>
436    
437     <batchtest todir="${build.reports.dir}">
438 tim 1.60 <fileset dir="${tck.src.dir}">
439     <include name="**/${testcase}Test.java"/>
440     </fileset>
441     <fileset dir="${test.src.dir}">
442     <include name="jsr166/test/**/${testcase}Test.java"/>
443 tim 1.1 </fileset>
444     </batchtest>
445    
446     </junit>
447 tim 1.27
448 tim 1.1 </target>
449    
450    
451 tim 1.28 <target name="report-tests"
452     depends="run-tests">
453    
454 tim 1.54 <!-- Sets junit.report.format to frames if redirection is present,
455 tim 1.1 otherwise sets it to noframes. -->
456     <available property="junit.report.format"
457     value="frames"
458     classname="org.apache.xalan.lib.Redirect"
459     />
460     <property name="junit.report.format" value="noframes"/>
461    
462     <junitreport todir="${build.reports.dir}">
463     <fileset dir="${build.reports.dir}">
464     <include name="TEST-*.xml"/>
465     </fileset>
466     <report styledir="${stylesheet.dir}"
467     format="${junit.report.format}"
468     todir="${build.reports.dir}"
469     />
470     </junitreport>
471    
472     <fail message="Test Cases Failed" if="junit.failed"/>
473 tim 1.28
474 tim 1.18 </target>
475    
476    
477 tim 1.32 <target name="configure-compiler">
478 tim 1.54
479     <property name="unchecked.option" value="-Xlint:unchecked"/>
480    
481     <condition property="warnunchecked.arg" value="${unchecked.option}">
482 tim 1.57 <istrue value="${build.warnunchecked}"/>
483 tim 1.32 </condition>
484    
485 tim 1.37 <property name="warnunchecked.arg" value=""/>
486 tim 1.34
487 tim 1.32
488     <!-- Common options in javac invocations -->
489 tim 1.57 <property name="build.args" value="${warnunchecked.arg}"/>
490 tim 1.33
491     </target>
492    
493    
494 tim 1.37 <target name="configure-tests"
495     depends="configure-compiler">
496 tim 1.28
497     <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
498 tim 1.18 <available property="junit.available"
499 tim 1.28 classname="junit.framework.Protectable"/>
500    
501 tim 1.54 <!-- Xalan -->
502     <available property="xalan.available"
503     classname="org.apache.xalan.Version"/>
504    
505 tim 1.59
506     <!-- Ant 1.6beta and later don't need or want this check -->
507     <!--
508     <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
509     unless="junit.available"/>
510    
511 tim 1.54 <fail message="Need Xalan 2.5.1 jar in ${ant.home}${file.separator}lib to run tests"
512     unless="xalan.available"/>
513 tim 1.59 -->
514 tim 1.30
515 tim 1.28 </target>
516    
517    
518    
519     <!-- Anthill targets -->
520    
521 tim 1.54 <target name="anthill-build">
522 tim 1.55
523     <!-- Override this in user.properties -->
524     <property name="tiger.home" location="e:/j2sdk1.5.0"/>
525    
526 tim 1.54 <exec resultproperty="result.property" dir="${basedir}" executable="${tiger.home}/bin/java">
527     <arg value="-Xmx256000000"/>
528     <!-- classpath of new JVM -->
529     <arg value="-classpath"/> <arg path="${java.class.path}"/>
530     <!-- location of Ant home directory -->
531     <arg value="-Dant.home=${ant.home}"/>
532     <!-- the Ant main class -->
533     <arg value="org.apache.tools.ant.Main"/>
534     <!-- The build file -->
535     <arg value="-buildfile"/> <arg value="build.xml"/>
536     <!-- the target to build on the new Ant instance -->
537     <arg value="-DJAVA_HOME=${tiger.home}"/>
538     <arg value="do-anthill-build"/>
539     </exec>
540     </target>
541    
542     <target name="do-anthill-build"
543 tim 1.28 depends="jar, test, docs, dist-docs"/>
544    
545     <target name="anthill-publish">
546    
547     <copy todir="${deployDir}/docs/private">
548     <fileset dir="${build.javadocs.dir}"/>
549     </copy>
550    
551     <copy todir="${deployDir}/docs/public">
552     <fileset dir="${dist.javadocs.dir}"/>
553     </copy>
554    
555     <copy tofile="${deployDir}/index.html"
556     file="${basedir}/etc/anthill-index.html"/>
557    
558     <copy todir="${deployDir}/notes">
559     <fileset dir="${basedir}/etc/notes"/>
560     </copy>
561    
562 tim 1.43 </target>
563    
564    
565    
566 tim 1.60 <!-- Backward compatibility, work in progress (some files not checked in) -->
567 tim 1.59
568 tim 1.43
569 tim 1.59 <target name="compat" depends="jar">
570    
571     <mkdir dir="${build.testcases.dir}"/>
572    
573     <javac srcdir="${test.src.dir}"
574     destdir="${build.testcases.dir}"
575     debug="${build.debug}"
576     debuglevel="${build.debuglevel}"
577     deprecation="${build.deprecation}"
578     source="${build.sourcelevel}"
579     fork="true">
580    
581     <compilerarg value="${bootclasspath.args}"/>
582     <compilerarg line="${build.args}"/>
583    
584     <classpath refid="test.classpath"/>
585    
586     <include name="Compatibility.java"/>
587    
588     </javac>
589    
590    
591     <java classname="Compatibility" fork="true">
592     <jvmarg value="${bootclasspath.args}"/>
593     <classpath refid="test.classpath"/>
594 tim 1.43 </java>
595 tim 1.1 </target>
596    
597 tim 1.59
598    
599     <property name="pretiger.src.dir" location="${build.dir}/pretiger/src"/>
600     <property name="build.pretiger.dir" location="${build.dir}/pretiger/classes"/>
601     <property name="pretiger.jar" location="${build.lib.dir}/jsr166-pretiger.jar"/>
602     <property name="pretiger.sourcelevel" value="1.4"/>
603    
604     <target name="defang"
605     depends="init"
606     description="Generates pre-Tiger compatible source">
607    
608     <delete dir="${pretiger.src.dir}"/>
609     <mkdir dir="${pretiger.src.dir}"/>
610    
611     <exec executable="perl">
612     <arg file="etc/defang.pl"/>
613     <!-- <arg value="-v"/> -->
614     <arg value="-s"/> <arg file="${src.dir}"/>
615     <arg value="-t"/> <arg file="${pretiger.src.dir}"/>
616     </exec>
617    
618     </target>
619    
620     <target name="compile-pretiger"
621     depends="init, configure-compiler, defang"
622     description="Compiles pre-Tiger sources to build folder">
623    
624     <mkdir dir="${build.pretiger.dir}"/>
625    
626     <javac srcdir="${pretiger.src.dir}"
627     destdir="${build.pretiger.dir}"
628     debug="${build.debug}"
629     debuglevel="${build.debuglevel}"
630     deprecation="${build.deprecation}"
631     source="${pretiger.sourcelevel}"
632     fork="true">
633    
634     <compilerarg line="${build.args}"/>
635     <exclude name="**/Thread.java"/>
636    
637     </javac>
638    
639     </target>
640    
641     <target name="pretiger" depends="compile-pretiger">
642    
643     <mkdir dir="${build.lib.dir}"/>
644    
645     <jar destfile="${pretiger.jar}">
646     <fileset dir="${build.pretiger.dir}">
647     </fileset>
648     </jar>
649    
650     </target>
651 tim 1.1
652     </project>