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

Diff of /jsr166/build.xml

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

revision 1.23, Sat May 17 21:20:50 2003 UTC revision 1.28, Wed May 28 13:37:59 2003 UTC
# Line 3  Line 3 
3    <description>    <description>
4      Build file for JSR-166      Build file for JSR-166
5    
6      JUnit 1.8 must be in ${ant.home}/lib for the test target to work.      JUnit 3.8 or better must be in ${ant.home}/lib for the test target to work.
7    </description>    </description>
8    
9    
# Line 27  Line 27 
27      </echo>      </echo>
28    </target>    </target>
29    
30      <!-- User-specific settings -->
31    <property file="user.properties"/>    <property file="user.properties"/>
32    <property name="testcase" value="*"/>  
33      <!-- Set build.warnings in user.properties to turn on -warnunchecked -->
34      <!-- <property name="build.warnings" value=""/> -->
35    
36    
37    <!-- Compilation options -->    <!-- Compilation options -->
38    <property name="build.sourcelevel"    value="1.5"/>    <property name="build.sourcelevel"    value="1.5"/>
39      <property name="build.docsourcelevel" value="1.4"/>
40    <property name="build.debug"          value="true"/>    <property name="build.debug"          value="true"/>
41    <property name="build.debuglevel"     value="source,lines,vars"/>    <property name="build.debuglevel"     value="source,lines,vars"/>
42    <property name="build.deprecation"    value="false"/>    <property name="build.deprecation"    value="false"/>
   <!--  
   <property name="build.warnings"       value="true"/>  
   -->  
43    
44    <!-- Build locations -->    <!-- Build locations -->
45    <property name="build.dir"            location="build"/>    <property name="build.dir"            location="build"/>
46    <property name="build.classes.dir"    location="${build.dir}/classes"/>    <property name="build.classes.dir"    location="${build.dir}/classes"/>
47      <property name="build.emulation.dir"  location="${build.dir}/emulation"/>
48    <property name="build.testcases.dir"  location="${build.dir}/testcases"/>    <property name="build.testcases.dir"  location="${build.dir}/testcases"/>
49    <property name="build.lib.dir"        location="${build.dir}/lib"/>    <property name="build.lib.dir"        location="${build.dir}/lib"/>
50    <property name="build.ant.dir"        location="${build.dir}/ant"/>    <property name="build.ant.dir"        location="${build.dir}/ant"/>
# Line 53  Line 56 
56    
57    <!-- Source locations -->    <!-- Source locations -->
58    <property name="src.dir"              location="${basedir}/src/main"/>    <property name="src.dir"              location="${basedir}/src/main"/>
59      <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>
60    <property name="test.src.dir"         location="${basedir}/src/test"/>    <property name="test.src.dir"         location="${basedir}/src/test"/>
61    <property name="ant.src.dir"          location="${basedir}/etc/ant"/>    <property name="ant.src.dir"          location="${basedir}/etc/ant"/>
62    <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>    <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>
# Line 69  Line 73 
73    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
74    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
75    
76    <property name="javac.args"           value='-J-Xbootclasspath/p:${javac.jar}'/>  
77    
78      <!--
79       ! Bootclasspath munging for source compilation.
80       -->
81    
82      <path id="javac.bootclasspath.prefix">
83        <!-- <pathelement location="${src.dir}"/> -->
84        <pathelement location="${javac.jar}"/>
85      </path>
86    
87    <path id="javac.bootclasspath">    <path id="javac.bootclasspath">
88        <!-- <pathelement location="${src.dir}"/> -->
89      <pathelement location="${collect.jar}"/>      <pathelement location="${collect.jar}"/>
90      <pathelement location="${rt.jar}"/>      <pathelement location="${rt.jar}"/>
91    </path>    </path>
92    
93      <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
94      <property name="javac.bootclasspath.prefix" refid="javac.bootclasspath.prefix"/>
95    
96      <!-- Turn the flattened bootclasspath prefix into a javac argument -->
97      <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>
98    
99    
100    
101      <!--
102       ! Bootclasspath munging for testing, so JUnit can test our local
103       ! modifications to java.*.
104       -->
105    
106    <path id="test.classpath">    <path id="test.classpath">
107      <pathelement location="${product.jar}"/>      <pathelement location="${product.jar}"/>
108        <pathelement location="${build.testcases.dir}"/>
109        <pathelement location="${junit.jar}"/>
110    </path>    </path>
111    
112      <!-- Flatten test classpath into a platform-appropriate string -->
113      <property name="test.classpath" refid="test.classpath"/>
114    
115      <!-- Turn the flattened test classpath into a javac argument -->
116      <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>
117    
118    
119    
120      <!-- Files excluded from emulation and dist-docs -->
121      <patternset id="emulation.excludes">
122        <exclude name="java/util/Random.*"/>
123        <exclude name="sun/misc/Unsafe.*"/>
124      </patternset>
125    
126    
127    
128    <!-- Main targets -->    <!-- Main targets -->
129    
130    <target name="compile" depends="init"    <target name="compile"
131            description="Compiles all sources to build folder">            depends="init"
132              description="Compiles main sources to build folder">
133    
134      <mkdir dir="${build.classes.dir}"/>      <mkdir dir="${build.classes.dir}"/>
135    
136      <javac srcdir="${src.dir}"      <javac srcdir="${src.dir}"
137            destdir="${build.classes.dir}"            destdir="${build.classes.dir}"
138              debug="${build.debug}"              debug="${build.debug}"
# Line 98  Line 145 
145        <compilerarg line="${javac.args} ${build.warnings.option}"/>        <compilerarg line="${javac.args} ${build.warnings.option}"/>
146    
147      </javac>      </javac>
148    
149    </target>    </target>
150    
151    
152    <target name="jar" depends="compile"    <target name="jar"
153            description="Builds library jar from compiled sources">            depends="native-jar, emulation-jar"
154      <mkdir dir="${build.lib.dir}"/>            description="Builds library jar from compiled sources"/>
     <jar basedir="${build.classes.dir}"  
         destfile="${product.jar}"  
     />  
   </target>  
155    
156    
157    <target name="test" depends="init, check-junit, report-tests"    <target name="test"
158            description="Runs all tests (requires JUnit 1.8 in ${ant.home}/lib)"/>            depends="init, check-junit, report-tests"
159              description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)" />
160    
161    
162    <target name="checkstyle" depends="filter-src"    <target name="checkstyle"
163              depends="filter-src"
164            description="Reports on style errors in Java source (verbose, mostly chaff)">            description="Reports on style errors in Java source (verbose, mostly chaff)">
165    
166      <taskdef resource="checkstyletask.properties"      <taskdef resource="checkstyletask.properties"
167              classpath="${lib.dir}/checkstyle-all-2.4.jar"/>              classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
168    
# Line 123  Line 170 
170        <formatter type="plain"/>  <!-- also available: type="xml" -->        <formatter type="plain"/>  <!-- also available: type="xml" -->
171        <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>        <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
172      </checkstyle>      </checkstyle>
173    
174    </target>    </target>
175    
176    
177    <target name="doccheck" depends="filter-src"    <target name="doccheck"
178              depends="filter-src"
179            description="Reports on javadoc style errors (not working yet)">            description="Reports on javadoc style errors (not working yet)">
180    
181      <delete dir="${build.doccheck.dir}"/>      <delete dir="${build.doccheck.dir}"/>
182      <mkdir dir="${build.doccheck.dir}"/>      <mkdir dir="${build.doccheck.dir}"/>
183    
184      <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"      <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
185           docletpath="${lib.dir}/doccheck.jar"           docletpath="${lib.dir}/doccheck.jar"
186              destdir="${build.doccheck.dir}">              destdir="${build.doccheck.dir}">
187        <packageset dir="${build.filter.src.dir}"/>        <packageset dir="${build.filter.src.dir}"/>
188      </javadoc>      </javadoc>
189    
190    </target>    </target>
191    
192    
193    <target name="docs" depends="filter-src"    <target name="docs"
194              depends="filter-src"
195            description="Builds javadocs with custom tags to build folder">            description="Builds javadocs with custom tags to build folder">
196    
197      <delete dir="${build.javadocs.dir}"/>      <delete dir="${build.javadocs.dir}"/>
198      <mkdir dir="${build.javadocs.dir}"/>      <mkdir dir="${build.javadocs.dir}"/>
199    
200      <javadoc destdir="${build.javadocs.dir}"      <javadoc destdir="${build.javadocs.dir}"
201                  link="http://java.sun.com/j2se/1.4.1/docs/api"                  link="http://java.sun.com/j2se/1.4.1/docs/api"
202              overview="${src.dir}/intro.html"              overview="${src.dir}/intro.html"
203                source="${build.sourcelevel}">                source="${build.docsourcelevel}">
204    
205        <tag name="revised" description="Last revised:"/>        <tag name="revised" description="Last revised:"/>
206        <tag name="spec" description="Specified by:"/>        <tag name="spec" description="Specified by:"/>
# Line 154  Line 209 
209        <packageset dir="${build.filter.src.dir}"/>        <packageset dir="${build.filter.src.dir}"/>
210    
211      </javadoc>      </javadoc>
212    
213    </target>    </target>
214    
215    
# Line 162  Line 218 
218     # bridge methods (marked as "synthetic") that can have identical     # bridge methods (marked as "synthetic") that can have identical
219     # signatures to existing methods except for the return value.     # signatures to existing methods except for the return value.
220     -->     -->
221    <target name="strip" depends="init">    <target name="strip"
222              depends="init">
223    
224      <mkdir dir="${build.stripped.dir}"/>      <mkdir dir="${build.stripped.dir}"/>
225    
226      <javac srcdir="${src.dir}"      <javac srcdir="${src.dir}"
227            destdir="${build.stripped.dir}"            destdir="${build.stripped.dir}"
228              debug="${build.debug}"              debug="${build.debug}"
# Line 176  Line 235 
235        <compilerarg line="${javac.args} ${build.warnings.option} -s"/>        <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
236    
237      </javac>      </javac>
238    
239    </target>    </target>
240    
241    
242    <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"    <target name="dist"
243              depends="init, dist-clean, dist-jar, dist-docs"
244            description="Puts all distributable products in single hierarchy"/>            description="Puts all distributable products in single hierarchy"/>
245    
246    
247    <target name="clean"    <target name="clean"
248            description="Removes all build products">            description="Removes all build products">
249    
250      <delete dir="${build.dir}"/>      <delete dir="${build.dir}"/>
251      <delete dir="${build.classes.dir}"/>      <delete dir="${build.classes.dir}"/>
252      <delete dir="${build.lib.dir}"/>      <delete dir="${build.lib.dir}"/>
253    
254    </target>    </target>
255    
256    
257    <target name="dist-clean"    <target name="dist-clean"
258            description="Removes all build and distribution products">            description="Removes all build and distribution products">
259    
260      <delete dir="${dist.dir}"/>      <delete dir="${dist.dir}"/>
261    
262    </target>    </target>
263    
264    
265    <!-- Anthill targets -->    <target name="dist-docs"
266              depends="filter-src"
267              description="Builds javadocs without custom tags to dist folder">
268    
269    <!-- Should really run the tests instead of just the jar target -->      <delete dir="${dist.javadocs.dir}"/>
270    <target name="anthill-build" depends="jar, docs, dist-docs"/>      <mkdir dir="${dist.javadocs.dir}"/>
271    
272        <javadoc destdir="${dist.javadocs.dir}"
273                    link="http://java.sun.com/j2se/1.4.1/docs/api"
274                overview="${src.dir}/intro.html"
275                  source="${build.docsourcelevel}">
276    
277          <packageset dir="${build.filter.src.dir}"/>
278    
279        </javadoc>
280    
   <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>  
281    </target>    </target>
282    
283    
284    
285    <!-- Internal targets -->    <!-- Internal targets -->
286    
287    <target name="set-warnings-if" if="build.warnings">    <target name="set-warnings-if" if="build.warnings">
288    
289      <property name="build.warnings.option" value="-warnunchecked"/>      <property name="build.warnings.option" value="-warnunchecked"/>
290    
291    </target>    </target>
292    
293    
294    <target name="set-warnings-unless" unless="build.warnings">    <target name="set-warnings-unless" unless="build.warnings">
295    
296      <property name="build.warnings.option" value=""/>      <property name="build.warnings.option" value=""/>
297    
298    </target>    </target>
299    
300    
301    <target name="init" depends="set-warnings-if, set-warnings-unless">    <target name="init"
302              depends="set-warnings-if, set-warnings-unless">
303    
304      <!-- Version is kept in a separate file -->      <!-- Version is kept in a separate file -->
305      <loadfile property="version" srcFile="version.properties"/>      <loadfile property="version" srcFile="version.properties"/>
306      <echo>Building JSR-166 version ${version}</echo>      <echo>Building JSR-166 version ${version}</echo>
307    
308    </target>    </target>
309    
310    
311    <target name="dist-jar" depends="clean, jar">    <target name="init-jar">
312      <copy file="${product.jar}" todir="${dist.dir}"/>  
313        <mkdir dir="${build.lib.dir}"/>
314    
315    </target>    </target>
316    
317    
318    <target name="dist-docs" depends="filter-src"    <target name="native-jar"
319            description="Builds javadocs without custom tags to dist folder">            depends="compile, init-jar"
320      <delete dir="${dist.javadocs.dir}"/>            unless="build.emulation">
     <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.sourcelevel}">  
321    
322        <packageset dir="${build.filter.src.dir}"/>      <jar destfile="${product.jar}">
323          <fileset dir="${build.classes.dir}"/>
324        </jar>
325    
326      </target>
327    
328    
329      <target name="base-jar"
330              depends="compile, init-jar">
331    
332        <jar destfile="${product.jar}">
333          <fileset dir="${build.classes.dir}">
334            <patternset refid="emulation.excludes"/>
335          </fileset>
336        </jar>
337    
338      </target>
339    
340    
341      <target name="compile-emulation"
342              depends="init"
343              if="build.emulation">
344    
345        <mkdir dir="${build.emulation.dir}"/>
346    
347        <javac srcdir="${emulation.src.dir}"
348              destdir="${build.emulation.dir}"
349                debug="${build.debug}"
350           debuglevel="${build.debuglevel}"
351          deprecation="${build.deprecation}"
352               source="${build.sourcelevel}"
353                 fork="true">
354    
355          <bootclasspath refid="javac.bootclasspath"/>
356          <compilerarg line="${javac.args} ${build.warnings.option}"/>
357    
358        </javac>
359    
360      </target>
361    
362    
363      <target name="emulation-jar"
364              depends="base-jar, compile-emulation"
365              if="build.emulation">
366    
367        <jar destfile="${product.jar}" update="true" duplicate="add">
368          <fileset dir="${build.emulation.dir}"/>
369        </jar>
370    
     </javadoc>  
371    </target>    </target>
372    
373    
374    <target name="compile-ant-filter" depends="init">    <target name="dist-jar"
375              depends="clean, jar">
376    
377        <copy file="${product.jar}" todir="${dist.dir}"/>
378    
379      </target>
380    
381    
382      <target name="compile-ant-filter"
383              depends="init">
384    
385      <mkdir dir="${build.ant.dir}"/>      <mkdir dir="${build.ant.dir}"/>
386    
387      <javac srcdir="${ant.src.dir}"      <javac srcdir="${ant.src.dir}"
388            destdir="${build.ant.dir}"            destdir="${build.ant.dir}"
389             source="1.4"             source="1.4"
390      />      />
391    
392    </target>    </target>
393    
394    
395    <target name="filter-src" depends="compile-ant-filter">    <target name="filter-src"
396              depends="compile-ant-filter">
397    
398      <mkdir dir="${build.filter.src.dir}"/>      <mkdir dir="${build.filter.src.dir}"/>
399    
400      <copy todir="${build.filter.src.dir}">      <copy todir="${build.filter.src.dir}">
401        <fileset dir="${src.dir}">        <fileset dir="${src.dir}">
402          <include name="**/*.java"/>          <patternset refid="emulation.excludes"/>
403        </fileset>        </fileset>
404        <filterchain>        <filterchain>
405          <filterreader classname="jsr166.ant.filters.ReplaceFilter"          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
# Line 303  Line 433 
433          </filterreader>          </filterreader>
434        </filterchain>        </filterchain>
435      </copy>      </copy>
436    
437    </target>    </target>
438    
439    
440    <target name="compile-tests" depends="jar">    <target name="compile-tests"
441              depends="jar">
442    
443      <mkdir dir="${build.testcases.dir}"/>      <mkdir dir="${build.testcases.dir}"/>
444    
445      <javac srcdir="${test.src.dir}"      <javac srcdir="${test.src.dir}"
446            destdir="${build.testcases.dir}"            destdir="${build.testcases.dir}"
447              debug="${build.debug}"              debug="${build.debug}"
# Line 321  Line 455 
455        <classpath refid="test.classpath"/>        <classpath refid="test.classpath"/>
456    
457      </javac>      </javac>
458    
459    </target>    </target>
460    
461    
462    <target name="run-tests" depends="compile-tests">    <target name="run-tests"
463              depends="compile-tests">
464    
465        <!-- May be overridden by user.properties -->
466        <property name="testcase" value="*"/>
467    
468      <mkdir dir="${build.reports.dir}"/>      <mkdir dir="${build.reports.dir}"/>
469    
470      <junit printsummary="true"      <junit printsummary="true"
471               showoutput="true"               showoutput="true"
472            errorProperty="junit.failed"            errorProperty="junit.failed"
# Line 333  Line 474 
474                      dir="${build.reports.dir}"                      dir="${build.reports.dir}"
475                     fork="true">                     fork="true">
476    
477        <!--        <jvmarg value="${test.javac.args}"/>
        ! This nastiness is so JUnit can test classes we are inserting  
        ! into the java.* packages.  
        -->  
       <jvmarg value="-Xbootclasspath/p:${product.jar};${build.testcases.dir};${junit.jar}"/>  
478    
479        <formatter type="xml"/>        <formatter type="xml"/>
480    
# Line 348  Line 485 
485        </batchtest>        </batchtest>
486    
487      </junit>      </junit>
488    
489    </target>    </target>
490    
491    
492    <target name="report-tests" depends="run-tests">    <target name="report-tests"
493              depends="run-tests">
494    
495      <!-- Sets junit.report.format to frames if Xalan is present,      <!-- Sets junit.report.format to frames if Xalan is present,
496           otherwise sets it to noframes. -->           otherwise sets it to noframes. -->
497      <available property="junit.report.format"      <available property="junit.report.format"
# Line 371  Line 511 
511      </junitreport>      </junitreport>
512    
513      <fail message="Test Cases Failed" if="junit.failed"/>      <fail message="Test Cases Failed" if="junit.failed"/>
514    
515    </target>    </target>
516    
517    
518    <target name="check-junit">    <target name="check-junit">
519      <!-- FIXME: this test isn't specific enough -->  
520        <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
521      <available property="junit.available"      <available property="junit.available"
522                 classname="junit.framework.TestCase"/>                 classname="junit.framework.Protectable"/>
523      <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>  
524        <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
525              unless="junit.available"/>
526    
527      </target>
528    
529    
530    
531      <!-- Anthill targets -->
532    
533      <target name="anthill-build"
534              depends="jar, test, docs, dist-docs"/>
535    
536      <target name="anthill-publish">
537    
538        <copy todir="${deployDir}/docs/private">
539          <fileset dir="${build.javadocs.dir}"/>
540        </copy>
541    
542        <copy todir="${deployDir}/docs/public">
543          <fileset dir="${dist.javadocs.dir}"/>
544        </copy>
545    
546        <copy tofile="${deployDir}/index.html"
547              file="${basedir}/etc/anthill-index.html"/>
548    
549        <copy todir="${deployDir}/notes">
550          <fileset dir="${basedir}/etc/notes"/>
551        </copy>
552    
553    </target>    </target>
554    
555    

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

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8