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

Diff of /jsr166/build.xml

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

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

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.43

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