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

Diff of /jsr166/build.xml

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

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

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.50

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