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

Diff of /jsr166/build.xml

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

revision 1.9 by tim, Wed Dec 11 05:04:04 2002 UTC revision 1.27 by tim, Wed May 28 00:33:17 2003 UTC
# Line 1  Line 1 
1  <project name="jsr166" default="jar">  <project name="jsr166" default="usage">
2    
3    <description>    <description>
4      Build file for JSR-166      Build file for JSR-166
5    
6      Note that junit.jar must be in ${ant.home}/lib for the      JUnit 3.8 or better must be in ${ant.home}/lib for the test target to work.
     test target to work. [FIXME: This should be automatically  
     enforced by this build file by failing with a message if  
     junit.jar is not in the right place.]  
7    </description>    </description>
8    
9    
10      <target name="usage" description="Prints this message">
11        <echo>
12    ant [target], where target is one of:
13    
14     usage       (default) Prints this message
15     compile     Compiles all sources to build folder
16     jar         Builds library jar from compiled sources
17     test        Runs all tests (requires JUnit 1.8 in ${ant.home}/lib)
18     docs        Builds javadocs with custom tags to build folder
19     dist-docs   Builds javadocs without custom tags to dist folder
20     dist        Puts all distributable products in single hierarchy
21    
22     clean       Removes all build products
23     dist-clean  Removes all build and distribution products
24    
25     checkstyle  Reports on style errors in Java source (verbose, mostly chaff)
26     doccheck    Reports on javadoc style errors (not working yet)
27        </echo>
28      </target>
29    
30      <!-- User-specific settings -->
31      <property file="user.properties"/>
32    
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"/>
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.sourcelevel"    value="1.5"/>  
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"/>
51    <property name="build.javadocs.dir"   location="${build.dir}/javadocs"/>    <property name="build.javadocs.dir"   location="${build.dir}/javadocs"/>
52      <property name="build.stripped.dir"   location="${build.dir}/stripped"/>
53    <property name="build.reports.dir"    location="${build.dir}/reports"/>    <property name="build.reports.dir"    location="${build.dir}/reports"/>
54      <property name="build.doccheck.dir"   location="${build.dir}/doccheck"/>
55    <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>    <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
56    
57    <!-- Source locations -->    <!-- Source locations -->
58    <property name="src.dir"              location="${basedir}"/>    <property name="src.dir"              location="${basedir}/src/main"/>
59    <property name="test.src.dir"         location="${basedir}/etc/testcases"/>    <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>
60      <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"/>
63    <property name="lib.dir"              location="${basedir}/lib"/>    <property name="lib.dir"              location="${basedir}/lib"/>
# Line 43  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    
   <property name="gj.compiler.args"  
            value='-J-Xbootclasspath/p:${javac.jar} -deprecation -warnunchecked'  
   />  
76    
77    <path id="gj.compiler.bootclasspath">    <!--
78       ! Bootclasspath munging for source compilation.
79       -->
80    
81      <path id="javac.bootclasspath.prepend">
82        <!-- <pathelement location="${src.dir}"/> -->
83        <pathelement location="${javac.jar}"/>
84      </path>
85    
86      <path id="javac.bootclasspath">
87        <!-- <pathelement location="${src.dir}"/> -->
88      <pathelement location="${collect.jar}"/>      <pathelement location="${collect.jar}"/>
89      <pathelement location="${rt.jar}"/>      <pathelement location="${rt.jar}"/>
90    </path>    </path>
91    
92      <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
93      <property name="javac.bootclasspath.prepend" refid="javac.bootclasspath.prepend"/>
94    
95      <!-- Turn the flattened bootclasspath prefix into a javac argument -->
96      <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prepend}'/>
97    
98    
99      <!--
100       ! Bootclasspath munging for testing, so JUnit can test our local
101       ! modifications to java.*.
102       -->
103    
104    <path id="test.classpath">    <path id="test.classpath">
105      <pathelement location="${product.jar}"/>      <pathelement location="${product.jar}"/>
106        <pathelement location="${build.testcases.dir}"/>
107        <pathelement location="${junit.jar}"/>
108    </path>    </path>
109    
110      <!-- Flatten test classpath into a platform-appropriate string -->
111      <property name="test.classpath" refid="test.classpath"/>
112    
113      <!-- Turn the flattened test classpath into a javac argument -->
114      <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>
115    
116    
117    
118      <!-- Main targets -->
119    
120      <target name="compile" depends="init"
121              description="Compiles main sources to build folder">
122    
   <target name="compile">  
123      <mkdir dir="${build.classes.dir}"/>      <mkdir dir="${build.classes.dir}"/>
124    
125      <javac srcdir="${src.dir}"      <javac srcdir="${src.dir}"
126            destdir="${build.classes.dir}"            destdir="${build.classes.dir}"
127              debug="${build.debug}"              debug="${build.debug}"
# Line 67  Line 130 
130             source="${build.sourcelevel}"             source="${build.sourcelevel}"
131               fork="true">               fork="true">
132    
133        <bootclasspath refid="gj.compiler.bootclasspath"/>        <bootclasspath refid="javac.bootclasspath"/>
134        <compilerarg line="${gj.compiler.args}"/>        <compilerarg line="${javac.args} ${build.warnings.option}"/>
   
       <!-- need this because srcdir is basedir! -->  
       <include name="java/**/*.java"/>  
135    
136      </javac>      </javac>
137    
138    </target>    </target>
139    
140    
141    <target name="jar" depends="compile">    <target name="jar" depends="native-jar, emulation-jar"/>
142      <mkdir dir="${build.lib.dir}"/>  
143      <jar basedir="${build.classes.dir}"  
144          destfile="${product.jar}"    <target name="test" depends="init, check-junit, report-tests"
145      />            description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)"
146      />
147    
148    
149      <target name="checkstyle" depends="filter-src"
150              description="Reports on style errors in Java source (verbose, mostly chaff)">
151    
152        <taskdef resource="checkstyletask.properties"
153                classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
154    
155        <checkstyle>
156          <formatter type="plain"/>  <!-- also available: type="xml" -->
157          <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
158        </checkstyle>
159    
160    </target>    </target>
161    
162    
163    <target name="test" depends="report-tests"/>    <target name="doccheck" depends="filter-src"
164              description="Reports on javadoc style errors (not working yet)">
165    
166        <delete dir="${build.doccheck.dir}"/>
167        <mkdir dir="${build.doccheck.dir}"/>
168    
169        <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
170             docletpath="${lib.dir}/doccheck.jar"
171                destdir="${build.doccheck.dir}">
172          <packageset dir="${build.filter.src.dir}"/>
173        </javadoc>
174    
175      </target>
176    
177    
178    <target name="docs" depends="clean-filtered-src, filter-src"    <target name="docs" depends="filter-src"
179            description="Builds javadocs with custom tags to build folder">            description="Builds javadocs with custom tags to build folder">
180    
181      <delete dir="${build.javadocs.dir}"/>      <delete dir="${build.javadocs.dir}"/>
182      <mkdir dir="${build.javadocs.dir}"/>      <mkdir dir="${build.javadocs.dir}"/>
183    
184      <javadoc destdir="${build.javadocs.dir}"      <javadoc destdir="${build.javadocs.dir}"
185                  link="http://java.sun.com/j2se/1.4.1/docs/api"                  link="http://java.sun.com/j2se/1.4.1/docs/api"
186              overview="${src.dir}/intro.html"              overview="${src.dir}/intro.html"
187                source="${build.sourcelevel}">                source="${build.docsourcelevel}">
188    
189        <tag name="revised" description="Last revised:"/>        <tag name="revised" description="Last revised:"/>
190        <tag name="spec" description="Specified by:"/>        <tag name="spec" description="Specified by:"/>
191        <tag name="editor" description="Last edited by:"/>        <tag name="editor" description="Last edited by:"/>
192        <tag name="fixme" description="FIX ME:"/>        <tag name="fixme" description="FIX ME:"/>
193        <packageset dir="${build.filter.src.dir}">        <packageset dir="${build.filter.src.dir}"/>
         <include name="java/**"/>  
       </packageset>  
194    
195      </javadoc>      </javadoc>
196    
197    </target>    </target>
198    
199    
200    <target name="dist-docs" depends="clean-filtered-src, filter-src"    <!--
201            description="Builds javadocs without custom tags to dist folder">     # javac -s doesn't reliably generate compilable code. It generates
202      <delete dir="${dist.javadocs.dir}"/>     # bridge methods (marked as "synthetic") that can have identical
203      <mkdir dir="${dist.javadocs.dir}"/>     # signatures to existing methods except for the return value.
204      <javadoc destdir="${dist.javadocs.dir}"     -->
205                  link="http://java.sun.com/j2se/1.4.1/docs/api"    <target name="strip" depends="init">
             overview="${src.dir}/intro.html"  
               source="${build.sourcelevel}">  
206    
207        <packageset dir="${build.filter.src.dir}">      <mkdir dir="${build.stripped.dir}"/>
         <include name="java/**"/>  
       </packageset>  
208    
209      </javadoc>      <javac srcdir="${src.dir}"
210    </target>            destdir="${build.stripped.dir}"
211                debug="${build.debug}"
212           debuglevel="${build.debuglevel}"
213          deprecation="${build.deprecation}"
214               source="${build.sourcelevel}"
215                 fork="true">
216    
217          <bootclasspath refid="javac.bootclasspath"/>
218          <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
219    
220        </javac>
221    
   <target name="dist" depends="clean, jar, dist-docs">  
     <!-- nothing to do here yet -->  
222    </target>    </target>
223    
224    
225    <target name="clean">    <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
226              description="Puts all distributable products in single hierarchy"/>
227    
228    
229      <target name="clean"
230              description="Removes all build products">
231    
232      <delete dir="${build.dir}"/>      <delete dir="${build.dir}"/>
233      <delete dir="${build.classes.dir}"/>      <delete dir="${build.classes.dir}"/>
234      <delete dir="${build.lib.dir}"/>      <delete dir="${build.lib.dir}"/>
235    
236    </target>    </target>
237    
238    
239    <target name="dist-clean" depends="clean">    <target name="dist-clean"
240              description="Removes all build and distribution products">
241    
242      <delete dir="${dist.dir}"/>      <delete dir="${dist.dir}"/>
243    
244      </target>
245    
246    
247      <!-- Anthill targets -->
248    
249      <!-- Should really run the tests instead of just the jar target -->
250      <target name="anthill-build" depends="jar, test, docs, dist-docs"/>
251    
252      <target name="anthill-publish">
253        <copy todir="${deployDir}/docs/private">
254          <fileset dir="${build.javadocs.dir}"/>
255        </copy>
256        <copy todir="${deployDir}/docs/public">
257          <fileset dir="${dist.javadocs.dir}"/>
258        </copy>
259        <copy tofile="${deployDir}/index.html"
260              file="${basedir}/etc/anthill-index.html"/>
261        <copy todir="${deployDir}/notes">
262          <fileset dir="${basedir}/etc/notes"/>
263        </copy>
264    </target>    </target>
265    
266    
267    <target name="clean-filtered-src">    <!-- Internal targets -->
268      <delete dir="${build.filter.src.dir}"/>  
269      <target name="set-warnings-if" if="build.warnings">
270    
271        <property name="build.warnings.option" value="-warnunchecked"/>
272    
273    </target>    </target>
274    
275    
276    <!-- Internal targets used by docs target -->    <target name="set-warnings-unless" unless="build.warnings">
277    
278        <property name="build.warnings.option" value=""/>
279    
280      </target>
281    
282    
283      <target name="init" depends="set-warnings-if, set-warnings-unless">
284    
285        <!-- Version is kept in a separate file -->
286        <loadfile property="version" srcFile="version.properties"/>
287        <echo>Building JSR-166 version ${version}</echo>
288    
289      </target>
290    
291    
292      <target name="native-jar" depends="compile"
293              description="Builds library jar from compiled sources">
294    
295        <mkdir dir="${build.lib.dir}"/>
296    
297        <jar destfile="${product.jar}">
298          <fileset dir="${build.classes.dir}"/>
299        </jar>
300    
301      </target>
302    
303    
304      <target name="compile-emulation" depends="init"
305              if="build.emulation"
306              description="Compiles emulation sources to build folder">
307    
308        <mkdir dir="${build.emulation.dir}"/>
309    
310        <javac srcdir="${emulation.src.dir}"
311              destdir="${build.emulation.dir}"
312                debug="${build.debug}"
313           debuglevel="${build.debuglevel}"
314          deprecation="${build.deprecation}"
315               source="${build.sourcelevel}"
316                 fork="true">
317    
318          <bootclasspath refid="javac.bootclasspath"/>
319          <compilerarg line="${javac.args} ${build.warnings.option}"/>
320    
321        </javac>
322    
323      </target>
324    
325    
326      <target name="emulation-jar" depends="native-jar, compile-emulation"
327              if="build.emulation">
328    
329        <jar destfile="${product.jar}" update="true" duplicate="add">
330          <fileset dir="${build.emulation.dir}"/>
331        </jar>
332    
333      </target>
334    
335    
336      <target name="dist-jar" depends="clean, jar">
337    
338        <copy file="${product.jar}" todir="${dist.dir}"/>
339    
340      </target>
341    
342    
343      <target name="dist-docs" depends="filter-src"
344              description="Builds javadocs without custom tags to dist folder">
345    
346        <delete dir="${dist.javadocs.dir}"/>
347        <mkdir dir="${dist.javadocs.dir}"/>
348    
349        <javadoc destdir="${dist.javadocs.dir}"
350                    link="http://java.sun.com/j2se/1.4.1/docs/api"
351                overview="${src.dir}/intro.html"
352                  source="${build.docsourcelevel}">
353    
354          <packageset dir="${build.filter.src.dir}"/>
355    
356        </javadoc>
357    
358      </target>
359    
360    
361      <target name="compile-ant-filter" depends="init">
362    
   <target name="compile-ant">  
363      <mkdir dir="${build.ant.dir}"/>      <mkdir dir="${build.ant.dir}"/>
364    
365      <javac srcdir="${ant.src.dir}"      <javac srcdir="${ant.src.dir}"
366            destdir="${build.ant.dir}"            destdir="${build.ant.dir}"
367             source="1.4"             source="1.4"
368      />      />
369    
370    </target>    </target>
371    
372    
373    <target name="filter-src" depends="compile-ant">    <target name="filter-src" depends="compile-ant-filter">
374    
375      <mkdir dir="${build.filter.src.dir}"/>      <mkdir dir="${build.filter.src.dir}"/>
376    
377      <copy todir="${build.filter.src.dir}">      <copy todir="${build.filter.src.dir}">
378        <fileset dir="${src.dir}">        <fileset dir="${src.dir}">
379          <include name="**/*.java"/>          <include name="**/*.java"/>
380            <exclude name="**/Random.java"/>
381            <exclude name="**/Unsafe.java"/>
382        </fileset>        </fileset>
383        <filterchain>        <filterchain>
384          <filterreader classname="jsr166.ant.filters.ReplaceFilter"          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
# Line 197  Line 412 
412          </filterreader>          </filterreader>
413        </filterchain>        </filterchain>
414      </copy>      </copy>
   </target>  
415    
416      </target>
417    
   <!-- Internal targets used by test target -->  
418    
419    <target name="compile-tests" depends="jar">    <target name="compile-tests" depends="jar">
420    
421      <mkdir dir="${build.testcases.dir}"/>      <mkdir dir="${build.testcases.dir}"/>
422    
423      <javac srcdir="${test.src.dir}"      <javac srcdir="${test.src.dir}"
424            destdir="${build.testcases.dir}"            destdir="${build.testcases.dir}"
425              debug="${build.debug}"              debug="${build.debug}"
# Line 212  Line 428 
428             source="${build.sourcelevel}"             source="${build.sourcelevel}"
429               fork="true">               fork="true">
430    
431        <bootclasspath refid="gj.compiler.bootclasspath"/>        <bootclasspath refid="javac.bootclasspath"/>
432        <compilerarg line="${gj.compiler.args}"/>        <compilerarg line="${javac.args} ${build.warnings.option}"/>
433        <classpath refid="test.classpath"/>        <classpath refid="test.classpath"/>
       <include name="**/*Test.java"/>  
434    
435      </javac>      </javac>
436    
437    </target>    </target>
438    
439    
440    <target name="run-tests" depends="compile-tests">    <target name="run-tests" depends="compile-tests">
441    
442        <!-- May be overridden by user.properties -->
443        <property name="testcase" value="*"/>
444    
445      <mkdir dir="${build.reports.dir}"/>      <mkdir dir="${build.reports.dir}"/>
446    
447      <junit printsummary="true"      <junit printsummary="true"
448               showoutput="true"               showoutput="true"
449            errorProperty="junit.failed"            errorProperty="junit.failed"
450          failureProperty="junit.failed"          failureProperty="junit.failed"
451                      dir="${build.reports.dir}">                      dir="${build.reports.dir}"
452                       fork="true">
453    
454        <classpath>        <jvmarg value="${test.javac.args}"/>
         <path refid="test.classpath"/>  
         <pathelement location="${build.testcases.dir}"/>  
       </classpath>  
455    
456        <formatter type="xml"/>        <formatter type="xml"/>
457    
458        <batchtest todir="${build.reports.dir}">        <batchtest todir="${build.reports.dir}">
459          <fileset dir="${test.src.dir}">          <fileset dir="${test.src.dir}">
460            <include name="**/*Test.java"/>            <include name="**/${testcase}Test.java"/>
461          </fileset>          </fileset>
462        </batchtest>        </batchtest>
463    
464      </junit>      </junit>
465    
466    </target>    </target>
467    
468    
# Line 268  Line 489 
489    </target>    </target>
490    
491    
492      <target name="check-junit">
493        <!-- FIXME: this test isn't specific enough -->
494        <available property="junit.available"
495                   classname="junit.framework.TestCase"/>
496        <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>
497      </target>
498    
499    
500  </project>  </project>

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

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