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

Diff of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.48

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8