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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines