/[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.31 by tim, Wed May 28 21:15:50 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 examples.
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 40  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"/>
29      <property name="build.novariance.arg" value=""/>
30    
31    <!-- Build locations -->    <!-- Build locations -->
32    <property name="build.dir"            location="build"/>    <property name="build.dir"            location="build"/>
# Line 74  ant [target], where target is one of: Line 61  ant [target], where target is one of:
61    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
62    
63    
64    
65    <!--    <!--
66     ! Bootclasspath munging for source compilation.     ! Bootclasspath munging for source compilation.
67     -->     -->
68    
69    <path id="javac.bootclasspath.prepend">    <path id="javac.bootclasspath.prefix">
70      <!-- <pathelement location="${src.dir}"/> -->      <!-- <pathelement location="${src.dir}"/> -->
71      <pathelement location="${javac.jar}"/>      <pathelement location="${javac.jar}"/>
72    </path>    </path>
# Line 90  ant [target], where target is one of: Line 78  ant [target], where target is one of:
78    </path>    </path>
79    
80    <!-- Flatten bootclasspath prefix into a platform-appropriate string -->    <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
81    <property name="javac.bootclasspath.prepend" refid="javac.bootclasspath.prepend"/>    <property name="javac.bootclasspath.prefix"
82               refid="javac.bootclasspath.prefix"/>
83    
84    <!-- Turn the flattened bootclasspath prefix into a javac argument -->    <!-- Turn the flattened bootclasspath prefix into a javac argument -->
85    <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prepend}'/>    <property name="build.bootclasspath.arg"
86               value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>
87    
88    
89    <!--    <!--
# Line 111  ant [target], where target is one of: Line 101  ant [target], where target is one of:
101    <property name="test.classpath" refid="test.classpath"/>    <property name="test.classpath" refid="test.classpath"/>
102    
103    <!-- Turn the flattened test classpath into a javac argument -->    <!-- Turn the flattened test classpath into a javac argument -->
104    <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>    <property name="test.bootclasspath.arg"
105               value='-Xbootclasspath/p:${test.classpath}'/>
106    
107    
108    
109      <!-- Files excluded from emulation and dist-docs -->
110      <patternset id="emulation.excludes">
111        <exclude name="java/util/Random.*"/>
112        <exclude name="sun/misc/Unsafe.*"/>
113      </patternset>
114    
115    
116    
117    <!-- Main targets -->    <!-- Main targets -->
118    
119    <target name="compile" depends="init"    <target name="compile"
120              depends="init"
121            description="Compiles main sources to build folder">            description="Compiles main sources to build folder">
122    
123      <mkdir dir="${build.classes.dir}"/>      <mkdir dir="${build.classes.dir}"/>
# Line 131  ant [target], where target is one of: Line 131  ant [target], where target is one of:
131               fork="true">               fork="true">
132    
133        <bootclasspath refid="javac.bootclasspath"/>        <bootclasspath refid="javac.bootclasspath"/>
134        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <compilerarg line="${build.javac.args}"/>
135    
136      </javac>      </javac>
137    
138    </target>    </target>
139    
140    
141    <target name="jar" depends="native-jar, emulation-jar"/>    <target name="jar"
142              depends="check-emulation, init-jar, native-jar, emulation-jar"
143              description="Builds library jar from compiled sources"/>
144    
145    
146    <target name="test" depends="init, check-junit, report-tests"    <target name="test"
147            description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)"            depends="init, check-junit, report-tests"
148    />            description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
149    
150    
151    <target name="checkstyle" depends="filter-src"    <target name="checkstyle"
152              depends="filter-src"
153            description="Reports on style errors in Java source (verbose, mostly chaff)">            description="Reports on style errors in Java source (verbose, mostly chaff)">
154    
155      <taskdef resource="checkstyletask.properties"      <taskdef resource="checkstyletask.properties"
# Line 160  ant [target], where target is one of: Line 163  ant [target], where target is one of:
163    </target>    </target>
164    
165    
166    <target name="doccheck" depends="filter-src"    <target name="doccheck"
167              depends="filter-src"
168            description="Reports on javadoc style errors (not working yet)">            description="Reports on javadoc style errors (not working yet)">
169    
170      <delete dir="${build.doccheck.dir}"/>      <delete dir="${build.doccheck.dir}"/>
# Line 175  ant [target], where target is one of: Line 179  ant [target], where target is one of:
179    </target>    </target>
180    
181    
182    <target name="docs" depends="filter-src"    <target name="docs"
183              depends="filter-src"
184            description="Builds javadocs with custom tags to build folder">            description="Builds javadocs with custom tags to build folder">
185    
186      <delete dir="${build.javadocs.dir}"/>      <delete dir="${build.javadocs.dir}"/>
# Line 187  ant [target], where target is one of: Line 192  ant [target], where target is one of:
192                source="${build.docsourcelevel}">                source="${build.docsourcelevel}">
193    
194        <tag name="revised" description="Last revised:"/>        <tag name="revised" description="Last revised:"/>
195        <tag name="spec" description="Specified by:"/>        <tag name="spec"    description="Specified by:"/>
196        <tag name="editor" description="Last edited by:"/>        <tag name="editor"  description="Last edited by:"/>
197        <tag name="fixme" description="FIX ME:"/>        <tag name="fixme"   description="FIX ME:"/>
198    
199        <packageset dir="${build.filter.src.dir}"/>        <packageset dir="${build.filter.src.dir}"/>
200    
201      </javadoc>      </javadoc>
# Line 197  ant [target], where target is one of: Line 203  ant [target], where target is one of:
203    </target>    </target>
204    
205    
206    <!--    <target name="strip"
207     # javac -s doesn't reliably generate compilable code. It generates            depends="init"
208     # bridge methods (marked as "synthetic") that can have identical            description="Strip generics from java source (not working yet)">
    # signatures to existing methods except for the return value.  
    -->  
   <target name="strip" depends="init">  
209    
210      <mkdir dir="${build.stripped.dir}"/>      <mkdir dir="${build.stripped.dir}"/>
211    
212        <!--
213         # javac -s doesn't reliably generate compilable code. It generates
214         # bridge methods (marked as "synthetic") that can have identical
215         # signatures to existing methods except for the return value.
216         -->
217      <javac srcdir="${src.dir}"      <javac srcdir="${src.dir}"
218            destdir="${build.stripped.dir}"            destdir="${build.stripped.dir}"
219              debug="${build.debug}"              debug="${build.debug}"
# Line 215  ant [target], where target is one of: Line 223  ant [target], where target is one of:
223               fork="true">               fork="true">
224    
225        <bootclasspath refid="javac.bootclasspath"/>        <bootclasspath refid="javac.bootclasspath"/>
226        <compilerarg line="${javac.args} ${build.warnings.option} -s"/>        <compilerarg line="${build.javac.args} -s"/>
227    
228      </javac>      </javac>
229    
230    </target>    </target>
231    
232    
233    <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"    <target name="dist"
234              depends="init, dist-clean, dist-jar, dist-docs"
235            description="Puts all distributable products in single hierarchy"/>            description="Puts all distributable products in single hierarchy"/>
236    
237    
# Line 244  ant [target], where target is one of: Line 253  ant [target], where target is one of:
253    </target>    </target>
254    
255    
256    <!-- Anthill targets -->    <target name="dist-docs"
257              depends="filter-src"
258              description="Builds javadocs without custom tags to dist folder">
259    
260    <!-- Should really run the tests instead of just the jar target -->      <delete dir="${dist.javadocs.dir}"/>
261    <target name="anthill-build" depends="jar, test, docs, dist-docs"/>      <mkdir dir="${dist.javadocs.dir}"/>
262    
263        <javadoc destdir="${dist.javadocs.dir}"
264                    link="http://java.sun.com/j2se/1.4.1/docs/api"
265                overview="${src.dir}/intro.html"
266                  source="${build.docsourcelevel}">
267    
268          <packageset dir="${build.filter.src.dir}"/>
269    
270        </javadoc>
271    
   <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>  
272    </target>    </target>
273    
274    
275    
276    <!-- Internal targets -->    <!-- Internal targets -->
277    
278    <target name="set-warnings-if" if="build.warnings">    <target name="set-warnings-if" if="build.warnings">
279    
280      <property name="build.warnings.option" value="-warnunchecked"/>      <property name="build.warnings.arg" value="-warnunchecked"/>
281    
282    </target>    </target>
283    
284    
285    <target name="set-warnings-unless" unless="build.warnings">    <target name="set-warnings-unless" unless="build.warnings">
286    
287      <property name="build.warnings.option" value=""/>      <property name="build.warnings.arg" value=""/>
288    
289    </target>    </target>
290    
291    
292    <target name="init" depends="set-warnings-if, set-warnings-unless">    <target name="init"
293              depends="set-warnings-if, set-warnings-unless">
294    
295      <!-- Version is kept in a separate file -->      <!-- Version is kept in a separate file -->
296      <loadfile property="version" srcFile="version.properties"/>      <loadfile property="version" srcFile="version.properties"/>
297      <echo>Building JSR-166 version ${version}</echo>      <echo>Building JSR-166 version ${version}</echo>
298    
299        <!-- Common options in javac invocations -->
300        <property name="build.javac.args"
301                 value="${build.bootclasspath.arg} ${build.warnings.arg} ${build.novariance.arg}"/>
302    
303    </target>    </target>
304    
305    
306    <target name="native-jar" depends="compile"    <target name="init-jar">
           description="Builds library jar from compiled sources">  
307    
308      <mkdir dir="${build.lib.dir}"/>      <mkdir dir="${build.lib.dir}"/>
309    
310      </target>
311    
312    
313      <target name="native-jar"
314              depends="compile"
315              unless="build.emulation.true">
316    
317      <jar destfile="${product.jar}">      <jar destfile="${product.jar}">
318        <fileset dir="${build.classes.dir}"/>        <fileset dir="${build.classes.dir}"/>
319      </jar>      </jar>
# Line 301  ant [target], where target is one of: Line 321  ant [target], where target is one of:
321    </target>    </target>
322    
323    
324    <target name="compile-emulation" depends="init"    <target name="compile-emulation"
325            if="build.emulation"            depends="init"
326            description="Compiles emulation sources to build folder">            if="build.emulation.true">
327    
328      <mkdir dir="${build.emulation.dir}"/>      <mkdir dir="${build.emulation.dir}"/>
329    
# Line 316  ant [target], where target is one of: Line 336  ant [target], where target is one of:
336               fork="true">               fork="true">
337    
338        <bootclasspath refid="javac.bootclasspath"/>        <bootclasspath refid="javac.bootclasspath"/>
339        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <compilerarg line="${build.javac.args}"/>
340    
341      </javac>      </javac>
342    
343    </target>    </target>
344    
345    
346    <target name="emulation-jar" depends="native-jar, compile-emulation"    <target name="emulation-jar"
347            if="build.emulation">            depends="compile-emulation"
348              if="build.emulation.true">
349    
350    
351      <jar destfile="${product.jar}" update="true" duplicate="add">      <jar destfile="${product.jar}" duplicate="add">
352          <fileset dir="${build.classes.dir}">
353            <patternset refid="emulation.excludes"/>
354          </fileset>
355        <fileset dir="${build.emulation.dir}"/>        <fileset dir="${build.emulation.dir}"/>
356      </jar>      </jar>
357    
358    </target>    </target>
359    
360    
361    <target name="dist-jar" depends="clean, jar">    <target name="dist-jar"
362              depends="clean, jar">
363    
364      <copy file="${product.jar}" todir="${dist.dir}"/>      <copy file="${product.jar}" todir="${dist.dir}"/>
365    
366    </target>    </target>
367    
368    
369    <target name="dist-docs" depends="filter-src"    <target name="compile-ant-filter"
370            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">  
371    
372      <mkdir dir="${build.ant.dir}"/>      <mkdir dir="${build.ant.dir}"/>
373    
# Line 370  ant [target], where target is one of: Line 379  ant [target], where target is one of:
379    </target>    </target>
380    
381    
382    <target name="filter-src" depends="compile-ant-filter">    <target name="filter-src"
383              depends="compile-ant-filter">
384    
385      <mkdir dir="${build.filter.src.dir}"/>      <mkdir dir="${build.filter.src.dir}"/>
386    
387      <copy todir="${build.filter.src.dir}">      <copy todir="${build.filter.src.dir}">
388        <fileset dir="${src.dir}">        <fileset dir="${src.dir}">
389          <include name="**/*.java"/>          <include name="**/*.html"/>
390          <exclude name="**/Random.java"/>        </fileset>
391          <exclude name="**/Unsafe.java"/>      </copy>
392    
393        <copy todir="${build.filter.src.dir}">
394          <fileset dir="${src.dir}">
395            <exclude name="**/*.html"/>
396            <patternset refid="emulation.excludes"/>
397        </fileset>        </fileset>
398        <filterchain>        <filterchain>
399          <filterreader classname="jsr166.ant.filters.ReplaceFilter"          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
# Line 416  ant [target], where target is one of: Line 431  ant [target], where target is one of:
431    </target>    </target>
432    
433    
434    <target name="compile-tests" depends="jar">    <target name="compile-tests"
435              depends="jar">
436    
437      <mkdir dir="${build.testcases.dir}"/>      <mkdir dir="${build.testcases.dir}"/>
438    
# Line 428  ant [target], where target is one of: Line 444  ant [target], where target is one of:
444             source="${build.sourcelevel}"             source="${build.sourcelevel}"
445               fork="true">               fork="true">
446    
       <bootclasspath refid="javac.bootclasspath"/>  
       <compilerarg line="${javac.args} ${build.warnings.option}"/>  
447        <classpath refid="test.classpath"/>        <classpath refid="test.classpath"/>
448          <bootclasspath refid="javac.bootclasspath"/>
449          <compilerarg line="${build.javac.args}"/>
450    
451      </javac>      </javac>
452    
453    </target>    </target>
454    
455    
456    <target name="run-tests" depends="compile-tests">    <target name="run-tests"
457              depends="compile-tests">
458    
459      <!-- May be overridden by user.properties -->      <!-- May be overridden by user.properties -->
460      <property name="testcase" value="*"/>      <property name="testcase" value="*"/>
# Line 451  ant [target], where target is one of: Line 468  ant [target], where target is one of:
468                      dir="${build.reports.dir}"                      dir="${build.reports.dir}"
469                     fork="true">                     fork="true">
470    
471        <jvmarg value="${test.javac.args}"/>        <jvmarg value="${test.bootclasspath.arg}"/>
472    
473        <formatter type="xml"/>        <formatter type="xml"/>
474    
# Line 466  ant [target], where target is one of: Line 483  ant [target], where target is one of:
483    </target>    </target>
484    
485    
486    <target name="report-tests" depends="run-tests">    <target name="report-tests"
487              depends="run-tests">
488    
489      <!-- Sets junit.report.format to frames if Xalan is present,      <!-- Sets junit.report.format to frames if Xalan is present,
490           otherwise sets it to noframes. -->           otherwise sets it to noframes. -->
491      <available property="junit.report.format"      <available property="junit.report.format"
# Line 486  ant [target], where target is one of: Line 505  ant [target], where target is one of:
505      </junitreport>      </junitreport>
506    
507      <fail message="Test Cases Failed" if="junit.failed"/>      <fail message="Test Cases Failed" if="junit.failed"/>
508    
509    </target>    </target>
510    
511    
512    <target name="check-junit">    <target name="check-junit">
513      <!-- FIXME: this test isn't specific enough -->  
514        <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
515      <available property="junit.available"      <available property="junit.available"
516                 classname="junit.framework.TestCase"/>                 classname="junit.framework.Protectable"/>
517      <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>  
518        <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
519              unless="junit.available"/>
520    
521      </target>
522    
523    
524      <target name="check-emulation">
525        <condition property="build.emulation.true">
526          <or>
527            <isset property="build.emulation"/>
528            <os family="windows"/>
529          </or>
530        </condition>
531      </target>
532    
533    
534    
535      <!-- Anthill targets -->
536    
537      <target name="anthill-build"
538              depends="jar, test, docs, dist-docs"/>
539    
540      <target name="anthill-publish">
541    
542        <copy todir="${deployDir}/docs/private">
543          <fileset dir="${build.javadocs.dir}"/>
544        </copy>
545    
546        <copy todir="${deployDir}/docs/public">
547          <fileset dir="${dist.javadocs.dir}"/>
548        </copy>
549    
550        <copy tofile="${deployDir}/index.html"
551              file="${basedir}/etc/anthill-index.html"/>
552    
553        <copy todir="${deployDir}/notes">
554          <fileset dir="${basedir}/etc/notes"/>
555        </copy>
556    
557    </target>    </target>
558    
559    

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

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