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

Diff of /jsr166/build.xml

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

revision 1.29 by tim, Wed May 28 14:09:03 2003 UTC revision 1.43 by tim, Thu Jun 26 11:54:26 2003 UTC
# Line 7  Line 7 
7    Usage: ant [target]    Usage: ant [target]
8    
9    User-specific settings are read from user.properties.    User-specific settings are read from user.properties.
10    See user.properties.sample for examples.    See user.properties.sample for an explanation of some useful settings.
11  ------------------------------------------------------------------------------  ------------------------------------------------------------------------------
12    </description>    </description>
13    
# Line 54  Line 54 
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    
60    
61    
62    <!--    <!-- Files excluded from dist-docs and emulation jar -->
63     ! Bootclasspath munging for source compilation.    <patternset id="unsafe.exclusion">
    -->  
   
   <path id="javac.bootclasspath.prefix">  
     <!-- <pathelement location="${src.dir}"/> -->  
     <pathelement location="${javac.jar}"/>  
   </path>  
   
   <path id="javac.bootclasspath">  
     <!-- <pathelement location="${src.dir}"/> -->  
     <pathelement location="${collect.jar}"/>  
     <pathelement location="${rt.jar}"/>  
   </path>  
   
   <!-- Flatten bootclasspath prefix into a platform-appropriate string -->  
   <property name="javac.bootclasspath.prefix" refid="javac.bootclasspath.prefix"/>  
   
   <!-- Turn the flattened bootclasspath prefix into a javac argument -->  
   <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>  
   
   
   
   <!--  
    ! 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}'/>  
   
   
   
   <!-- Files excluded from emulation and dist-docs -->  
   <patternset id="emulation.excludes">  
64      <exclude name="java/util/Random.*"/>      <exclude name="java/util/Random.*"/>
65      <exclude name="sun/misc/Unsafe.*"/>      <exclude name="sun/misc/Unsafe.*"/>
66    </patternset>    </patternset>
67    
68      <!-- 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"    <target name="compile"
81            depends="init"            depends="init, configure-compiler, prepare-src"
82            description="Compiles main sources to build folder">            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    
88      <javac srcdir="${src.dir}"  <!--
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 127  Line 98 
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    
# Line 136  Line 107 
107    
108    
109    <target name="jar"    <target name="jar"
110            depends="native-jar, emulation-jar"            depends="configure-emulation, init-jar, native-jar, emulation-jar"
111            description="Builds library jar from compiled sources"/>            description="Builds library jar from compiled sources"/>
112    
113    
114    <target name="test"    <target name="test"
115            depends="init, check-junit, report-tests"            depends="init, configure-tests, report-tests"
116            description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />            description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
117    
118    
# Line 200  Line 171 
171    </target>    </target>
172    
173    
   <!--  
    # javac -s doesn't reliably generate compilable code. It generates  
    # bridge methods (marked as "synthetic") that can have identical  
    # signatures to existing methods except for the return value.  
    -->  
174    <target name="strip"    <target name="strip"
175            depends="init">            depends="init, configure-compiler"
176              description="Strip generics from java source (not working yet)">
177    
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 218  Line 190 
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    
# Line 230  Line 202 
202            depends="init, dist-clean, dist-jar, dist-docs"            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">
# Line 271  Line 259 
259    
260    <!-- Internal targets -->    <!-- Internal targets -->
261    
   <target name="set-warnings-if" if="build.warnings">  
262    
263      <property name="build.warnings.option" value="-warnunchecked"/>    <target name="init">
   
   </target>  
   
   
   <target name="set-warnings-unless" unless="build.warnings">  
   
     <property name="build.warnings.option" value=""/>  
   
   </target>  
   
   
   <target name="init"  
           depends="set-warnings-if, set-warnings-unless">  
264    
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"/>
# Line 303  Line 277 
277    
278    
279    <target name="native-jar"    <target name="native-jar"
280            depends="compile, init-jar"            depends="compile"
281            unless="build.emulation">            unless="build.emulation.true">
282    
283      <jar destfile="${product.jar}">      <jar destfile="${product.jar}">
284        <fileset dir="${build.classes.dir}"/>        <fileset dir="${build.classes.dir}"/>
# Line 313  Line 287 
287    </target>    </target>
288    
289    
   <target name="base-jar"  
           depends="compile, init-jar">  
   
   </target>  
   
   
290    <target name="compile-emulation"    <target name="compile-emulation"
291            depends="init"            depends="init, configure-compiler"
292            if="build.emulation">            if="build.emulation.true">
293    
294      <mkdir dir="${build.emulation.dir}"/>      <mkdir dir="${build.emulation.dir}"/>
295    
# Line 333  Line 301 
301             source="${build.sourcelevel}"             source="${build.sourcelevel}"
302               fork="true">               fork="true">
303    
304        <bootclasspath refid="javac.bootclasspath"/>        <compilerarg    line="${gjc.args}"/>
305        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <bootclasspath refid="compile.bootclasspath"/>
306    
307      </javac>      </javac>
308    
# Line 342  Line 310 
310    
311    
312    <target name="emulation-jar"    <target name="emulation-jar"
313            depends="init-jar, compile-emulation"            depends="compile-emulation"
314            if="build.emulation">            if="build.emulation.true">
315    
316    
317      <jar destfile="${product.jar}" duplicate="add">      <jar destfile="${product.jar}" duplicate="add">
318        <fileset dir="${build.classes.dir}">        <fileset dir="${build.classes.dir}">
319          <patternset refid="emulation.excludes"/>          <patternset refid="atomic.exclusion"/>
320            <patternset refid="unsafe.exclusion"/>
321        </fileset>        </fileset>
322        <fileset dir="${build.emulation.dir}"/>        <fileset dir="${build.emulation.dir}"/>
323      </jar>      </jar>
# Line 384  Line 353 
353    
354      <copy todir="${build.filter.src.dir}">      <copy todir="${build.filter.src.dir}">
355        <fileset dir="${src.dir}">        <fileset dir="${src.dir}">
356          <patternset refid="emulation.excludes"/>          <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}">
367          <fileset dir="${src.dir}">
368            <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    
# Line 427  Line 441 
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 435  Line 455 
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    
# Line 459  Line 479 
479                      dir="${build.reports.dir}"                      dir="${build.reports.dir}"
480                     fork="true">                     fork="true">
481    
482        <jvmarg value="${test.javac.args}"/>        <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
483    
484        <formatter type="xml"/>        <formatter type="xml"/>
485    
# Line 500  Line 520 
520    </target>    </target>
521    
522    
523    <target name="check-junit">    <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>
601    
602    
603      <target name="configure-emulation">
604    
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 -->      <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
624      <available property="junit.available"      <available property="junit.available"
# Line 509  Line 627 
627      <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"      <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
628            unless="junit.available"/>            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>    </target>
659    
660    
# Line 538  Line 684 
684    </target>    </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>
694    
695    
696  </project>  </project>

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

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