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.23 by tim, Sat May 17 21:20:50 2003 UTC vs.
Revision 1.28 by tim, Wed May 28 13:37:59 2003 UTC

# Line 3 | Line 3
3    <description>
4      Build file for JSR-166
5  
6 <    JUnit 1.8 must be in ${ant.home}/lib for the test target to work.
6 >    JUnit 3.8 or better must be in ${ant.home}/lib for the test target to work.
7    </description>
8  
9  
# Line 27 | Line 27 | ant [target], where target is one of:
27      </echo>
28    </target>
29  
30 +  <!-- User-specific settings -->
31    <property file="user.properties"/>
32 <  <property name="testcase" value="*"/>
32 >
33 >  <!-- Set build.warnings in user.properties to turn on -warnunchecked -->
34 >  <!-- <property name="build.warnings" value=""/> -->
35 >
36  
37    <!-- 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"/>
41    <property name="build.debuglevel"     value="source,lines,vars"/>
42    <property name="build.deprecation"    value="false"/>
38  <!--
39  <property name="build.warnings"       value="true"/>
40  -->
43  
44    <!-- Build locations -->
45    <property name="build.dir"            location="build"/>
46    <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"/>
49    <property name="build.lib.dir"        location="${build.dir}/lib"/>
50    <property name="build.ant.dir"        location="${build.dir}/ant"/>
# Line 53 | Line 56 | ant [target], where target is one of:
56  
57    <!-- Source locations -->
58    <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"/>
61    <property name="ant.src.dir"          location="${basedir}/etc/ant"/>
62    <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>
# Line 69 | Line 73 | ant [target], where target is one of:
73    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
74    <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
75  
76 <  <property name="javac.args"           value='-J-Xbootclasspath/p:${javac.jar}'/>
76 >
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">
88 +    <!-- <pathelement location="${src.dir}"/> -->
89      <pathelement location="${collect.jar}"/>
90      <pathelement location="${rt.jar}"/>
91    </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">
107      <pathelement location="${product.jar}"/>
108 +    <pathelement location="${build.testcases.dir}"/>
109 +    <pathelement location="${junit.jar}"/>
110    </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 -->
129  
130 <  <target name="compile" depends="init"
131 <          description="Compiles all sources to build folder">
130 >  <target name="compile"
131 >          depends="init"
132 >          description="Compiles main sources to build folder">
133 >
134      <mkdir dir="${build.classes.dir}"/>
135 +
136      <javac srcdir="${src.dir}"
137            destdir="${build.classes.dir}"
138              debug="${build.debug}"
# Line 98 | Line 145 | ant [target], where target is one of:
145        <compilerarg line="${javac.args} ${build.warnings.option}"/>
146  
147      </javac>
148 +
149    </target>
150  
151  
152 <  <target name="jar" depends="compile"
153 <          description="Builds library jar from compiled sources">
154 <    <mkdir dir="${build.lib.dir}"/>
107 <    <jar basedir="${build.classes.dir}"
108 <        destfile="${product.jar}"
109 <    />
110 <  </target>
152 >  <target name="jar"
153 >          depends="native-jar, emulation-jar"
154 >          description="Builds library jar from compiled sources"/>
155  
156  
157 <  <target name="test" depends="init, check-junit, report-tests"
158 <          description="Runs all tests (requires JUnit 1.8 in ${ant.home}/lib)"/>
157 >  <target name="test"
158 >          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"
162 >  <target name="checkstyle"
163 >          depends="filter-src"
164            description="Reports on style errors in Java source (verbose, mostly chaff)">
165 +
166      <taskdef resource="checkstyletask.properties"
167              classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
168  
# Line 123 | Line 170 | ant [target], where target is one of:
170        <formatter type="plain"/>  <!-- also available: type="xml" -->
171        <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
172      </checkstyle>
173 +
174    </target>
175  
176  
177 <  <target name="doccheck" depends="filter-src"
177 >  <target name="doccheck"
178 >          depends="filter-src"
179            description="Reports on javadoc style errors (not working yet)">
180 +
181      <delete dir="${build.doccheck.dir}"/>
182      <mkdir dir="${build.doccheck.dir}"/>
183 +
184      <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
185           docletpath="${lib.dir}/doccheck.jar"
186              destdir="${build.doccheck.dir}">
187        <packageset dir="${build.filter.src.dir}"/>
188      </javadoc>
189 +
190    </target>
191  
192  
193 <  <target name="docs" depends="filter-src"
193 >  <target name="docs"
194 >          depends="filter-src"
195            description="Builds javadocs with custom tags to build folder">
196 +
197      <delete dir="${build.javadocs.dir}"/>
198      <mkdir dir="${build.javadocs.dir}"/>
199 +
200      <javadoc destdir="${build.javadocs.dir}"
201                  link="http://java.sun.com/j2se/1.4.1/docs/api"
202              overview="${src.dir}/intro.html"
203 <              source="${build.sourcelevel}">
203 >              source="${build.docsourcelevel}">
204  
205        <tag name="revised" description="Last revised:"/>
206        <tag name="spec" description="Specified by:"/>
# Line 154 | Line 209 | ant [target], where target is one of:
209        <packageset dir="${build.filter.src.dir}"/>
210  
211      </javadoc>
212 +
213    </target>
214  
215  
# Line 162 | Line 218 | ant [target], where target is one of:
218     # bridge methods (marked as "synthetic") that can have identical
219     # signatures to existing methods except for the return value.
220     -->
221 <  <target name="strip" depends="init">
221 >  <target name="strip"
222 >          depends="init">
223 >
224      <mkdir dir="${build.stripped.dir}"/>
225 +
226      <javac srcdir="${src.dir}"
227            destdir="${build.stripped.dir}"
228              debug="${build.debug}"
# Line 176 | Line 235 | ant [target], where target is one of:
235        <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
236  
237      </javac>
238 +
239    </target>
240  
241  
242 <  <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
242 >  <target name="dist"
243 >          depends="init, dist-clean, dist-jar, dist-docs"
244            description="Puts all distributable products in single hierarchy"/>
245  
246  
247    <target name="clean"
248            description="Removes all build products">
249 +
250      <delete dir="${build.dir}"/>
251      <delete dir="${build.classes.dir}"/>
252      <delete dir="${build.lib.dir}"/>
253 +
254    </target>
255  
256  
257    <target name="dist-clean"
258            description="Removes all build and distribution products">
259 +
260      <delete dir="${dist.dir}"/>
261 +
262    </target>
263  
264  
265 <  <!-- Anthill targets -->
265 >  <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 -->
270 <  <target name="anthill-build" depends="jar, docs, dist-docs"/>
269 >    <delete dir="${dist.javadocs.dir}"/>
270 >    <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  
205  <target name="anthill-publish">
206    <copy todir="${deployDir}/docs/private">
207      <fileset dir="${build.javadocs.dir}"/>
208    </copy>
209    <copy todir="${deployDir}/docs/public">
210      <fileset dir="${dist.javadocs.dir}"/>
211    </copy>
212    <copy tofile="${deployDir}/index.html"
213          file="${basedir}/etc/anthill-index.html"/>
214    <copy todir="${deployDir}/notes">
215      <fileset dir="${basedir}/etc/notes"/>
216    </copy>
281    </target>
282  
283  
284 +
285    <!-- Internal targets -->
286  
287    <target name="set-warnings-if" if="build.warnings">
288 +
289      <property name="build.warnings.option" value="-warnunchecked"/>
290 +
291    </target>
292  
293  
294    <target name="set-warnings-unless" unless="build.warnings">
295 +
296      <property name="build.warnings.option" value=""/>
297 +
298    </target>
299  
300  
301 <  <target name="init" depends="set-warnings-if, set-warnings-unless">
301 >  <target name="init"
302 >          depends="set-warnings-if, set-warnings-unless">
303 >
304      <!-- Version is kept in a separate file -->
305      <loadfile property="version" srcFile="version.properties"/>
306      <echo>Building JSR-166 version ${version}</echo>
307 +
308    </target>
309  
310  
311 <  <target name="dist-jar" depends="clean, jar">
312 <    <copy file="${product.jar}" todir="${dist.dir}"/>
311 >  <target name="init-jar">
312 >
313 >    <mkdir dir="${build.lib.dir}"/>
314 >
315    </target>
316  
317  
318 <  <target name="dist-docs" depends="filter-src"
319 <          description="Builds javadocs without custom tags to dist folder">
320 <    <delete dir="${dist.javadocs.dir}"/>
247 <    <mkdir dir="${dist.javadocs.dir}"/>
248 <    <javadoc destdir="${dist.javadocs.dir}"
249 <                link="http://java.sun.com/j2se/1.4.1/docs/api"
250 <            overview="${src.dir}/intro.html"
251 <              source="${build.sourcelevel}">
318 >  <target name="native-jar"
319 >          depends="compile, init-jar"
320 >          unless="build.emulation">
321  
322 <      <packageset dir="${build.filter.src.dir}"/>
322 >    <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 >
371 >  </target>
372 >
373 >
374 >  <target name="dist-jar"
375 >          depends="clean, jar">
376 >
377 >    <copy file="${product.jar}" todir="${dist.dir}"/>
378  
255    </javadoc>
379    </target>
380  
381  
382 <  <target name="compile-ant-filter" depends="init">
382 >  <target name="compile-ant-filter"
383 >          depends="init">
384 >
385      <mkdir dir="${build.ant.dir}"/>
386 +
387      <javac srcdir="${ant.src.dir}"
388            destdir="${build.ant.dir}"
389             source="1.4"
390      />
391 +
392    </target>
393  
394  
395 <  <target name="filter-src" depends="compile-ant-filter">
395 >  <target name="filter-src"
396 >          depends="compile-ant-filter">
397 >
398      <mkdir dir="${build.filter.src.dir}"/>
399 +
400      <copy todir="${build.filter.src.dir}">
401        <fileset dir="${src.dir}">
402 <        <include name="**/*.java"/>
402 >        <patternset refid="emulation.excludes"/>
403        </fileset>
404        <filterchain>
405          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
# Line 303 | Line 433 | ant [target], where target is one of:
433          </filterreader>
434        </filterchain>
435      </copy>
436 +
437    </target>
438  
439  
440 <  <target name="compile-tests" depends="jar">
440 >  <target name="compile-tests"
441 >          depends="jar">
442 >
443      <mkdir dir="${build.testcases.dir}"/>
444 +
445      <javac srcdir="${test.src.dir}"
446            destdir="${build.testcases.dir}"
447              debug="${build.debug}"
# Line 321 | Line 455 | ant [target], where target is one of:
455        <classpath refid="test.classpath"/>
456  
457      </javac>
458 +
459    </target>
460  
461  
462 <  <target name="run-tests" depends="compile-tests">
462 >  <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}"/>
469 +
470      <junit printsummary="true"
471               showoutput="true"
472            errorProperty="junit.failed"
# Line 333 | Line 474 | ant [target], where target is one of:
474                      dir="${build.reports.dir}"
475                     fork="true">
476  
477 <      <!--
337 <       ! This nastiness is so JUnit can test classes we are inserting
338 <       ! into the java.* packages.
339 <       -->
340 <      <jvmarg value="-Xbootclasspath/p:${product.jar};${build.testcases.dir};${junit.jar}"/>
477 >      <jvmarg value="${test.javac.args}"/>
478  
479        <formatter type="xml"/>
480  
# Line 348 | Line 485 | ant [target], where target is one of:
485        </batchtest>
486  
487      </junit>
488 +
489    </target>
490  
491  
492 <  <target name="report-tests" depends="run-tests">
492 >  <target name="report-tests"
493 >          depends="run-tests">
494 >
495      <!-- Sets junit.report.format to frames if Xalan is present,
496           otherwise sets it to noframes. -->
497      <available property="junit.report.format"
# Line 371 | Line 511 | ant [target], where target is one of:
511      </junitreport>
512  
513      <fail message="Test Cases Failed" if="junit.failed"/>
514 +
515    </target>
516  
517  
518    <target name="check-junit">
519 <    <!-- FIXME: this test isn't specific enough -->
519 >
520 >    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
521      <available property="junit.available"
522 <               classname="junit.framework.TestCase"/>
523 <    <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>
522 >               classname="junit.framework.Protectable"/>
523 >
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>
554  
555  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines