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

Diff of /jsr166/build.xml

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

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

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.47

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