ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
(Generate patch)

Comparing jsr166/build.xml (file contents):
Revision 1.25 by tim, Mon May 19 11:33:20 2003 UTC vs.
Revision 1.30 by tim, Wed May 28 14:19:25 2003 UTC

# Line 1 | Line 1
1   <project name="jsr166" default="usage">
2  
3    <description>
4 <    Build file for JSR-166
4 > ------------------------------------------------------------------------------
5 >  Build file for JSR-166
6  
7 <    JUnit 1.8 must be in ${ant.home}/lib for the test target to work.
7 <  </description>
7 >  Usage: ant [target]
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">
15 <    <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>
14 >  <target name="usage" description="Advises user to run with -projecthelp">
15 >    <echo>Run "ant -projecthelp" for full usage information.</echo>
16    </target>
17  
18 +
19 +  <!-- User-specific settings -->
20    <property file="user.properties"/>
21 <  <property name="testcase" value="*"/>
21 >
22  
23    <!-- Compilation options -->
24    <property name="build.sourcelevel"    value="1.5"/>
# Line 36 | Line 26 | ant [target], where target is one of:
26    <property name="build.debug"          value="true"/>
27    <property name="build.debuglevel"     value="source,lines,vars"/>
28    <property name="build.deprecation"    value="false"/>
39  <!--
40  <property name="build.warnings"       value="true"/>
41  -->
29  
30    <!-- Build locations -->
31    <property name="build.dir"            location="build"/>
32    <property name="build.classes.dir"    location="${build.dir}/classes"/>
33 +  <property name="build.emulation.dir"  location="${build.dir}/emulation"/>
34    <property name="build.testcases.dir"  location="${build.dir}/testcases"/>
35    <property name="build.lib.dir"        location="${build.dir}/lib"/>
36    <property name="build.ant.dir"        location="${build.dir}/ant"/>
# Line 54 | Line 42 | ant [target], where target is one of:
42  
43    <!-- Source locations -->
44    <property name="src.dir"              location="${basedir}/src/main"/>
45 +  <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>
46    <property name="test.src.dir"         location="${basedir}/src/test"/>
47    <property name="ant.src.dir"          location="${basedir}/etc/ant"/>
48    <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>
# Line 70 | Line 59 | ant [target], where target is one of:
59    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
60    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
61  
62 <  <property name="javac.args"           value='-J-Xbootclasspath/p:${javac.jar}'/>
62 >
63 >
64 >  <!--
65 >   ! Bootclasspath munging for source compilation.
66 >   -->
67 >
68 >  <path id="javac.bootclasspath.prefix">
69 >    <!-- <pathelement location="${src.dir}"/> -->
70 >    <pathelement location="${javac.jar}"/>
71 >  </path>
72  
73    <path id="javac.bootclasspath">
74 +    <!-- <pathelement location="${src.dir}"/> -->
75      <pathelement location="${collect.jar}"/>
76      <pathelement location="${rt.jar}"/>
77    </path>
78  
79 +  <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
80 +  <property name="javac.bootclasspath.prefix" refid="javac.bootclasspath.prefix"/>
81 +
82 +  <!-- Turn the flattened bootclasspath prefix into a javac argument -->
83 +  <property name="javac.args" value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>
84 +
85 +
86 +
87 +  <!--
88 +   ! Bootclasspath munging for testing, so JUnit can test our local
89 +   ! modifications to java.*.
90 +   -->
91 +
92    <path id="test.classpath">
93      <pathelement location="${product.jar}"/>
94 +    <pathelement location="${build.testcases.dir}"/>
95 +    <pathelement location="${junit.jar}"/>
96    </path>
97  
98 +  <!-- Flatten test classpath into a platform-appropriate string -->
99 +  <property name="test.classpath" refid="test.classpath"/>
100 +
101 +  <!-- Turn the flattened test classpath into a javac argument -->
102 +  <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>
103 +
104 +
105 +
106 +  <!-- Files excluded from emulation and dist-docs -->
107 +  <patternset id="emulation.excludes">
108 +    <exclude name="java/util/Random.*"/>
109 +    <exclude name="sun/misc/Unsafe.*"/>
110 +  </patternset>
111 +
112 +
113  
114    <!-- Main targets -->
115  
116 <  <target name="compile" depends="init"
117 <          description="Compiles all sources to build folder">
116 >  <target name="compile"
117 >          depends="init"
118 >          description="Compiles main sources to build folder">
119 >
120      <mkdir dir="${build.classes.dir}"/>
121 +
122      <javac srcdir="${src.dir}"
123            destdir="${build.classes.dir}"
124              debug="${build.debug}"
# Line 99 | Line 131 | ant [target], where target is one of:
131        <compilerarg line="${javac.args} ${build.warnings.option}"/>
132  
133      </javac>
134 +
135    </target>
136  
137  
138 <  <target name="jar" depends="compile"
139 <          description="Builds library jar from compiled sources">
140 <    <mkdir dir="${build.lib.dir}"/>
108 <    <jar basedir="${build.classes.dir}"
109 <        destfile="${product.jar}"
110 <    />
111 <  </target>
138 >  <target name="jar"
139 >          depends="check-emulation, init-jar, native-jar, emulation-jar"
140 >          description="Builds library jar from compiled sources"/>
141  
142  
143 <  <target name="test" depends="init, check-junit, report-tests"
144 <          description="Runs all tests (requires JUnit 1.8 in ${ant.home}/lib)"/>
143 >  <target name="test"
144 >          depends="init, check-junit, report-tests"
145 >          description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
146  
147  
148 <  <target name="checkstyle" depends="filter-src"
148 >  <target name="checkstyle"
149 >          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  
# Line 124 | Line 156 | ant [target], where target is one of:
156        <formatter type="plain"/>  <!-- also available: type="xml" -->
157        <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
158      </checkstyle>
159 +
160    </target>
161  
162  
163 <  <target name="doccheck" depends="filter-src"
163 >  <target name="doccheck"
164 >          depends="filter-src"
165            description="Reports on javadoc style errors (not working yet)">
166 +
167      <delete dir="${build.doccheck.dir}"/>
168      <mkdir dir="${build.doccheck.dir}"/>
169 +
170      <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
171           docletpath="${lib.dir}/doccheck.jar"
172              destdir="${build.doccheck.dir}">
173        <packageset dir="${build.filter.src.dir}"/>
174      </javadoc>
175 +
176    </target>
177  
178  
179 <  <target name="docs" depends="filter-src"
179 >  <target name="docs"
180 >          depends="filter-src"
181            description="Builds javadocs with custom tags to build folder">
182 +
183      <delete dir="${build.javadocs.dir}"/>
184      <mkdir dir="${build.javadocs.dir}"/>
185 +
186      <javadoc destdir="${build.javadocs.dir}"
187                  link="http://java.sun.com/j2se/1.4.1/docs/api"
188              overview="${src.dir}/intro.html"
189                source="${build.docsourcelevel}">
190  
191        <tag name="revised" description="Last revised:"/>
192 <      <tag name="spec" description="Specified by:"/>
193 <      <tag name="editor" description="Last edited by:"/>
194 <      <tag name="fixme" description="FIX ME:"/>
192 >      <tag name="spec"    description="Specified by:"/>
193 >      <tag name="editor"  description="Last edited by:"/>
194 >      <tag name="fixme"   description="FIX ME:"/>
195 >
196        <packageset dir="${build.filter.src.dir}"/>
197  
198      </javadoc>
199 +
200    </target>
201  
202  
# Line 163 | Line 205 | ant [target], where target is one of:
205     # bridge methods (marked as "synthetic") that can have identical
206     # signatures to existing methods except for the return value.
207     -->
208 <  <target name="strip" depends="init">
208 >  <target name="strip"
209 >          depends="init">
210 >
211      <mkdir dir="${build.stripped.dir}"/>
212 +
213      <javac srcdir="${src.dir}"
214            destdir="${build.stripped.dir}"
215              debug="${build.debug}"
# Line 177 | Line 222 | ant [target], where target is one of:
222        <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
223  
224      </javac>
225 +
226    </target>
227  
228  
229 <  <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
229 >  <target name="dist"
230 >          depends="init, dist-clean, dist-jar, dist-docs"
231            description="Puts all distributable products in single hierarchy"/>
232  
233  
234    <target name="clean"
235            description="Removes all build products">
236 +
237      <delete dir="${build.dir}"/>
238      <delete dir="${build.classes.dir}"/>
239      <delete dir="${build.lib.dir}"/>
240 +
241    </target>
242  
243  
244    <target name="dist-clean"
245            description="Removes all build and distribution products">
246 +
247      <delete dir="${dist.dir}"/>
248 +
249    </target>
250  
251  
252 <  <!-- Anthill targets -->
252 >  <target name="dist-docs"
253 >          depends="filter-src"
254 >          description="Builds javadocs without custom tags to dist folder">
255  
256 <  <!-- Should really run the tests instead of just the jar target -->
257 <  <target name="anthill-build" depends="jar, docs, dist-docs"/>
256 >    <delete dir="${dist.javadocs.dir}"/>
257 >    <mkdir dir="${dist.javadocs.dir}"/>
258 >
259 >    <javadoc destdir="${dist.javadocs.dir}"
260 >                link="http://java.sun.com/j2se/1.4.1/docs/api"
261 >            overview="${src.dir}/intro.html"
262 >              source="${build.docsourcelevel}">
263 >
264 >      <packageset dir="${build.filter.src.dir}"/>
265 >
266 >    </javadoc>
267  
206  <target name="anthill-publish">
207    <copy todir="${deployDir}/docs/private">
208      <fileset dir="${build.javadocs.dir}"/>
209    </copy>
210    <copy todir="${deployDir}/docs/public">
211      <fileset dir="${dist.javadocs.dir}"/>
212    </copy>
213    <copy tofile="${deployDir}/index.html"
214          file="${basedir}/etc/anthill-index.html"/>
215    <copy todir="${deployDir}/notes">
216      <fileset dir="${basedir}/etc/notes"/>
217    </copy>
268    </target>
269  
270  
271 +
272    <!-- Internal targets -->
273  
274    <target name="set-warnings-if" if="build.warnings">
275 +
276      <property name="build.warnings.option" value="-warnunchecked"/>
277 +
278    </target>
279  
280  
281    <target name="set-warnings-unless" unless="build.warnings">
282 +
283      <property name="build.warnings.option" value=""/>
284 +
285    </target>
286  
287  
288 <  <target name="init" depends="set-warnings-if, set-warnings-unless">
288 >  <target name="init"
289 >          depends="set-warnings-if, set-warnings-unless">
290 >
291      <!-- Version is kept in a separate file -->
292      <loadfile property="version" srcFile="version.properties"/>
293      <echo>Building JSR-166 version ${version}</echo>
294 +
295    </target>
296  
297  
298 <  <target name="dist-jar" depends="clean, jar">
299 <    <copy file="${product.jar}" todir="${dist.dir}"/>
298 >  <target name="init-jar">
299 >
300 >    <mkdir dir="${build.lib.dir}"/>
301 >
302    </target>
303  
304  
305 <  <target name="dist-docs" depends="filter-src"
306 <          description="Builds javadocs without custom tags to dist folder">
307 <    <delete dir="${dist.javadocs.dir}"/>
248 <    <mkdir dir="${dist.javadocs.dir}"/>
249 <    <javadoc destdir="${dist.javadocs.dir}"
250 <                link="http://java.sun.com/j2se/1.4.1/docs/api"
251 <            overview="${src.dir}/intro.html"
252 <              source="${build.docsourcelevel}">
305 >  <target name="native-jar"
306 >          depends="compile"
307 >          unless="build.emulation.true">
308  
309 <      <packageset dir="${build.filter.src.dir}"/>
309 >    <jar destfile="${product.jar}">
310 >      <fileset dir="${build.classes.dir}"/>
311 >    </jar>
312  
256    </javadoc>
313    </target>
314  
315  
316 <  <target name="compile-ant-filter" depends="init">
316 >  <target name="compile-emulation"
317 >          depends="init"
318 >          if="build.emulation.true">
319 >
320 >    <mkdir dir="${build.emulation.dir}"/>
321 >
322 >    <javac srcdir="${emulation.src.dir}"
323 >          destdir="${build.emulation.dir}"
324 >            debug="${build.debug}"
325 >       debuglevel="${build.debuglevel}"
326 >      deprecation="${build.deprecation}"
327 >           source="${build.sourcelevel}"
328 >             fork="true">
329 >
330 >      <bootclasspath refid="javac.bootclasspath"/>
331 >      <compilerarg line="${javac.args} ${build.warnings.option}"/>
332 >
333 >    </javac>
334 >
335 >  </target>
336 >
337 >
338 >  <target name="emulation-jar"
339 >          depends="compile-emulation"
340 >          if="build.emulation.true">
341 >
342 >
343 >    <jar destfile="${product.jar}" duplicate="add">
344 >      <fileset dir="${build.classes.dir}">
345 >        <patternset refid="emulation.excludes"/>
346 >      </fileset>
347 >      <fileset dir="${build.emulation.dir}"/>
348 >    </jar>
349 >
350 >  </target>
351 >
352 >
353 >  <target name="dist-jar"
354 >          depends="clean, jar">
355 >
356 >    <copy file="${product.jar}" todir="${dist.dir}"/>
357 >
358 >  </target>
359 >
360 >
361 >  <target name="compile-ant-filter"
362 >          depends="init">
363 >
364      <mkdir dir="${build.ant.dir}"/>
365 +
366      <javac srcdir="${ant.src.dir}"
367            destdir="${build.ant.dir}"
368             source="1.4"
369      />
370 +
371    </target>
372  
373  
374 <  <target name="filter-src" depends="compile-ant-filter">
374 >  <target name="filter-src"
375 >          depends="compile-ant-filter">
376 >
377      <mkdir dir="${build.filter.src.dir}"/>
378 +
379      <copy todir="${build.filter.src.dir}">
380        <fileset dir="${src.dir}">
381 <        <include name="**/*.java"/>
381 >        <patternset refid="emulation.excludes"/>
382        </fileset>
383        <filterchain>
384          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
# Line 304 | Line 412 | ant [target], where target is one of:
412          </filterreader>
413        </filterchain>
414      </copy>
415 +
416    </target>
417  
418  
419 <  <target name="compile-tests" depends="jar">
419 >  <target name="compile-tests"
420 >          depends="jar">
421 >
422      <mkdir dir="${build.testcases.dir}"/>
423 +
424      <javac srcdir="${test.src.dir}"
425            destdir="${build.testcases.dir}"
426              debug="${build.debug}"
# Line 322 | Line 434 | ant [target], where target is one of:
434        <classpath refid="test.classpath"/>
435  
436      </javac>
437 +
438    </target>
439  
440  
441 <  <target name="run-tests" depends="compile-tests">
441 >  <target name="run-tests"
442 >          depends="compile-tests">
443 >
444 >    <!-- May be overridden by user.properties -->
445 >    <property name="testcase" value="*"/>
446 >
447      <mkdir dir="${build.reports.dir}"/>
448 +
449      <junit printsummary="true"
450               showoutput="true"
451            errorProperty="junit.failed"
# Line 334 | Line 453 | ant [target], where target is one of:
453                      dir="${build.reports.dir}"
454                     fork="true">
455  
456 <      <!--
338 <       ! This nastiness is so JUnit can test classes we are inserting
339 <       ! into the java.* packages.
340 <       -->
341 <      <jvmarg value="-Xbootclasspath/p:${product.jar};${build.testcases.dir};${junit.jar}"/>
456 >      <jvmarg value="${test.javac.args}"/>
457  
458        <formatter type="xml"/>
459  
# Line 349 | Line 464 | ant [target], where target is one of:
464        </batchtest>
465  
466      </junit>
467 +
468    </target>
469  
470  
471 <  <target name="report-tests" depends="run-tests">
471 >  <target name="report-tests"
472 >          depends="run-tests">
473 >
474      <!-- Sets junit.report.format to frames if Xalan is present,
475           otherwise sets it to noframes. -->
476      <available property="junit.report.format"
# Line 372 | Line 490 | ant [target], where target is one of:
490      </junitreport>
491  
492      <fail message="Test Cases Failed" if="junit.failed"/>
493 +
494    </target>
495  
496  
497    <target name="check-junit">
498 <    <!-- FIXME: this test isn't specific enough -->
498 >
499 >    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
500      <available property="junit.available"
501 <               classname="junit.framework.TestCase"/>
502 <    <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>
501 >               classname="junit.framework.Protectable"/>
502 >
503 >    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
504 >          unless="junit.available"/>
505 >
506 >  </target>
507 >
508 >
509 >  <target name="check-emulation">
510 >    <condition property="build.emulation.true">
511 >      <or>
512 >        <isset property="build.emulation"/>
513 >        <os family="windows"/>
514 >      </or>
515 >    </condition>
516 >  </target>
517 >
518 >
519 >
520 >  <!-- Anthill targets -->
521 >
522 >  <target name="anthill-build"
523 >          depends="jar, test, docs, dist-docs"/>
524 >
525 >  <target name="anthill-publish">
526 >
527 >    <copy todir="${deployDir}/docs/private">
528 >      <fileset dir="${build.javadocs.dir}"/>
529 >    </copy>
530 >
531 >    <copy todir="${deployDir}/docs/public">
532 >      <fileset dir="${dist.javadocs.dir}"/>
533 >    </copy>
534 >
535 >    <copy tofile="${deployDir}/index.html"
536 >          file="${basedir}/etc/anthill-index.html"/>
537 >
538 >    <copy todir="${deployDir}/notes">
539 >      <fileset dir="${basedir}/etc/notes"/>
540 >    </copy>
541 >
542    </target>
543  
544  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines