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

Annotation of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.33 - (hide annotations)
Thu May 29 12:54:10 2003 UTC (16 years, 6 months ago) by tim
Branch: MAIN
Changes since 1.32: +28 -4 lines
File MIME type: text/xml
Add nothreads option.

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

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