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

Diff of /jsr166/build.xml

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

revision 1.28 by tim, Wed May 28 13:37:59 2003 UTC revision 1.40 by tim, Fri Jun 6 18:34:44 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 68  ant [target], where target is one of: Line 54  ant [target], where target is one of:
54    
55    <!-- Jar locations -->    <!-- Jar locations -->
56    <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>    <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>
   <property name="javac.jar"            location="${lib.dir}/javac.jar"/>  
   <property name="collect.jar"          location="${lib.dir}/collect.jar"/>  
57    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
58    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
59    
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/AtomicInteger*"/>
71        <exclude name="java/util/concurrent/atomic/AtomicLong*"/>
72        <exclude name="java/util/concurrent/atomic/AtomicReference*"/>
73      </patternset>
74    
75    
76    
77    <!-- Main targets -->    <!-- Main targets -->
78    
79    <target name="compile"    <target name="compile"
80            depends="init"            depends="init, configure-compiler, prepare-src"
81            description="Compiles main sources to build folder">            description="Compiles main sources to build folder">
82    
83        <property name="prepare.src.dir" value="${src.dir}"/>
84    
85      <mkdir dir="${build.classes.dir}"/>      <mkdir dir="${build.classes.dir}"/>
86    
87      <javac srcdir="${src.dir}"  <!--
88        <echo>javac ${gjc.args}</echo>
89        <echo>bootclasspath=${compile.bootclasspath}</echo>
90    -->
91    
92        <javac srcdir="${prepare.src.dir}"
93            destdir="${build.classes.dir}"            destdir="${build.classes.dir}"
94              debug="${build.debug}"              debug="${build.debug}"
95         debuglevel="${build.debuglevel}"         debuglevel="${build.debuglevel}"
# Line 141  ant [target], where target is one of: Line 97  ant [target], where target is one of:
97             source="${build.sourcelevel}"             source="${build.sourcelevel}"
98               fork="true">               fork="true">
99    
100        <bootclasspath refid="javac.bootclasspath"/>        <compilerarg    line="${gjc.args}"/>
101        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <bootclasspath refid="compile.bootclasspath"/>
102    
103      </javac>      </javac>
104    
# Line 150  ant [target], where target is one of: Line 106  ant [target], where target is one of:
106    
107    
108    <target name="jar"    <target name="jar"
109            depends="native-jar, emulation-jar"            depends="configure-emulation, init-jar, native-jar, emulation-jar"
110            description="Builds library jar from compiled sources"/>            description="Builds library jar from compiled sources"/>
111    
112    
113    <target name="test"    <target name="test"
114            depends="init, check-junit, report-tests"            depends="init, configure-tests, report-tests"
115            description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)" />            description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
116    
117    
118    <target name="checkstyle"    <target name="checkstyle"
# Line 203  ant [target], where target is one of: Line 159  ant [target], where target is one of:
159                source="${build.docsourcelevel}">                source="${build.docsourcelevel}">
160    
161        <tag name="revised" description="Last revised:"/>        <tag name="revised" description="Last revised:"/>
162        <tag name="spec" description="Specified by:"/>        <tag name="spec"    description="Specified by:"/>
163        <tag name="editor" description="Last edited by:"/>        <tag name="editor"  description="Last edited by:"/>
164        <tag name="fixme" description="FIX ME:"/>        <tag name="fixme"   description="FIX ME:"/>
165    
166        <packageset dir="${build.filter.src.dir}"/>        <packageset dir="${build.filter.src.dir}"/>
167    
168      </javadoc>      </javadoc>
# Line 213  ant [target], where target is one of: Line 170  ant [target], where target is one of:
170    </target>    </target>
171    
172    
   <!--  
    # 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.  
    -->  
173    <target name="strip"    <target name="strip"
174            depends="init">            depends="init, configure-compiler"
175              description="Strip generics from java source (not working yet)">
176    
177      <mkdir dir="${build.stripped.dir}"/>      <mkdir dir="${build.stripped.dir}"/>
178    
179        <!--
180         # javac -s doesn't reliably generate compilable code. It generates
181         # bridge methods (marked as "synthetic") that can have identical
182         # signatures to existing methods except for the return value.
183         -->
184      <javac srcdir="${src.dir}"      <javac srcdir="${src.dir}"
185            destdir="${build.stripped.dir}"            destdir="${build.stripped.dir}"
186              debug="${build.debug}"              debug="${build.debug}"
# Line 231  ant [target], where target is one of: Line 189  ant [target], where target is one of:
189             source="${build.sourcelevel}"             source="${build.sourcelevel}"
190               fork="true">               fork="true">
191    
192        <bootclasspath refid="javac.bootclasspath"/>        <compilerarg    line="${gjc.args} -s"/>
193        <compilerarg line="${javac.args} ${build.warnings.option} -s"/>        <bootclasspath refid="compile.bootclasspath"/>
194    
195      </javac>      </javac>
196    
# Line 284  ant [target], where target is one of: Line 242  ant [target], where target is one of:
242    
243    <!-- Internal targets -->    <!-- Internal targets -->
244    
   <target name="set-warnings-if" if="build.warnings">  
   
     <property name="build.warnings.option" value="-warnunchecked"/>  
   
   </target>  
245    
246      <target name="init">
   <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">  
247    
248      <!-- Version is kept in a separate file -->      <!-- Version is kept in a separate file -->
249      <loadfile property="version" srcFile="version.properties"/>      <loadfile property="version" srcFile="version.properties"/>
# Line 316  ant [target], where target is one of: Line 260  ant [target], where target is one of:
260    
261    
262    <target name="native-jar"    <target name="native-jar"
263            depends="compile, init-jar"            depends="compile"
264            unless="build.emulation">            unless="build.emulation.true">
265    
266      <jar destfile="${product.jar}">      <jar destfile="${product.jar}">
267        <fileset dir="${build.classes.dir}"/>        <fileset dir="${build.classes.dir}"/>
# Line 326  ant [target], where target is one of: Line 270  ant [target], where target is one of:
270    </target>    </target>
271    
272    
   <target name="base-jar"  
           depends="compile, init-jar">  
   
     <jar destfile="${product.jar}">  
       <fileset dir="${build.classes.dir}">  
         <patternset refid="emulation.excludes"/>  
       </fileset>  
     </jar>  
   
   </target>  
   
   
273    <target name="compile-emulation"    <target name="compile-emulation"
274            depends="init"            depends="init, configure-compiler"
275            if="build.emulation">            if="build.emulation.true">
276    
277      <mkdir dir="${build.emulation.dir}"/>      <mkdir dir="${build.emulation.dir}"/>
278    
# Line 352  ant [target], where target is one of: Line 284  ant [target], where target is one of:
284             source="${build.sourcelevel}"             source="${build.sourcelevel}"
285               fork="true">               fork="true">
286    
287        <bootclasspath refid="javac.bootclasspath"/>        <compilerarg    line="${gjc.args}"/>
288        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <bootclasspath refid="compile.bootclasspath"/>
289    
290      </javac>      </javac>
291    
# Line 361  ant [target], where target is one of: Line 293  ant [target], where target is one of:
293    
294    
295    <target name="emulation-jar"    <target name="emulation-jar"
296            depends="base-jar, compile-emulation"            depends="compile-emulation"
297            if="build.emulation">            if="build.emulation.true">
298    
299      <jar destfile="${product.jar}" update="true" duplicate="add">  
300        <jar destfile="${product.jar}" duplicate="add">
301          <fileset dir="${build.classes.dir}">
302            <patternset refid="atomic.exclusion"/>
303            <patternset refid="unsafe.exclusion"/>
304          </fileset>
305        <fileset dir="${build.emulation.dir}"/>        <fileset dir="${build.emulation.dir}"/>
306      </jar>      </jar>
307    
# Line 399  ant [target], where target is one of: Line 336  ant [target], where target is one of:
336    
337      <copy todir="${build.filter.src.dir}">      <copy todir="${build.filter.src.dir}">
338        <fileset dir="${src.dir}">        <fileset dir="${src.dir}">
339          <patternset refid="emulation.excludes"/>          <include name="**/*.html"/>
340          </fileset>
341        </copy>
342    
343        <!-- Not needed now, used for doccheck filtering:
344        <property name="generic.declarations"
345                 value="public interface E {} public interface T {} public interface K {} public interface V {}"
346        />
347        -->
348    
349        <copy todir="${build.filter.src.dir}">
350          <fileset dir="${src.dir}">
351            <exclude name="**/*.html"/>
352            <patternset refid="unsafe.exclusion"/>
353        </fileset>        </fileset>
354        <filterchain>        <filterchain>
355    
356            <!--
357             # This filter gets rid of angle-bracketed type parameters
358             # so that javadoc can run on the result. The following
359             # heuristic seems to work:
360             #
361             # For all lines not starting with space(s)-asterisk-space(s),
362             #   replace <something> with a space, where there may be more
363             #   than one right angle bracket at the end, and "something"
364             #   must not contain parens or pipes. (This may need some
365             #   tweaking.)
366             -->
367    
368          <filterreader classname="jsr166.ant.filters.ReplaceFilter"          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
369                        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.)  
            -->  
370            <param name="notmatching" value="^\s+\*\s.*$"/>            <param name="notmatching" value="^\s+\*\s.*$"/>
371            <param name="pattern" value="&lt;[^|>()]+?>+"/>            <param name="pattern"     value="&lt;[^|>()]+?>+"/>
372            <param name="replacement" value=" "/>            <param name="replacement" value=" "/>
373          </filterreader>          </filterreader>
374    
375    
376            <!--
377             # This filter uncomments lines beginning with "//@" so that
378             # javadoc can see imports that are needed to resolve links
379             # but that shouldn't be in the compiled code.
380             -->
381    
382          <filterreader classname="jsr166.ant.filters.ReplaceFilter"          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
383                        classpath="${build.ant.dir}">                        classpath="${build.ant.dir}">
384            <!--            <param name="matching"    value="^//@.*$"/>
385             # 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="^//@"/>  
386            <param name="replacement" value=""/>            <param name="replacement" value=""/>
387          </filterreader>          </filterreader>
388    
389    
390            <!--
391             # The next two filters try to make the source look like
392             # something that doccheck can process. The first removes
393             # -source 1.4 assertions and the second adds in a bunch
394             # of single letter public nested marker interfaces so that
395             # the generic type parameters are recognized.
396             #
397             # Currently commented out because doccheck doesn't work. :-(
398             -->
399    
400            <!--
401            <filterreader classname="jsr166.ant.filters.ReplaceFilter"
402                          classpath="${build.ant.dir}">
403              <param name="matching"    value="^\s*assert[\s ].*$"/>
404              <param name="pattern"     value="assert"/>
405              <param name="replacement" value="//assert"/>
406            </filterreader>
407    
408            <filterreader classname="jsr166.ant.filters.ReplaceFilter"
409                          classpath="${build.ant.dir}">
410              <param name="matching"    value="^(.*(class|interface|implements) .*|)\{.*$"/>
411              <param name="pattern"     value="$"/>
412              <param name="replacement" value=" ${generic.declarations}"/>
413            </filterreader>
414            -->
415    
416        </filterchain>        </filterchain>
417      </copy>      </copy>
418    
# Line 442  ant [target], where target is one of: Line 424  ant [target], where target is one of:
424    
425      <mkdir dir="${build.testcases.dir}"/>      <mkdir dir="${build.testcases.dir}"/>
426    
427    <!--
428        <echo>javac ${gjc.args}</echo>
429        <echo>bootclasspath=${test.compile.bootclasspath}</echo>
430        <echo>classpath="${test.classpath}"</echo>
431    -->
432    
433      <javac srcdir="${test.src.dir}"      <javac srcdir="${test.src.dir}"
434            destdir="${build.testcases.dir}"            destdir="${build.testcases.dir}"
435              debug="${build.debug}"              debug="${build.debug}"
# Line 450  ant [target], where target is one of: Line 438  ant [target], where target is one of:
438             source="${build.sourcelevel}"             source="${build.sourcelevel}"
439               fork="true">               fork="true">
440    
441        <bootclasspath refid="javac.bootclasspath"/>        <compilerarg    line="${gjc.args}"/>
442        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <bootclasspath refid="test.compile.bootclasspath"/>
443        <classpath refid="test.classpath"/>        <classpath     refid="test.classpath"/>
444    
445      </javac>      </javac>
446    
# Line 474  ant [target], where target is one of: Line 462  ant [target], where target is one of:
462                      dir="${build.reports.dir}"                      dir="${build.reports.dir}"
463                     fork="true">                     fork="true">
464    
465        <jvmarg value="${test.javac.args}"/>        <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
466    
467        <formatter type="xml"/>        <formatter type="xml"/>
468    
# Line 515  ant [target], where target is one of: Line 503  ant [target], where target is one of:
503    </target>    </target>
504    
505    
506    <target name="check-junit">    <target name="configure-compiler">
507    
508        <property name="gjc.version"
509                 value="2.0"/>
510    
511        <condition property="novariance.arg" value="-novariance">
512          <and>
513            <equals arg1="${gjc.version}" arg2="2.0"/>
514            <or>
515              <not><isset property="gjc.novariance"/></not>
516              <istrue value="${gjc.novariance}"/>
517            </or>
518          </and>
519        </condition>
520    
521        <property name="novariance.arg"
522                 value=""/>
523    
524        <property name="gjc.dir"
525                 value="${lib.dir}/gjc"/>
526    
527        <property name="javac.jar"
528              location="${gjc.dir}/${gjc.version}/javac.jar"/>
529    
530        <property name="collect.jar"
531              location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/>
532    
533    
534        <condition property="warnunchecked.arg" value="-warnunchecked">
535          <istrue value="${gjc.warnunchecked}"/>
536        </condition>
537    
538        <property name="warnunchecked.arg" value=""/>
539    
540        <condition property="prepare.src.dir" value="${build.dir}/prepare-src">
541          <istrue value="${build.nothreads}"/>
542        </condition>
543    
544    
545        <!--
546         ! Bootclasspath munging for source compilation.
547         -->
548    
549        <path id="pre.bootclasspath">
550          <pathelement location="${javac.jar}"/>
551        </path>
552    
553        <path id="compile.bootclasspath">
554          <pathelement location="${build.classes.dir}"/>
555          <pathelement location="${collect.jar}"/>
556          <pathelement location="${rt.jar}"/>
557        </path>
558    
559        <!-- Flatten paths into platform-appropriate strings -->
560        <property name="pre.bootclasspath"     refid="pre.bootclasspath"/>
561        <property name="compile.bootclasspath" refid="compile.bootclasspath"/>
562    
563    
564        <!-- Common options in javac invocations -->
565        <property name="gjc.args"
566                 value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}"
567        />
568    
569      </target>
570    
571    
572      <target name="prepare-src"
573              depends="configure-compiler"
574              if="prepare.src.dir">
575    
576        <mkdir dir="${prepare.src.dir}"/>
577        <copy todir="${prepare.src.dir}">
578          <fileset dir="${src.dir}">
579            <exclude name="java/lang/**"/>
580          </fileset>
581        </copy>
582    
583      </target>
584    
585    
586      <target name="configure-emulation">
587    
588        <condition property="build.emulation.true">
589          <or>
590            <and>
591              <os family="windows"/>
592              <not>
593                <isset property="build.emulation"/>
594              </not>
595            </and>
596            <istrue value="${build.emulation}"/>
597          </or>
598        </condition>
599    
600      </target>
601    
602    
603      <target name="configure-tests"
604           depends="configure-compiler">
605    
606      <!-- 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 -->
607      <available property="junit.available"      <available property="junit.available"
# Line 524  ant [target], where target is one of: Line 610  ant [target], where target is one of:
610      <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"
611            unless="junit.available"/>            unless="junit.available"/>
612    
613    
614        <!--
615         ! Bootclasspath munging for testing, so JUnit can test our local
616         ! modifications to java.*.
617         -->
618    
619        <path id="test.classpath">
620          <pathelement location="${product.jar}"/>
621          <pathelement location="${build.testcases.dir}"/>
622          <pathelement location="${junit.jar}"/>
623        </path>
624    
625        <path id="test.compile.bootclasspath">
626          <pathelement location="${javac.jar}"/>
627          <pathelement location="${collect.jar}"/>
628          <pathelement location="${rt.jar}"/>
629        </path>
630    
631        <path id="test.run.bootclasspath">
632          <pathelement location="${javac.jar}"/>
633          <path refid="test.classpath"/>
634        </path>
635    
636        <!-- Flatten test classpaths into platform-appropriate strings -->
637        <property name="test.classpath"             refid="test.classpath"/>
638        <property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/>
639        <property name="test.run.bootclasspath"     refid="test.run.bootclasspath"/>
640    
641    </target>    </target>
642    
643    

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.40

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