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

Annotation of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (hide annotations)
Wed May 28 13:37:59 2003 UTC (16 years, 3 months ago) by tim
Branch: MAIN
Changes since 1.27: +121 -65 lines
File MIME type: text/xml
Omit Random and Unsafe from emulation jar.

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

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