ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
(Generate patch)

Comparing jsr166/build.xml (file contents):
Revision 1.25 by tim, Mon May 19 11:33:20 2003 UTC vs.
Revision 1.51 by tim, Thu Aug 7 03:49:48 2003 UTC

# Line 1 | Line 1
1   <project name="jsr166" default="usage">
2  
3    <description>
4 <    Build file for JSR-166
4 > ------------------------------------------------------------------------------
5 >  Build file for JSR-166
6  
7 <    JUnit 1.8 must be in ${ant.home}/lib for the test target to work.
7 <  </description>
7 >  Usage: ant [target]
8  
9 +  User-specific settings are read from user.properties.
10 +  See user.properties.sample for an explanation of some useful settings.
11 + ------------------------------------------------------------------------------
12 +  </description>
13  
14 <  <target name="usage" description="Prints this message">
15 <    <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>
14 >  <target name="usage" description="Advises user to run with -projecthelp">
15 >    <echo>Run "ant -projecthelp" for full usage information.</echo>
16    </target>
17  
18 +
19 +  <!-- User-specific settings -->
20    <property file="user.properties"/>
21 <  <property name="testcase" value="*"/>
21 >
22  
23    <!-- Compilation options -->
24    <property name="build.sourcelevel"    value="1.5"/>
# Line 36 | Line 26 | ant [target], where target is one of:
26    <property name="build.debug"          value="true"/>
27    <property name="build.debuglevel"     value="source,lines,vars"/>
28    <property name="build.deprecation"    value="false"/>
39  <!--
40  <property name="build.warnings"       value="true"/>
41  -->
29  
30    <!-- Build locations -->
31    <property name="build.dir"            location="build"/>
32    <property name="build.classes.dir"    location="${build.dir}/classes"/>
33 +  <property name="build.emulation.dir"  location="${build.dir}/emulation"/>
34    <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"/>
# Line 51 | Line 39 | ant [target], where target is one of:
39    <property name="build.reports.dir"    location="${build.dir}/reports"/>
40    <property name="build.doccheck.dir"   location="${build.dir}/doccheck"/>
41    <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
42 +  <property name="build.filter.doccheck.dir" location="${build.dir}/filterdocchk"/>
43  
44    <!-- Source locations -->
45    <property name="src.dir"              location="${basedir}/src/main"/>
46 +  <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>
47    <property name="test.src.dir"         location="${basedir}/src/test"/>
48    <property name="ant.src.dir"          location="${basedir}/etc/ant"/>
49    <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>
# Line 65 | Line 55 | ant [target], where target is one of:
55  
56    <!-- Jar locations -->
57    <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>
68  <property name="javac.jar"            location="${lib.dir}/javac.jar"/>
69  <property name="collect.jar"          location="${lib.dir}/collect.jar"/>
58    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
59    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
60 +  <property name="sinjdoc.jar"          location="${lib.dir}/sinjdoc.jar"/>
61  
73  <property name="javac.args"           value='-J-Xbootclasspath/p:${javac.jar}'/>
62  
63 <  <path id="javac.bootclasspath">
64 <    <pathelement location="${collect.jar}"/>
65 <    <pathelement location="${rt.jar}"/>
66 <  </path>
67 <
68 <  <path id="test.classpath">
69 <    <pathelement location="${product.jar}"/>
70 <  </path>
63 >  <!-- Files excluded from dist-docs and emulation jar -->
64 >  <patternset id="unsafe.exclusion">
65 >    <exclude name="java/util/Random.*"/>
66 >    <exclude name="sun/misc/Unsafe.*"/>
67 >  </patternset>
68 >
69 >  <!-- Files excludes from emulation jar -->
70 >  <patternset id="atomic.exclusion">
71 >    <exclude name="java/util/concurrent/atomic/AtomicBoolean*"/>
72 >    <exclude name="java/util/concurrent/atomic/AtomicInteger*"/>
73 >    <exclude name="java/util/concurrent/atomic/AtomicLong*"/>
74 >    <exclude name="java/util/concurrent/atomic/AtomicReference*"/>
75 >    <exclude name="java/util/concurrent/locks/LockSupport*"/>
76 >    <exclude name="java/util/concurrent/locks/ReentrantLock*"/>
77 >  </patternset>
78 >
79  
80  
81    <!-- Main targets -->
82  
83 <  <target name="compile" depends="init"
84 <          description="Compiles all sources to build folder">
83 >  <target name="compile"
84 >          depends="init, configure-compiler, prepare-src"
85 >          description="Compiles main sources to build folder">
86 >
87 >    <property name="prepare.src.dir" value="${src.dir}"/>
88 >
89      <mkdir dir="${build.classes.dir}"/>
90 <    <javac srcdir="${src.dir}"
90 >
91 > <!--
92 >    <echo>javac ${gjc.args}</echo>
93 >    <echo>bootclasspath=${compile.bootclasspath}</echo>
94 > -->
95 >
96 >    <javac srcdir="${prepare.src.dir}"
97            destdir="${build.classes.dir}"
98              debug="${build.debug}"
99         debuglevel="${build.debuglevel}"
# Line 95 | Line 101 | ant [target], where target is one of:
101             source="${build.sourcelevel}"
102               fork="true">
103  
104 <      <bootclasspath refid="javac.bootclasspath"/>
105 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
104 >      <compilerarg    line="${gjc.args}"/>
105 >      <bootclasspath refid="compile.bootclasspath"/>
106  
107      </javac>
108 +
109    </target>
110  
111  
112 <  <target name="jar" depends="compile"
113 <          description="Builds library jar from compiled sources">
114 <    <mkdir dir="${build.lib.dir}"/>
108 <    <jar basedir="${build.classes.dir}"
109 <        destfile="${product.jar}"
110 <    />
111 <  </target>
112 >  <target name="jar"
113 >          depends="configure-emulation, init-jar, native-jar, emulation-jar"
114 >          description="Builds library jar from compiled sources"/>
115  
116  
117 <  <target name="test" depends="init, check-junit, report-tests"
118 <          description="Runs all tests (requires JUnit 1.8 in ${ant.home}/lib)"/>
117 >  <target name="test"
118 >          depends="init, configure-tests, report-tests"
119 >          description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
120  
121  
122 <  <target name="checkstyle" depends="filter-src"
122 >  <target name="checkstyle"
123 >          depends="filter-src"
124            description="Reports on style errors in Java source (verbose, mostly chaff)">
125 +
126      <taskdef resource="checkstyletask.properties"
127              classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
128  
# Line 124 | Line 130 | ant [target], where target is one of:
130        <formatter type="plain"/>  <!-- also available: type="xml" -->
131        <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
132      </checkstyle>
133 +
134    </target>
135  
136  
137 <  <target name="doccheck" depends="filter-src"
138 <          description="Reports on javadoc style errors (not working yet)">
137 >  <target name="doccheck"
138 >          depends="filter-doccheck"
139 >          description="Reports on javadoc style errors">
140 >
141      <delete dir="${build.doccheck.dir}"/>
142      <mkdir dir="${build.doccheck.dir}"/>
143 +
144      <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
145           docletpath="${lib.dir}/doccheck.jar"
146              destdir="${build.doccheck.dir}">
147 <      <packageset dir="${build.filter.src.dir}"/>
147 >      <packageset dir="${build.filter.doccheck.dir}"/>
148      </javadoc>
149 +
150 +    <echo>DocCheck output is in ${build.doccheck.dir}</echo>
151 +
152    </target>
153  
154  
155 <  <target name="docs" depends="filter-src"
155 >  <target name="docs"
156 >          depends="filter-src"
157            description="Builds javadocs with custom tags to build folder">
158 +
159      <delete dir="${build.javadocs.dir}"/>
160      <mkdir dir="${build.javadocs.dir}"/>
161 +
162      <javadoc destdir="${build.javadocs.dir}"
163                  link="http://java.sun.com/j2se/1.4.1/docs/api"
164              overview="${src.dir}/intro.html"
165                source="${build.docsourcelevel}">
166  
167        <tag name="revised" description="Last revised:"/>
168 <      <tag name="spec" description="Specified by:"/>
169 <      <tag name="editor" description="Last edited by:"/>
170 <      <tag name="fixme" description="FIX ME:"/>
168 >      <tag name="spec"    description="Specified by:"/>
169 >      <tag name="editor"  description="Last edited by:"/>
170 >      <tag name="fixme"   description="FIX ME:"/>
171 >
172        <packageset dir="${build.filter.src.dir}"/>
173  
174      </javadoc>
175 +
176    </target>
177  
178  
179 <  <!--
180 <   # javac -s doesn't reliably generate compilable code. It generates
181 <   # bridge methods (marked as "synthetic") that can have identical
182 <   # signatures to existing methods except for the return value.
183 <   -->
184 <  <target name="strip" depends="init">
179 >  <target name="sinjdocs"
180 >          depends="configure-tests"
181 >          description="Builds javadocs with custom tags to build folder">
182 >
183 >    <delete dir="${build.javadocs.dir}"/>
184 >    <mkdir dir="${build.javadocs.dir}"/>
185 >
186 >    <java classname="net.cscott.sinjdoc.Main" fork="true">
187 >
188 >      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
189 >
190 >      <classpath>
191 >        <pathelement location="${sinjdoc.jar}"/>
192 >        <pathelement location="${lib.dir}/jutil.jar"/>
193 >        <pathelement location="${lib.dir}/cup.jar"/>
194 >        <path refid="test.classpath"/>
195 >      </classpath>
196 >
197 >
198 >      <arg value="-d"/>          <arg value="${build.javadocs.dir}"/>
199 >      <arg value="-sourcepath"/> <arg value="${src.dir}"/>
200 >      <arg value="-overview"/>   <arg value="${src.dir}/intro.html"/>
201 >      <arg value="-source"/>     <arg value="${build.sourcelevel}"/>
202 >      <!-- <arg value="-verbose"/> -->
203 >      <!-- <arg value="-link"/>  <arg value="http://java.sun.com/j2se/1.4.1/docs/api"/> -->
204 >      <arg value="java.lang"/>
205 >      <arg value="java.util"/>
206 >      <arg value="java.util.concurrent"/>
207 >      <arg value="java.util.concurrent.atomic"/>
208 >      <arg value="java.util.concurrent.locks"/>
209 >
210 >      <!--
211 >      <arg value="-help"/>
212 >      -->
213 >
214 >    </java>
215 >
216 >  </target>
217 >
218 >
219 >  <target name="strip"
220 >          depends="init, configure-compiler"
221 >          description="Strip generics from java source (not working yet)">
222 >
223      <mkdir dir="${build.stripped.dir}"/>
224 +
225 +    <!--
226 +     # javac -s doesn't reliably generate compilable code. It generates
227 +     # bridge methods (marked as "synthetic") that can have identical
228 +     # signatures to existing methods except for the return value.
229 +     -->
230      <javac srcdir="${src.dir}"
231            destdir="${build.stripped.dir}"
232              debug="${build.debug}"
# Line 173 | Line 235 | ant [target], where target is one of:
235             source="${build.sourcelevel}"
236               fork="true">
237  
238 <      <bootclasspath refid="javac.bootclasspath"/>
239 <      <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
238 >      <compilerarg    line="${gjc.args} -s"/>
239 >      <bootclasspath refid="compile.bootclasspath"/>
240  
241      </javac>
242 +
243    </target>
244  
245  
246 <  <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
246 >  <target name="dist"
247 >          depends="init, dist-clean, dist-jar, dist-docs"
248            description="Puts all distributable products in single hierarchy"/>
249  
250 +  <target name="release"
251 +          depends="dist"
252 +          description="Puts entire CVS tree, plus distribution productions, in a jar">
253 +
254 + <!--
255 +    #keep build dir? - dl
256 +    <delete dir="${build.dir}"/>
257 + -->
258 +    <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>
259 +
260 +    <jar basedir="${basedir}" destfile="${release.jar}">
261 +      <exclude name="${release.jar}"/>
262 +      <exclude name="user.properties"/>
263 +      <exclude name="etc/notes/**"/>
264 +      <exclude name="lib/gjc/2.1/**"/>
265 +      <exclude name="**/SyntaxTest.java"/>
266 +    </jar>
267 +
268 +  </target>
269  
270    <target name="clean"
271            description="Removes all build products">
272 +
273      <delete dir="${build.dir}"/>
274      <delete dir="${build.classes.dir}"/>
275      <delete dir="${build.lib.dir}"/>
276 +
277    </target>
278  
279  
280    <target name="dist-clean"
281            description="Removes all build and distribution products">
282 +
283      <delete dir="${dist.dir}"/>
284 +
285    </target>
286  
287  
288 <  <!-- Anthill targets -->
288 >  <target name="dist-docs"
289 >          depends="filter-src"
290 >          description="Builds javadocs without custom tags to dist folder">
291  
292 <  <!-- Should really run the tests instead of just the jar target -->
293 <  <target name="anthill-build" depends="jar, docs, dist-docs"/>
292 >    <delete dir="${dist.javadocs.dir}"/>
293 >    <mkdir dir="${dist.javadocs.dir}"/>
294  
295 <  <target name="anthill-publish">
296 <    <copy todir="${deployDir}/docs/private">
297 <      <fileset dir="${build.javadocs.dir}"/>
298 <    </copy>
210 <    <copy todir="${deployDir}/docs/public">
211 <      <fileset dir="${dist.javadocs.dir}"/>
212 <    </copy>
213 <    <copy tofile="${deployDir}/index.html"
214 <          file="${basedir}/etc/anthill-index.html"/>
215 <    <copy todir="${deployDir}/notes">
216 <      <fileset dir="${basedir}/etc/notes"/>
217 <    </copy>
218 <  </target>
295 >    <javadoc destdir="${dist.javadocs.dir}"
296 >                link="http://java.sun.com/j2se/1.4.1/docs/api"
297 >            overview="${src.dir}/intro.html"
298 >              source="${build.docsourcelevel}">
299  
300 +      <packageset dir="${build.filter.src.dir}"/>
301  
302 <  <!-- Internal targets -->
302 >    </javadoc>
303  
223  <target name="set-warnings-if" if="build.warnings">
224    <property name="build.warnings.option" value="-warnunchecked"/>
304    </target>
305  
306  
307 <  <target name="set-warnings-unless" unless="build.warnings">
308 <    <property name="build.warnings.option" value=""/>
230 <  </target>
307 >
308 >  <!-- Internal targets -->
309  
310  
311 <  <target name="init" depends="set-warnings-if, set-warnings-unless">
311 >  <target name="init">
312 >
313      <!-- Version is kept in a separate file -->
314      <loadfile property="version" srcFile="version.properties"/>
315      <echo>Building JSR-166 version ${version}</echo>
316 +
317    </target>
318  
319  
320 <  <target name="dist-jar" depends="clean, jar">
321 <    <copy file="${product.jar}" todir="${dist.dir}"/>
320 >  <target name="init-jar">
321 >
322 >    <mkdir dir="${build.lib.dir}"/>
323 >
324    </target>
325  
326  
327 <  <target name="dist-docs" depends="filter-src"
328 <          description="Builds javadocs without custom tags to dist folder">
329 <    <delete dir="${dist.javadocs.dir}"/>
248 <    <mkdir dir="${dist.javadocs.dir}"/>
249 <    <javadoc destdir="${dist.javadocs.dir}"
250 <                link="http://java.sun.com/j2se/1.4.1/docs/api"
251 <            overview="${src.dir}/intro.html"
252 <              source="${build.docsourcelevel}">
327 >  <target name="native-jar"
328 >          depends="compile"
329 >          unless="build.emulation.true">
330  
331 <      <packageset dir="${build.filter.src.dir}"/>
331 >    <jar destfile="${product.jar}">
332 >      <fileset dir="${build.classes.dir}"/>
333 >    </jar>
334 >
335 >  </target>
336 >
337 >
338 >  <target name="compile-emulation"
339 >          depends="init, configure-compiler"
340 >          if="build.emulation.true">
341 >
342 >    <mkdir dir="${build.emulation.dir}"/>
343 >
344 >    <javac srcdir="${emulation.src.dir}"
345 >          destdir="${build.emulation.dir}"
346 >            debug="${build.debug}"
347 >       debuglevel="${build.debuglevel}"
348 >      deprecation="${build.deprecation}"
349 >           source="${build.sourcelevel}"
350 >             fork="true">
351 >
352 >      <compilerarg    line="${gjc.args}"/>
353 >      <bootclasspath refid="compile.bootclasspath"/>
354 >
355 >    </javac>
356 >
357 >  </target>
358 >
359 >
360 >  <target name="emulation-jar"
361 >          depends="compile-emulation"
362 >          if="build.emulation.true">
363 >
364 >
365 >    <jar destfile="${product.jar}" duplicate="add">
366 >      <fileset dir="${build.classes.dir}">
367 >        <patternset refid="atomic.exclusion"/>
368 >        <patternset refid="unsafe.exclusion"/>
369 >      </fileset>
370 >      <fileset dir="${build.emulation.dir}"/>
371 >    </jar>
372  
256    </javadoc>
373    </target>
374  
375  
376 <  <target name="compile-ant-filter" depends="init">
376 >  <target name="dist-jar"
377 >          depends="clean, jar">
378 >
379 >    <copy file="${product.jar}" todir="${dist.dir}"/>
380 >
381 >  </target>
382 >
383 >
384 >  <target name="compile-ant-filter"
385 >          depends="init">
386 >
387      <mkdir dir="${build.ant.dir}"/>
388 +
389      <javac srcdir="${ant.src.dir}"
390            destdir="${build.ant.dir}"
391             source="1.4"
392      />
393 +
394    </target>
395  
396  
397 <  <target name="filter-src" depends="compile-ant-filter">
397 >  <target name="filter-src"
398 >          depends="compile-ant-filter">
399 >
400      <mkdir dir="${build.filter.src.dir}"/>
401 +
402 +    <copy todir="${build.filter.src.dir}">
403 +      <fileset dir="${src.dir}">
404 +        <include name="**/*.html"/>
405 +      </fileset>
406 +    </copy>
407 +
408      <copy todir="${build.filter.src.dir}">
409        <fileset dir="${src.dir}">
410 <        <include name="**/*.java"/>
410 >        <exclude name="**/*.html"/>
411 >        <patternset refid="unsafe.exclusion"/>
412        </fileset>
413        <filterchain>
414 +
415 +        <!--
416 +         # This filter gets rid of angle-bracketed type parameters
417 +         # so that javadoc can run on the result. The following
418 +         # heuristic seems to work:
419 +         #
420 +         # For all lines not starting with space(s)-asterisk-space(s),
421 +         #   replace <something> with a space, where there may be more
422 +         #   than one right angle bracket at the end, and "something"
423 +         #   must not contain parens or pipes. (This may need some
424 +         #   tweaking.)
425 +         -->
426 +
427          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
428                        classpath="${build.ant.dir}">
278          <!--
279           # These arguments are to get rid of angle-bracketed type
280           # parameters so that javadoc can run on the result. The
281           # following heuristic that seems to work:
282           #
283           # For all lines not starting with space(s)-asterisk-space(s),
284           #   replace <something> with a space, where there may be more
285           #   than one right angle bracket at the end, and "something"
286           #   must not contain parens or pipes. (This may need some
287           #   tweaking.)
288           -->
429            <param name="notmatching" value="^\s+\*\s.*$"/>
430 <          <param name="pattern" value="&lt;[^|>()]+?>+"/>
430 >          <param name="pattern"     value="&lt;[^|>()]+?>+"/>
431            <param name="replacement" value=" "/>
432          </filterreader>
433 +
434 +
435 +        <!--
436 +         # This filter uncomments lines beginning with "//@" so that
437 +         # javadoc can see imports that are needed to resolve links
438 +         # but that shouldn't be in the compiled code.
439 +         -->
440 +
441          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
442                        classpath="${build.ant.dir}">
443 <          <!--
444 <           # These arguments are to uncomment lines beginning with
297 <           # "//@" so that javadoc can see imports that are needed
298 <           # to resolve links but that shouldn't be in the compiled
299 <           # code.
300 <           -->
301 <          <param name="matching" value="^//@.*$"/>
302 <          <param name="pattern" value="^//@"/>
443 >          <param name="matching"    value="^//@.*$"/>
444 >          <param name="pattern"     value="^//@"/>
445            <param name="replacement" value=""/>
446          </filterreader>
447        </filterchain>
448      </copy>
449 +
450    </target>
451  
452  
453 <  <target name="compile-tests" depends="jar">
453 >
454 >
455 >  <target name="filter-doccheck"
456 >          depends="filter-src">
457 >
458 >    <mkdir dir="${build.filter.doccheck.dir}"/>
459 >
460 >    <copy todir="${build.filter.doccheck.dir}">
461 >      <fileset dir="${build.filter.src.dir}">
462 >        <include name="**/*.html"/>
463 >      </fileset>
464 >    </copy>
465 >
466 >    <property name="generic.declarations"
467 >             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 {}"
468 >    />
469 >
470 >    <copy todir="${build.filter.doccheck.dir}">
471 >      <fileset dir="${build.filter.src.dir}">
472 >        <exclude name="**/*.html"/>
473 >      </fileset>
474 >      <filterchain>
475 >        <!--
476 >         # These two filters try to make the source look like
477 >         # something that doccheck can process. The first removes
478 >         # -source 1.4 assertions and the second adds in a bunch
479 >         # of single letter public nested marker interfaces so that
480 >         # the generic type parameters are recognized.
481 >         -->
482 >
483 >        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
484 >                      classpath="${build.ant.dir}">
485 >          <param name="matching"    value="^\s*assert[\s ].*$"/>
486 >          <param name="pattern"     value="assert"/>
487 >          <param name="replacement" value="//assert"/>
488 >        </filterreader>
489 >
490 >        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
491 >                      classpath="${build.ant.dir}">
492 >          <param name="matching"    value="^([^*]*(class|interface|implements) .*|)\{.*$"/>
493 >          <param name="pattern"     value="$"/>
494 >          <param name="replacement" value=" ${generic.declarations}"/>
495 >        </filterreader>
496 >
497 >      </filterchain>
498 >    </copy>
499 >
500 >  </target>
501 >
502 >
503 >  <target name="compile-tests"
504 >          depends="jar">
505 >
506      <mkdir dir="${build.testcases.dir}"/>
507 +
508 + <!--
509 +    <echo>javac ${gjc.args}</echo>
510 +    <echo>bootclasspath=${test.compile.bootclasspath}</echo>
511 +    <echo>classpath="${test.classpath}"</echo>
512 + -->
513 +
514      <javac srcdir="${test.src.dir}"
515            destdir="${build.testcases.dir}"
516              debug="${build.debug}"
# Line 317 | Line 519 | ant [target], where target is one of:
519             source="${build.sourcelevel}"
520               fork="true">
521  
522 <      <bootclasspath refid="javac.bootclasspath"/>
523 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
524 <      <classpath refid="test.classpath"/>
522 >      <compilerarg    line="${gjc.args}"/>
523 >      <bootclasspath refid="test.compile.bootclasspath"/>
524 >      <classpath     refid="test.classpath"/>
525  
526      </javac>
527 +
528    </target>
529  
530  
531 <  <target name="run-tests" depends="compile-tests">
531 >  <target name="run-tests"
532 >          depends="compile-tests">
533 >
534 >    <!-- May be overridden by user.properties -->
535 >    <property name="testcase" value="*"/>
536 >
537      <mkdir dir="${build.reports.dir}"/>
538 +
539      <junit printsummary="true"
540               showoutput="true"
541            errorProperty="junit.failed"
# Line 334 | Line 543 | ant [target], where target is one of:
543                      dir="${build.reports.dir}"
544                     fork="true">
545  
546 <      <!--
338 <       ! This nastiness is so JUnit can test classes we are inserting
339 <       ! into the java.* packages.
340 <       -->
341 <      <jvmarg value="-Xbootclasspath/p:${product.jar};${build.testcases.dir};${junit.jar}"/>
546 >      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
547  
548        <formatter type="xml"/>
549  
# Line 349 | Line 554 | ant [target], where target is one of:
554        </batchtest>
555  
556      </junit>
557 +
558    </target>
559  
560  
561 <  <target name="report-tests" depends="run-tests">
561 >  <target name="report-tests"
562 >          depends="run-tests">
563 >
564      <!-- Sets junit.report.format to frames if Xalan is present,
565           otherwise sets it to noframes. -->
566      <available property="junit.report.format"
# Line 372 | Line 580 | ant [target], where target is one of:
580      </junitreport>
581  
582      <fail message="Test Cases Failed" if="junit.failed"/>
583 +
584    </target>
585  
586  
587 <  <target name="check-junit">
588 <    <!-- FIXME: this test isn't specific enough -->
587 >  <target name="configure-compiler">
588 >
589 >    <property name="gjc.version"
590 >             value="2.2"/>
591 >
592 >    <condition property="novariance.arg" value="-novariance">
593 >      <and>
594 >        <equals arg1="${gjc.version}" arg2="2.0"/>
595 >        <or>
596 >          <not><isset property="gjc.novariance"/></not>
597 >          <istrue value="${gjc.novariance}"/>
598 >        </or>
599 >      </and>
600 >    </condition>
601 >
602 >    <property name="novariance.arg"
603 >             value=""/>
604 >
605 >    <property name="gjc.dir"
606 >             value="${lib.dir}/gjc"/>
607 >
608 >    <property name="javac.jar"
609 >          location="${gjc.dir}/${gjc.version}/javac.jar"/>
610 >
611 >    <property name="collect.jar"
612 >          location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/>
613 >
614 >
615 >    <condition property="warnunchecked.arg" value="-warnunchecked">
616 >      <istrue value="${gjc.warnunchecked}"/>
617 >    </condition>
618 >
619 >    <property name="warnunchecked.arg" value=""/>
620 >
621 >    <condition property="prepare.src.dir" value="${build.dir}/prepare-src">
622 >      <istrue value="${build.nothreads}"/>
623 >    </condition>
624 >
625 >
626 >    <!--
627 >     ! Bootclasspath munging for source compilation.
628 >     -->
629 >
630 >    <path id="pre.bootclasspath">
631 >      <pathelement location="${javac.jar}"/>
632 >    </path>
633 >
634 >    <path id="compile.bootclasspath">
635 >      <pathelement location="${build.classes.dir}"/>
636 >      <pathelement location="${collect.jar}"/>
637 >      <pathelement location="${rt.jar}"/>
638 >    </path>
639 >
640 >    <!-- Flatten paths into platform-appropriate strings -->
641 >    <property name="pre.bootclasspath"     refid="pre.bootclasspath"/>
642 >    <property name="compile.bootclasspath" refid="compile.bootclasspath"/>
643 >
644 >
645 >    <!-- Common options in javac invocations -->
646 >    <property name="gjc.args"
647 >             value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}"
648 >    />
649 >
650 >  </target>
651 >
652 >
653 >  <target name="prepare-src"
654 >          depends="configure-compiler"
655 >          if="prepare.src.dir">
656 >
657 >    <mkdir dir="${prepare.src.dir}"/>
658 >    <copy todir="${prepare.src.dir}">
659 >      <fileset dir="${src.dir}">
660 >        <exclude name="java/lang/**"/>
661 >      </fileset>
662 >    </copy>
663 >
664 >  </target>
665 >
666 >
667 >  <target name="configure-emulation">
668 >
669 >    <condition property="build.emulation.true">
670 >      <or>
671 >        <and>
672 >          <os family="windows"/>
673 >          <not>
674 >            <isset property="build.emulation"/>
675 >          </not>
676 >        </and>
677 >        <istrue value="${build.emulation}"/>
678 >      </or>
679 >    </condition>
680 >
681 >  </target>
682 >
683 >
684 >  <target name="configure-tests"
685 >       depends="configure-compiler">
686 >
687 >    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
688      <available property="junit.available"
689 <               classname="junit.framework.TestCase"/>
690 <    <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>
689 >               classname="junit.framework.Protectable"/>
690 >
691 >    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
692 >          unless="junit.available"/>
693 >
694 >
695 >    <!--
696 >     ! Bootclasspath munging for testing, so JUnit can test our local
697 >     ! modifications to java.*.
698 >     -->
699 >
700 >    <path id="test.classpath">
701 >      <pathelement location="${product.jar}"/>
702 >      <pathelement location="${build.testcases.dir}"/>
703 >      <pathelement location="${junit.jar}"/>
704 >    </path>
705 >
706 >    <path id="test.compile.bootclasspath">
707 >      <pathelement location="${javac.jar}"/>
708 >      <pathelement location="${collect.jar}"/>
709 >      <pathelement location="${rt.jar}"/>
710 >    </path>
711 >
712 >    <path id="test.run.bootclasspath">
713 >      <pathelement location="${javac.jar}"/>
714 >      <path refid="test.classpath"/>
715 >    </path>
716 >
717 >    <!-- Flatten test classpaths into platform-appropriate strings -->
718 >    <property name="test.classpath"             refid="test.classpath"/>
719 >    <property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/>
720 >    <property name="test.run.bootclasspath"     refid="test.run.bootclasspath"/>
721 >
722 >  </target>
723 >
724 >
725 >
726 >  <!-- Anthill targets -->
727 >
728 >  <target name="anthill-build"
729 >          depends="jar, test, docs, dist-docs"/>
730 >
731 >  <target name="anthill-publish">
732 >
733 >    <copy todir="${deployDir}/docs/private">
734 >      <fileset dir="${build.javadocs.dir}"/>
735 >    </copy>
736 >
737 >    <copy todir="${deployDir}/docs/public">
738 >      <fileset dir="${dist.javadocs.dir}"/>
739 >    </copy>
740 >
741 >    <copy tofile="${deployDir}/index.html"
742 >          file="${basedir}/etc/anthill-index.html"/>
743 >
744 >    <copy todir="${deployDir}/notes">
745 >      <fileset dir="${basedir}/etc/notes"/>
746 >    </copy>
747 >
748 >  </target>
749 >
750 >
751 >  <target name="ng" depends="test">
752 >    <java classname="SuperfluousAbstract" fork="true">
753 >
754 >      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
755 >
756 >    </java>
757    </target>
758  
759  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines