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.27 by tim, Wed May 28 00:33:17 2003 UTC vs.
Revision 1.82 by jsr166, Mon Nov 16 04:16:42 2009 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 3.8 or better 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 an explanation of some useful settings.
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  
33  <!-- Set build.warnings in user.properties to turn on -warnunchecked -->
34  <!-- <property name="build.warnings" value=""/> -->
35
22  
23    <!-- Compilation options -->
24 <  <property name="build.sourcelevel"    value="1.5"/>
39 <  <property name="build.docsourcelevel" value="1.4"/>
24 >  <property name="build.sourcelevel"    value="1.6"/>
25    <property name="build.debug"          value="true"/>
26    <property name="build.debuglevel"     value="source,lines,vars"/>
27    <property name="build.deprecation"    value="false"/>
28  
29    <!-- Build locations -->
30 <  <property name="build.dir"            location="build"/>
31 <  <property name="build.classes.dir"    location="${build.dir}/classes"/>
32 <  <property name="build.emulation.dir"  location="${build.dir}/emulation"/>
33 <  <property name="build.testcases.dir"  location="${build.dir}/testcases"/>
34 <  <property name="build.lib.dir"        location="${build.dir}/lib"/>
35 <  <property name="build.ant.dir"        location="${build.dir}/ant"/>
36 <  <property name="build.javadocs.dir"   location="${build.dir}/javadocs"/>
37 <  <property name="build.stripped.dir"   location="${build.dir}/stripped"/>
38 <  <property name="build.reports.dir"    location="${build.dir}/reports"/>
39 <  <property name="build.doccheck.dir"   location="${build.dir}/doccheck"/>
40 <  <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
30 >  <property name="build.dir"                   location="build"/>
31 >  <property name="build.classes.dir"           location="${build.dir}/classes"/>
32 >  <property name="build.testcases.dir"         location="${build.dir}/testcases"/>
33 >  <property name="build.loops.dir"             location="${build.dir}/loops"/>
34 >  <property name="build.lib.dir"               location="${build.dir}/lib"/>
35 >  <property name="build.javadocs.dir"          location="${build.dir}/javadocs"/>
36 >  <property name="build.reports.dir"           location="${build.dir}/reports"/>
37 >  <property name="build.jsr166x.dir"           location="${build.dir}/jsr166x"/>
38 >  <property name="build.jsr166xlib.dir"        location="${build.dir}/jsr166xlib"/>
39 >  <property name="build.jsr166xjavadocs.dir"   location="${build.dir}/jsr166xjavadocs"/>
40 >
41 >  <property name="build.jsr166y.dir"           location="${build.dir}/jsr166y"/>
42 >  <property name="build.jsr166ylib.dir"        location="${build.dir}/jsr166ylib"/>
43 >  <property name="build.jsr166yjavadocs.dir"   location="${build.dir}/jsr166yjavadocs"/>
44 >
45 >  <property name="build.extra166y.dir"         location="${build.dir}/extra166y"/>
46 >  <property name="build.extra166ylib.dir"      location="${build.dir}/extra166ylib"/>
47 >  <property name="build.extra166yjavadocs.dir" location="${build.dir}/extra166yjavadocs"/>
48  
49    <!-- Source locations -->
50    <property name="src.dir"              location="${basedir}/src/main"/>
59  <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>
51    <property name="test.src.dir"         location="${basedir}/src/test"/>
52 <  <property name="ant.src.dir"          location="${basedir}/etc/ant"/>
53 <  <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>
52 >  <property name="loops.src.dir"        location="${basedir}/src/loops"/>
53 >  <property name="tck.src.dir"          location="${test.src.dir}/tck"/>
54 >  <property name="jtreg.src.dir"        location="${test.src.dir}/jtreg"/>
55    <property name="lib.dir"              location="${basedir}/lib"/>
56    <property name="dist.dir"             location="${basedir}/dist"/>
57 <
57 >  <property name="topsrc.dir"           location="${basedir}/src"/>
58 >  <property name="jsr166xsrc.dir"       location="${basedir}/src/jsr166x"/>
59 >  <property name="jsr166ysrc.dir"       location="${basedir}/src/jsr166y"/>
60 >  <property name="extra166ysrc.dir"     location="${basedir}/src/extra166y"/>
61 >  <property name="jdksrc.dir"           location="/home/dl/1.6.0/j2se/martin/j2se/src/share/classes"/>
62    <!-- Distribution locations -->
63 <  <property name="dist.javadocs.dir"    location="${dist.dir}/docs"/>
63 >  <property name="dist.javadocs.dir"           location="${dist.dir}/docs"/>
64 >  <property name="dist.jsr166xjavadocs.dir"    location="${dist.dir}/jsr166xdocs"/>
65 >  <property name="dist.jsr166yjavadocs.dir"    location="${dist.dir}/jsr166ydocs"/>
66 >  <property name="dist.extra166yjavadocs.dir"  location="${dist.dir}/extra166ydocs"/>
67  
68    <!-- Jar locations -->
69    <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>
70 <  <property name="javac.jar"            location="${lib.dir}/javac.jar"/>
71 <  <property name="collect.jar"          location="${lib.dir}/collect.jar"/>
70 >  <property name="jsr166xproduct.jar"   location="${build.jsr166xlib.dir}/jsr166x.jar"/>
71 >  <property name="jsr166yproduct.jar"   location="${build.jsr166ylib.dir}/jsr166y.jar"/>
72 >  <property name="extra166yproduct.jar" location="${build.extra166ylib.dir}/extra166y.jar"/>
73    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
74  <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
75
76
77  <!--
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}"/>
89    <pathelement location="${rt.jar}"/>
90  </path>
74  
75 <  <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
76 <  <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 <   -->
75 >  <!-- Bootclasspath argument -->
76 >  <property name="bootclasspath.args"   value="-Xbootclasspath/p:${product.jar}"/>
77  
78 +  <!-- Test classpath -->
79    <path id="test.classpath">
105    <pathelement location="${product.jar}"/>
80      <pathelement location="${build.testcases.dir}"/>
81      <pathelement location="${junit.jar}"/>
82    </path>
83  
84 <  <!-- Flatten test classpath into a platform-appropriate string -->
85 <  <property name="test.classpath" refid="test.classpath"/>
86 <
87 <  <!-- Turn the flattened test classpath into a javac argument -->
114 <  <property name="test.javac.args" value='-Xbootclasspath/p:${test.classpath}'/>
115 <
84 >  <!-- ALoops classpath -->
85 >  <path id="loops.classpath">
86 >    <pathelement location="${build.loops.dir}"/>
87 >  </path>
88  
89  
90    <!-- Main targets -->
91  
92 <  <target name="compile" depends="init"
92 >  <target name="dists"
93 >          depends="dist, jsr166xdist, jsr166ydist, extra166ydist"
94 >          description="Builds all public jars and docs"/>
95 >
96 >  <target name="compile"
97 >          depends="init, configure-compiler"
98            description="Compiles main sources to build folder">
99  
100      <mkdir dir="${build.classes.dir}"/>
# Line 130 | Line 107 | ant [target], where target is one of:
107             source="${build.sourcelevel}"
108               fork="true">
109  
110 <      <bootclasspath refid="javac.bootclasspath"/>
111 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
110 >      <include name="**/*.java"/>
111 >      <compilerarg value="-XDignore.symbol.file"/>
112 >
113 > <!--
114 >      <exclude name="java/lang/**"/>
115 >      <compilerarg line="${build.args}"/>
116 >      <compilerarg line="-Xlint -Xmaxwarns 1000"/>
117 > -->
118  
119      </javac>
120  
121    </target>
122  
123  
141  <target name="jar" depends="native-jar, emulation-jar"/>
142
143
144  <target name="test" depends="init, check-junit, report-tests"
145          description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)"
146  />
147
124  
125 <  <target name="checkstyle" depends="filter-src"
126 <          description="Reports on style errors in Java source (verbose, mostly chaff)">
125 >  <target name="jar"
126 >          depends="compile"
127 >          description="Builds library jar from compiled sources">
128  
129 <    <taskdef resource="checkstyletask.properties"
153 <            classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
129 >    <mkdir dir="${build.lib.dir}"/>
130  
131 <    <checkstyle>
132 <      <formatter type="plain"/>  <!-- also available: type="xml" -->
133 <      <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
158 <    </checkstyle>
131 >    <jar destfile="${product.jar}">
132 >      <fileset dir="${build.classes.dir}"/>
133 >    </jar>
134  
135    </target>
136  
137  
163  <target name="doccheck" depends="filter-src"
164          description="Reports on javadoc style errors (not working yet)">
138  
139 <    <delete dir="${build.doccheck.dir}"/>
140 <    <mkdir dir="${build.doccheck.dir}"/>
139 >  <target name="test"
140 >          depends="init, configure-tests, report-tests"
141 >          description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
142  
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>
143  
144  
145 <  <target name="docs" depends="filter-src"
145 >  <target name="docs"
146            description="Builds javadocs with custom tags to build folder">
147  
148      <delete dir="${build.javadocs.dir}"/>
149      <mkdir dir="${build.javadocs.dir}"/>
150  
151      <javadoc destdir="${build.javadocs.dir}"
152 <                link="http://java.sun.com/j2se/1.4.1/docs/api"
152 >                link="http://java.sun.com/javase/6/docs/api/"
153              overview="${src.dir}/intro.html"
154 <              source="${build.docsourcelevel}">
154 >            sourcepath="${src.dir}:${jdksrc.dir}"
155 >    >
156  
157 <      <tag name="revised" description="Last revised:"/>
190 <      <tag name="spec" description="Specified by:"/>
191 <      <tag name="editor" description="Last edited by:"/>
192 <      <tag name="fixme" description="FIX ME:"/>
193 <      <packageset dir="${build.filter.src.dir}"/>
157 >      <packageset dir="${src.dir}"/>
158  
159      </javadoc>
160  
161    </target>
162  
163  
200  <!--
201   # javac -s doesn't reliably generate compilable code. It generates
202   # bridge methods (marked as "synthetic") that can have identical
203   # signatures to existing methods except for the return value.
204   -->
205  <target name="strip" depends="init">
206
207    <mkdir dir="${build.stripped.dir}"/>
164  
165 <    <javac srcdir="${src.dir}"
166 <          destdir="${build.stripped.dir}"
167 <            debug="${build.debug}"
212 <       debuglevel="${build.debuglevel}"
213 <      deprecation="${build.deprecation}"
214 <           source="${build.sourcelevel}"
215 <             fork="true">
165 >  <target name="dist"
166 >          depends="init, dist-clean, dist-jar, dist-docs"
167 >          description="Puts all distributable products in single hierarchy"/>
168  
217      <bootclasspath refid="javac.bootclasspath"/>
218      <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
169  
170 <    </javac>
170 >  <target name="release"
171 >          depends="dist"
172 >          description="Puts entire CVS tree, plus distribution productions, in a jar">
173 >
174 >    <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>
175 >
176 >    <jar basedir="${basedir}" destfile="${release.jar}">
177 >      <!-- <exclude name="build/**"/> -->
178 >      <exclude name="${release.jar}"/>
179 >      <exclude name="user.properties"/>
180 >      <exclude name="etc/notes/**"/>
181 >      <exclude name="src/emulation/**"/>
182 >      <exclude name="**/SyntaxTest.java"/>
183 >      <exclude name="**/SuperfluousAbstract.java"/>
184 >    </jar>
185  
186    </target>
187  
188  
225  <target name="dist" depends="init, dist-clean, dist-jar, dist-docs"
226          description="Puts all distributable products in single hierarchy"/>
227
189  
190    <target name="clean"
191            description="Removes all build products">
# Line 236 | Line 197 | ant [target], where target is one of:
197    </target>
198  
199  
200 +
201    <target name="dist-clean"
202            description="Removes all build and distribution products">
203  
# Line 244 | Line 206 | ant [target], where target is one of:
206    </target>
207  
208  
247  <!-- Anthill targets -->
209  
210 <  <!-- Should really run the tests instead of just the jar target -->
211 <  <target name="anthill-build" depends="jar, test, docs, dist-docs"/>
210 >  <target name="dist-docs"
211 >          description="Builds javadocs without custom tags to dist folder">
212 >
213 >    <delete dir="${dist.javadocs.dir}"/>
214 >    <mkdir dir="${dist.javadocs.dir}"/>
215 >
216 >    <javadoc destdir="${dist.javadocs.dir}"
217 >            link="http://java.sun.com/javase/6/docs/api/"
218 >            overview="${src.dir}/intro.html"
219 >
220 >            sourcepath="${src.dir}:${jdksrc.dir}"
221 >     >
222 > <!--
223 >      <packageset dir="${src.dir}" defaultexcludes="yes">
224 >      <include name="java/util/concurrent"/>
225 >      <include name="java/util/concurrent/atomic"/>
226 >      <include name="java/util/concurrent/locks"/>
227 >      </packageset>
228 > -->
229 >      <fileset dir="${topsrc.dir}" defaultexcludes="yes">
230 >      <include name="main/java/util/concurrent/*.java"/>
231 >      <include name="main/java/util/concurrent/atomic/*.java"/>
232 >      <include name="main/java/util/concurrent/locks/*.java"/>
233 >      <include name="main/java/util/*.java"/>
234 > <!--
235 >      <include name="main/java/util/concurrent/*.html"/>
236 >      <include name="main/java/util/concurrent/atomic/*.html"/>
237 >      <include name="main/java/util/concurrent/locks/*.html"/>
238 >      <include name="main/java/util/*.html"/>
239 > -->
240 > <!--      <include name="jsr166x/*.java"/> -->
241 >      </fileset>
242 >    </javadoc>
243  
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>
244    </target>
245  
246  
247 +
248    <!-- Internal targets -->
249  
269  <target name="set-warnings-if" if="build.warnings">
250  
251 <    <property name="build.warnings.option" value="-warnunchecked"/>
251 >  <target name="init">
252 >
253 >    <!-- Version is kept in a separate file -->
254 >    <loadfile property="version" srcFile="version.properties"/>
255 >    <echo>Building JSR-166 version ${version}</echo>
256 >    <echo>java.home is ${java.home}</echo>
257  
258    </target>
259  
260  
261 <  <target name="set-warnings-unless" unless="build.warnings">
261 >  <target name="dist-jar"
262 >          depends="clean, jar">
263  
264 <    <property name="build.warnings.option" value=""/>
264 >    <copy file="${product.jar}" todir="${dist.dir}"/>
265  
266    </target>
267  
268  
269 <  <target name="init" depends="set-warnings-if, set-warnings-unless">
269 >  <target name="compile-tests"
270 >          depends="jar">
271  
272 <    <!-- Version is kept in a separate file -->
273 <    <loadfile property="version" srcFile="version.properties"/>
274 <    <echo>Building JSR-166 version ${version}</echo>
272 >    <mkdir dir="${build.testcases.dir}"/>
273 >
274 >    <javac srcdir="${tck.src.dir}"
275 >          destdir="${build.testcases.dir}"
276 >            debug="${build.debug}"
277 >       debuglevel="${build.debuglevel}"
278 >      deprecation="${build.deprecation}"
279 >           source="${build.sourcelevel}"
280 >             fork="true">
281 >
282 >      <compilerarg value="${bootclasspath.args}"/>
283 >      <compilerarg line="${build.args}"/>
284 >
285 >      <classpath refid="test.classpath"/>
286 >
287 >    </javac>
288 >
289 >    <javac srcdir="${test.src.dir}"
290 >          destdir="${build.testcases.dir}"
291 >            debug="${build.debug}"
292 >       debuglevel="${build.debuglevel}"
293 >      deprecation="${build.deprecation}"
294 >           source="${build.sourcelevel}"
295 >             fork="true">
296 >
297 >      <include name="jsr166/test/**"/>
298 >
299 >      <compilerarg value="${bootclasspath.args}"/>
300 >      <compilerarg line="${build.args}"/>
301 >
302 >      <classpath refid="test.classpath"/>
303 >
304 >    </javac>
305 >
306 > <!--
307 >    <javac srcdir="${jtreg.src.dir}"
308 >          destdir="${build.testcases.dir}"
309 >            debug="${build.debug}"
310 >       debuglevel="${build.debuglevel}"
311 >      deprecation="${build.deprecation}"
312 >           source="${build.sourcelevel}"
313 >             fork="true">
314 >
315 >      <compilerarg value="${bootclasspath.args}"/>
316 >      <compilerarg line="${build.args}"/>
317 >
318 >      <classpath refid="test.classpath"/>
319 >
320 >    </javac>
321 > -->
322  
323    </target>
324  
325  
326 <  <target name="native-jar" depends="compile"
327 <          description="Builds library jar from compiled sources">
326 >  <target name="run-tests"
327 >          depends="compile-tests">
328  
329 <    <mkdir dir="${build.lib.dir}"/>
329 >    <!-- May be overridden by user.properties -->
330 >    <property name="testcase" value="*"/>
331  
332 <    <jar destfile="${product.jar}">
333 <      <fileset dir="${build.classes.dir}"/>
334 <    </jar>
332 >    <mkdir dir="${build.reports.dir}"/>
333 >
334 >    <junit printsummary="true"
335 >             showoutput="true"
336 >          errorProperty="junit.failed"
337 >        failureProperty="junit.failed"
338 >                    dir="${build.reports.dir}"
339 >                   fork="true">
340 >
341 >      <jvmarg value="${bootclasspath.args}"/>
342 >      <jvmarg value="-server"/>
343 >      <jvmarg value="-showversion"/>
344 >
345 >      <classpath refid="test.classpath"/>
346 >
347 >      <formatter type="xml"/>
348 >
349 >      <batchtest todir="${build.reports.dir}" unless="no.test.tck">
350 >        <fileset dir="${tck.src.dir}">
351 >          <include name="**/${testcase}Test.java"/>
352 >        </fileset>
353 >      </batchtest>
354 >
355 >      <batchtest todir="${build.reports.dir}" if="do.test.old">
356 >        <fileset dir="${test.src.dir}">
357 >          <include name="jsr166/test/**/${testcase}Test.java"/>
358 >        </fileset>
359 >      </batchtest>
360 >
361 > <!--
362 >      <batchtest todir="${build.reports.dir}" if="do.test.jtreg">
363 >        <fileset dir="${jtreg.src.dir}">
364 >          <include name="**/${testcase}Test.java"/>
365 >        </fileset>
366 >      </batchtest>
367 > -->
368 >
369 >    </junit>
370 >
371 >  </target>
372 >
373 >
374 >  <target name="report-tests"
375 >          depends="run-tests">
376 >
377 >    <!-- Sets junit.report.format to frames if redirection is present,
378 >         otherwise sets it to noframes. -->
379 >    <available property="junit.report.format"
380 >                  value="frames"
381 >              classname="org.apache.xalan.lib.Redirect"
382 >    />
383 >    <property name="junit.report.format" value="noframes"/>
384 >
385 >    <junitreport todir="${build.reports.dir}">
386 >      <fileset dir="${build.reports.dir}">
387 >        <include name="TEST-*.xml"/>
388 >      </fileset>
389 >      <report format="${junit.report.format}" todir="${build.reports.dir}"
390 >      />
391 >    </junitreport>
392 >
393 >    <fail message="Test Cases Failed" if="junit.failed"/>
394 >
395 >  </target>
396 >
397 >
398 >  <target name="configure-compiler">
399 >
400 >    <property name="unchecked.option" value="-Xlint:unchecked"/>
401 >
402 >    <condition property="warnunchecked.arg" value="${unchecked.option}">
403 >      <istrue value="${build.warnunchecked}"/>
404 >    </condition>
405 >
406 >    <property name="warnunchecked.arg" value=""/>
407 >
408 >
409 >    <!-- Common options in javac invocations -->
410 >    <property name="build.args" value="${warnunchecked.arg}"/>
411 >
412 >  </target>
413 >
414 >
415 >  <target name="configure-tests"
416 >       depends="configure-compiler">
417 >
418 >    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
419 >    <available property="junit.available"
420 >               classname="junit.framework.Protectable"/>
421 >
422 >    <!-- Xalan -->
423 >    <available property="xalan.available"
424 >               classname="org.apache.xalan.Version"/>
425 >
426 >
427 >    <!-- Ant 1.6beta and later don't need or want this check -->
428 >    <!--
429 >    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
430 >          unless="junit.available"/>
431 >
432 >    <fail message="Need Xalan 2.5.1 jar in ${ant.home}${file.separator}lib to run tests"
433 >          unless="xalan.available"/>
434 >    -->
435 >
436 >  </target>
437 >
438 >
439 >  <!-- Various demos and test programs -->
440 >
441 >
442 >  <target name="loops" depends="init, configure-compiler"
443 >          description="Benchmark from Doug Lea's AQS paper">
444 >
445 >    <mkdir dir="${build.loops.dir}"/>
446 >
447 >    <javac srcdir="${loops.src.dir}"
448 >          destdir="${build.loops.dir}"
449 >            debug="${build.debug}"
450 >       debuglevel="${build.debuglevel}"
451 >      deprecation="${build.deprecation}"
452 >           source="${build.sourcelevel}"
453 >             fork="true">
454 >
455 >      <compilerarg line="${build.args}"/>
456 >      <classpath refid="loops.classpath"/>
457 >
458 >    </javac>
459 >
460 >    <java classname="ALoops" fork="true">
461 >      <classpath refid="loops.classpath"/>
462 >    </java>
463  
464    </target>
465  
466  
467 <  <target name="compile-emulation" depends="init"
468 <          if="build.emulation"
469 <          description="Compiles emulation sources to build folder">
467 >  <!-- jsr166x -->
468 >
469 >
470 >  <target name="jsr166xcompile"
471 >          depends="init, configure-compiler"
472 >          description="Compiles jsr166x sources">
473  
474 <    <mkdir dir="${build.emulation.dir}"/>
474 >    <mkdir dir="${build.jsr166x.dir}"/>
475  
476 <    <javac srcdir="${emulation.src.dir}"
477 <          destdir="${build.emulation.dir}"
476 >    <javac srcdir="${jsr166xsrc.dir}"
477 >          destdir="${build.jsr166x.dir}"
478              debug="${build.debug}"
479         debuglevel="${build.debuglevel}"
480        deprecation="${build.deprecation}"
481             source="${build.sourcelevel}"
482               fork="true">
483  
484 <      <bootclasspath refid="javac.bootclasspath"/>
485 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
484 >      <include name="**/*.java"/>
485 >      <compilerarg line="${build.args}"/>
486  
487      </javac>
488  
489    </target>
490  
491  
326  <target name="emulation-jar" depends="native-jar, compile-emulation"
327          if="build.emulation">
492  
493 <    <jar destfile="${product.jar}" update="true" duplicate="add">
494 <      <fileset dir="${build.emulation.dir}"/>
493 >  <target name="jsr166xjar"
494 >          depends="jsr166xcompile"
495 >          description="Builds library jar from compiled sources">
496 >
497 >    <mkdir dir="${build.jsr166xlib.dir}"/>
498 >
499 >    <jar destfile="${jsr166xproduct.jar}">
500 >      <fileset dir="${build.jsr166x.dir}"/>
501      </jar>
502  
503    </target>
504  
505  
336  <target name="dist-jar" depends="clean, jar">
506  
507 <    <copy file="${product.jar}" todir="${dist.dir}"/>
507 >  <target name="jsr166xdocs"
508 >          description="Builds javadocs with custom tags to build folder">
509 >
510 >    <delete dir="${build.jsr166xjavadocs.dir}"/>
511 >    <mkdir dir="${build.jsr166xjavadocs.dir}"/>
512 >
513 >    <javadoc destdir="${build.jsr166xjavadocs.dir}"
514 >             link="http://java.sun.com/javase/6/docs/api/"
515 >            sourcepath="${topsrc.dir}:${jdksrc.dir}"
516 >    >
517 >      <packageset dir="${topsrc.dir}" defaultexcludes="yes">
518 >      <include name="jsr166x"/>
519 >      </packageset>
520 >
521 >
522 >    </javadoc>
523 >
524 >  </target>
525 >
526 >
527 >  <target name="jsr166xdist"
528 >          depends="jsr166xdist-clean, jsr166xdist-jar, jsr166xdist-docs"
529 >          description="Puts all distributable products in single hierarchy"/>
530 >
531 >
532 >
533 >  <target name="jsr166xclean"
534 >          description="Removes all build products">
535 >
536 >    <delete dir="${build.jsr166x.dir}"/>
537 >    <delete dir="${build.jsr166xlib.dir}"/>
538 >
539 >  </target>
540 >
541 >
542 >
543 >  <target name="jsr166xdist-clean"
544 >          description="Removes all build and distribution products">
545  
546    </target>
547  
548  
549 <  <target name="dist-docs" depends="filter-src"
549 >
550 >  <target name="jsr166xdist-docs"
551            description="Builds javadocs without custom tags to dist folder">
552  
553 <    <delete dir="${dist.javadocs.dir}"/>
554 <    <mkdir dir="${dist.javadocs.dir}"/>
553 >    <delete dir="${dist.jsr166xjavadocs.dir}"/>
554 >    <mkdir dir="${dist.jsr166xjavadocs.dir}"/>
555  
556 <    <javadoc destdir="${dist.javadocs.dir}"
557 <                link="http://java.sun.com/j2se/1.4.1/docs/api"
558 <            overview="${src.dir}/intro.html"
559 <              source="${build.docsourcelevel}">
556 >    <javadoc destdir="${dist.jsr166xjavadocs.dir}"
557 >                link="http://java.sun.com/javase/6/docs/api/"
558 >              source="${build.sourcelevel}">
559 >
560 >      <packageset dir="${topsrc.dir}" defaultexcludes="yes">
561 >      <include name="jsr166x"/>
562 >      </packageset>
563 >
564 >    </javadoc>
565 >
566 >  </target>
567 >
568 >  <target name="jsr166xdist-jar"
569 >          depends="jsr166xclean, jsr166xjar">
570 >
571 >    <copy file="${jsr166xproduct.jar}" todir="${dist.dir}"/>
572 >
573 >  </target>
574 >
575 >  <!-- jsr166y -->
576 >
577 >
578 >  <target name="jsr166ycompile"
579 >          depends="init, configure-compiler"
580 >          description="Compiles jsr166y sources">
581 >
582 >    <mkdir dir="${build.jsr166y.dir}"/>
583 >
584 >    <javac srcdir="${jsr166ysrc.dir}"
585 >          destdir="${build.jsr166y.dir}"
586 >            debug="${build.debug}"
587 >       debuglevel="${build.debuglevel}"
588 >      deprecation="${build.deprecation}"
589 >           source="${build.sourcelevel}"
590 >             fork="true">
591 >
592 >      <include name="**/*.java"/>
593 >      <compilerarg line="${build.args}"/>
594 >      <compilerarg value="${bootclasspath.args}"/>
595 >
596 > <!--       <compilerarg line="-Xlint -Xmaxwarns 1000"/> -->
597 >
598 >    </javac>
599 >
600 >  </target>
601 >
602 >
603 >
604 >  <target name="jsr166yjar"
605 >          depends="jsr166ycompile"
606 >          description="Builds library jar from compiled sources">
607 >
608 >    <mkdir dir="${build.jsr166ylib.dir}"/>
609 >
610 >    <jar destfile="${jsr166yproduct.jar}" index="true">
611 >      <fileset dir="${build.jsr166y.dir}"/>
612 >    </jar>
613 >
614 >  </target>
615 >
616 >
617 >
618 >  <target name="jsr166ydocs"
619 >          description="Builds javadocs with custom tags to build folder">
620 >
621 >    <delete dir="${build.jsr166yjavadocs.dir}"/>
622 >    <mkdir dir="${build.jsr166yjavadocs.dir}"/>
623 >
624 >    <javadoc destdir="${build.jsr166yjavadocs.dir}"
625 >                link="http://java.sun.com/javase/6/docs/api/"
626 >            sourcepath="${topsrc.dir}:${jdksrc.dir}"
627 >    >
628 >      <packageset dir="${topsrc.dir}" defaultexcludes="no">
629 >      <include name="jsr166y"/>
630 >      </packageset>
631  
354      <packageset dir="${build.filter.src.dir}"/>
632  
633      </javadoc>
634  
635    </target>
636  
637  
638 <  <target name="compile-ant-filter" depends="init">
638 >  <target name="jsr166ydist"
639 >          depends="jsr166ydist-clean, jsr166ydist-jar, jsr166ydist-docs"
640 >          description="Puts all distributable products in single hierarchy"/>
641  
363    <mkdir dir="${build.ant.dir}"/>
642  
643 <    <javac srcdir="${ant.src.dir}"
644 <          destdir="${build.ant.dir}"
645 <           source="1.4"
646 <    />
643 >
644 >  <target name="jsr166yclean"
645 >          description="Removes all build products">
646 >
647 >    <delete dir="${build.jsr166y.dir}"/>
648 >    <delete dir="${build.jsr166ylib.dir}"/>
649  
650    </target>
651  
652  
373  <target name="filter-src" depends="compile-ant-filter">
653  
654 <    <mkdir dir="${build.filter.src.dir}"/>
654 >  <target name="jsr166ydist-clean"
655 >          description="Removes all build and distribution products">
656  
657 <    <copy todir="${build.filter.src.dir}">
658 <      <fileset dir="${src.dir}">
659 <        <include name="**/*.java"/>
660 <        <exclude name="**/Random.java"/>
661 <        <exclude name="**/Unsafe.java"/>
662 <      </fileset>
663 <      <filterchain>
664 <        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
665 <                      classpath="${build.ant.dir}">
666 <          <!--
667 <           # These arguments are to get rid of angle-bracketed type
668 <           # parameters so that javadoc can run on the result. The
669 <           # following heuristic that seems to work:
670 <           #
671 <           # For all lines not starting with space(s)-asterisk-space(s),
672 <           #   replace <something> with a space, where there may be more
673 <           #   than one right angle bracket at the end, and "something"
394 <           #   must not contain parens or pipes. (This may need some
395 <           #   tweaking.)
396 <           -->
397 <          <param name="notmatching" value="^\s+\*\s.*$"/>
398 <          <param name="pattern" value="&lt;[^|>()]+?>+"/>
399 <          <param name="replacement" value=" "/>
400 <        </filterreader>
401 <        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
402 <                      classpath="${build.ant.dir}">
403 <          <!--
404 <           # These arguments are to uncomment lines beginning with
405 <           # "//@" so that javadoc can see imports that are needed
406 <           # to resolve links but that shouldn't be in the compiled
407 <           # code.
408 <           -->
409 <          <param name="matching" value="^//@.*$"/>
410 <          <param name="pattern" value="^//@"/>
411 <          <param name="replacement" value=""/>
412 <        </filterreader>
413 <      </filterchain>
414 <    </copy>
657 >  </target>
658 >
659 >  <target name="jsr166ydist-docs"
660 >          description="Builds javadocs without custom tags to dist folder">
661 >
662 >    <delete dir="${dist.jsr166yjavadocs.dir}"/>
663 >    <mkdir dir="${dist.jsr166yjavadocs.dir}"/>
664 >
665 >    <javadoc destdir="${dist.jsr166yjavadocs.dir}"
666 >                link="http://java.sun.com/javase/6/docs/api/"
667 >              source="${build.sourcelevel}"
668 >            sourcepath="${topsrc.dir}:${jdksrc.dir}"
669 >            >
670 >      <fileset dir="${topsrc.dir}" defaultexcludes="yes">
671 >      <include name="jsr166y/*.java"/>
672 >            </fileset>
673 >    </javadoc>
674  
675    </target>
676  
677 +  <target name="jsr166ydist-jar"
678 +          depends="jsr166yclean, jsr166yjar">
679  
680 <  <target name="compile-tests" depends="jar">
680 >    <copy file="${jsr166yproduct.jar}" todir="${dist.dir}"/>
681  
682 <    <mkdir dir="${build.testcases.dir}"/>
682 >  </target>
683  
684 <    <javac srcdir="${test.src.dir}"
685 <          destdir="${build.testcases.dir}"
684 >  <!-- extra166y -->
685 >
686 >
687 >  <target name="extra166ycompile"
688 >          depends="init, configure-compiler, jsr166ycompile"
689 >          description="Compiles extra166y sources">
690 >
691 >    <mkdir dir="${build.extra166y.dir}"/>
692 >
693 >    <javac srcdir="${extra166ysrc.dir}"
694 >          destdir="${build.extra166y.dir}"
695              debug="${build.debug}"
696 +            classpath="${jsr166yproduct.jar}"
697         debuglevel="${build.debuglevel}"
698        deprecation="${build.deprecation}"
699             source="${build.sourcelevel}"
700               fork="true">
701  
702 <      <bootclasspath refid="javac.bootclasspath"/>
703 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
704 <      <classpath refid="test.classpath"/>
702 >      <include name="**/*.java"/>
703 >      <compilerarg line="${build.args}"/>
704 >      <compilerarg value="${bootclasspath.args}"/>
705 >
706 > <!--       <compilerarg line="-Xlint -Xmaxwarns 1000"/> -->
707  
708      </javac>
709  
710    </target>
711  
712  
440  <target name="run-tests" depends="compile-tests">
713  
714 <    <!-- May be overridden by user.properties -->
715 <    <property name="testcase" value="*"/>
714 >  <target name="extra166yjar"
715 >          depends="extra166ycompile"
716 >          description="Builds library jar from compiled sources">
717  
718 <    <mkdir dir="${build.reports.dir}"/>
718 >    <mkdir dir="${build.extra166ylib.dir}"/>
719  
720 <    <junit printsummary="true"
721 <             showoutput="true"
722 <          errorProperty="junit.failed"
450 <        failureProperty="junit.failed"
451 <                    dir="${build.reports.dir}"
452 <                   fork="true">
720 >    <jar destfile="${extra166yproduct.jar}" index="true">
721 >      <fileset dir="${build.extra166y.dir}"/>
722 >    </jar>
723  
724 <      <jvmarg value="${test.javac.args}"/>
724 >  </target>
725  
456      <formatter type="xml"/>
726  
458      <batchtest todir="${build.reports.dir}">
459        <fileset dir="${test.src.dir}">
460          <include name="**/${testcase}Test.java"/>
461        </fileset>
462      </batchtest>
727  
728 <    </junit>
728 >  <target name="extra166ydocs"
729 >          description="Builds javadocs with custom tags to build folder">
730 >
731 >    <delete dir="${build.extra166yjavadocs.dir}"/>
732 >    <mkdir dir="${build.extra166yjavadocs.dir}"/>
733 >
734 >    <javadoc destdir="${build.extra166yjavadocs.dir}"
735 >                link="http://java.sun.com/javase/6/docs/api/"
736 >            sourcepath="${topsrc.dir}:${jdksrc.dir}"
737 >    >
738 >      <packageset dir="${topsrc.dir}" defaultexcludes="no">
739 >      <include name="extra166y"/>
740 >      </packageset>
741 >
742 >
743 >    </javadoc>
744  
745    </target>
746  
747  
748 <  <target name="report-tests" depends="run-tests">
749 <    <!-- Sets junit.report.format to frames if Xalan is present,
750 <         otherwise sets it to noframes. -->
472 <    <available property="junit.report.format"
473 <                  value="frames"
474 <              classname="org.apache.xalan.lib.Redirect"
475 <    />
476 <    <property name="junit.report.format" value="noframes"/>
748 >  <target name="extra166ydist"
749 >          depends="extra166ydist-clean, extra166ydist-jar, extra166ydist-docs"
750 >          description="Puts all distributable products in single hierarchy"/>
751  
478    <junitreport todir="${build.reports.dir}">
479      <fileset dir="${build.reports.dir}">
480        <include name="TEST-*.xml"/>
481      </fileset>
482      <report styledir="${stylesheet.dir}"
483                format="${junit.report.format}"
484                 todir="${build.reports.dir}"
485      />
486    </junitreport>
752  
753 <    <fail message="Test Cases Failed" if="junit.failed"/>
753 >
754 >  <target name="extra166yclean"
755 >          description="Removes all build products">
756 >
757 >    <delete dir="${build.extra166y.dir}"/>
758 >    <delete dir="${build.extra166ylib.dir}"/>
759 >
760    </target>
761  
762  
763 <  <target name="check-junit">
764 <    <!-- FIXME: this test isn't specific enough -->
765 <    <available property="junit.available"
766 <               classname="junit.framework.TestCase"/>
496 <    <fail message="Need JUnit 3.8 to run tests" unless="junit.available"/>
763 >
764 >  <target name="extra166ydist-clean"
765 >          description="Removes all build and distribution products">
766 >
767    </target>
768  
769 +  <target name="extra166ydist-docs"
770 +          description="Builds javadocs without custom tags to dist folder">
771 +
772 +    <delete dir="${dist.extra166yjavadocs.dir}"/>
773 +    <mkdir dir="${dist.extra166yjavadocs.dir}"/>
774 +
775 +    <javadoc destdir="${dist.extra166yjavadocs.dir}"
776 +                link="http://java.sun.com/javase/6/docs/api/"
777 +              source="${build.sourcelevel}"
778 +            sourcepath="${topsrc.dir}:${jdksrc.dir}"
779 +            >
780 +      <fileset dir="${topsrc.dir}" defaultexcludes="yes">
781 +      <include name="extra166y/*.java"/>
782 +            </fileset>
783 +    </javadoc>
784 +
785 +  </target>
786 +
787 +  <target name="extra166ydist-jar"
788 +          depends="extra166yclean, extra166yjar">
789 +
790 +    <copy file="${extra166yproduct.jar}" todir="${dist.dir}"/>
791 +
792 +  </target>
793  
794   </project>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines