7 |
|
Usage: ant [target] |
8 |
|
|
9 |
|
User-specific settings are read from user.properties. |
10 |
< |
See user.properties.sample for examples. |
10 |
> |
See user.properties.sample for an explanation of some useful settings. |
11 |
|
------------------------------------------------------------------------------ |
12 |
|
</description> |
13 |
|
|
26 |
|
<property name="build.debug" value="true"/> |
27 |
|
<property name="build.debuglevel" value="source,lines,vars"/> |
28 |
|
<property name="build.deprecation" value="false"/> |
29 |
– |
<property name="build.novariance.arg" value=""/> |
29 |
|
|
30 |
|
<!-- Build locations --> |
31 |
|
<property name="build.dir" location="build"/> |
54 |
|
|
55 |
|
<!-- Jar locations --> |
56 |
|
<property name="product.jar" location="${build.lib.dir}/jsr166.jar"/> |
58 |
– |
<property name="javac.jar" location="${lib.dir}/javac.jar"/> |
59 |
– |
<property name="collect.jar" location="${lib.dir}/collect.jar"/> |
57 |
|
<property name="junit.jar" location="${lib.dir}/junit.jar"/> |
58 |
|
<property name="rt.jar" location="${java.home}/lib/rt.jar"/> |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
< |
<!-- |
63 |
< |
! Bootclasspath munging for source compilation. |
67 |
< |
--> |
68 |
< |
|
69 |
< |
<path id="javac.bootclasspath.prefix"> |
70 |
< |
<!-- <pathelement location="${src.dir}"/> --> |
71 |
< |
<pathelement location="${javac.jar}"/> |
72 |
< |
</path> |
73 |
< |
|
74 |
< |
<path id="javac.bootclasspath"> |
75 |
< |
<!-- <pathelement location="${src.dir}"/> --> |
76 |
< |
<pathelement location="${collect.jar}"/> |
77 |
< |
<pathelement location="${rt.jar}"/> |
78 |
< |
</path> |
79 |
< |
|
80 |
< |
<!-- Flatten bootclasspath prefix into a platform-appropriate string --> |
81 |
< |
<property name="javac.bootclasspath.prefix" |
82 |
< |
refid="javac.bootclasspath.prefix"/> |
83 |
< |
|
84 |
< |
<!-- Turn the flattened bootclasspath prefix into a javac argument --> |
85 |
< |
<property name="build.bootclasspath.arg" |
86 |
< |
value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/> |
87 |
< |
|
88 |
< |
|
89 |
< |
<!-- |
90 |
< |
! Bootclasspath munging for testing, so JUnit can test our local |
91 |
< |
! modifications to java.*. |
92 |
< |
--> |
93 |
< |
|
94 |
< |
<path id="test.classpath"> |
95 |
< |
<pathelement location="${product.jar}"/> |
96 |
< |
<pathelement location="${build.testcases.dir}"/> |
97 |
< |
<pathelement location="${junit.jar}"/> |
98 |
< |
</path> |
99 |
< |
|
100 |
< |
<!-- Flatten test classpath into a platform-appropriate string --> |
101 |
< |
<property name="test.classpath" refid="test.classpath"/> |
102 |
< |
|
103 |
< |
<!-- Turn the flattened test classpath into a javac argument --> |
104 |
< |
<property name="test.bootclasspath.arg" |
105 |
< |
value='-Xbootclasspath/p:${test.classpath}'/> |
106 |
< |
|
107 |
< |
|
108 |
< |
|
109 |
< |
<!-- Files excluded from emulation and dist-docs --> |
110 |
< |
<patternset id="emulation.excludes"> |
62 |
> |
<!-- Files excluded from dist-docs and emulation jar --> |
63 |
> |
<patternset id="unsafe.exclusion"> |
64 |
|
<exclude name="java/util/Random.*"/> |
65 |
|
<exclude name="sun/misc/Unsafe.*"/> |
66 |
|
</patternset> |
67 |
|
|
68 |
+ |
<!-- Files excludes from emulation jar --> |
69 |
+ |
<patternset id="atomic.exclusion"> |
70 |
+ |
<exclude name="java/util/concurrent/atomic/AtomicBoolean*"/> |
71 |
+ |
<exclude name="java/util/concurrent/atomic/AtomicInteger*"/> |
72 |
+ |
<exclude name="java/util/concurrent/atomic/AtomicLong*"/> |
73 |
+ |
<exclude name="java/util/concurrent/atomic/AtomicReference*"/> |
74 |
+ |
</patternset> |
75 |
+ |
|
76 |
|
|
77 |
|
|
78 |
|
<!-- Main targets --> |
79 |
|
|
80 |
|
<target name="compile" |
81 |
< |
depends="init" |
81 |
> |
depends="init, configure-compiler, prepare-src" |
82 |
|
description="Compiles main sources to build folder"> |
83 |
|
|
84 |
+ |
<property name="prepare.src.dir" value="${src.dir}"/> |
85 |
+ |
|
86 |
|
<mkdir dir="${build.classes.dir}"/> |
87 |
|
|
88 |
< |
<javac srcdir="${src.dir}" |
88 |
> |
<!-- |
89 |
> |
<echo>javac ${gjc.args}</echo> |
90 |
> |
<echo>bootclasspath=${compile.bootclasspath}</echo> |
91 |
> |
--> |
92 |
> |
|
93 |
> |
<javac srcdir="${prepare.src.dir}" |
94 |
|
destdir="${build.classes.dir}" |
95 |
|
debug="${build.debug}" |
96 |
|
debuglevel="${build.debuglevel}" |
98 |
|
source="${build.sourcelevel}" |
99 |
|
fork="true"> |
100 |
|
|
101 |
< |
<bootclasspath refid="javac.bootclasspath"/> |
102 |
< |
<compilerarg line="${build.javac.args}"/> |
101 |
> |
<compilerarg line="${gjc.args}"/> |
102 |
> |
<bootclasspath refid="compile.bootclasspath"/> |
103 |
|
|
104 |
|
</javac> |
105 |
|
|
107 |
|
|
108 |
|
|
109 |
|
<target name="jar" |
110 |
< |
depends="check-emulation, init-jar, native-jar, emulation-jar" |
110 |
> |
depends="configure-emulation, init-jar, native-jar, emulation-jar" |
111 |
|
description="Builds library jar from compiled sources"/> |
112 |
|
|
113 |
|
|
114 |
|
<target name="test" |
115 |
< |
depends="init, check-junit, report-tests" |
115 |
> |
depends="init, configure-tests, report-tests" |
116 |
|
description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" /> |
117 |
|
|
118 |
|
|
172 |
|
|
173 |
|
|
174 |
|
<target name="strip" |
175 |
< |
depends="init" |
175 |
> |
depends="init, configure-compiler" |
176 |
|
description="Strip generics from java source (not working yet)"> |
177 |
|
|
178 |
|
<mkdir dir="${build.stripped.dir}"/> |
190 |
|
source="${build.sourcelevel}" |
191 |
|
fork="true"> |
192 |
|
|
193 |
< |
<bootclasspath refid="javac.bootclasspath"/> |
194 |
< |
<compilerarg line="${build.javac.args} -s"/> |
193 |
> |
<compilerarg line="${gjc.args} -s"/> |
194 |
> |
<bootclasspath refid="compile.bootclasspath"/> |
195 |
|
|
196 |
|
</javac> |
197 |
|
|
202 |
|
depends="init, dist-clean, dist-jar, dist-docs" |
203 |
|
description="Puts all distributable products in single hierarchy"/> |
204 |
|
|
205 |
+ |
<target name="release" |
206 |
+ |
depends="dist" |
207 |
+ |
description="Puts entire CVS tree, plus distribution productions, in a jar"> |
208 |
+ |
|
209 |
+ |
<delete dir="${build.dir}"/> |
210 |
+ |
|
211 |
+ |
<property name="release.jar" value="dist/jsr166-${version}-dist.jar"/> |
212 |
+ |
|
213 |
+ |
<jar basedir="${basedir}" destfile="${release.jar}"> |
214 |
+ |
<exclude name="${release.jar}"/> |
215 |
+ |
<exclude name="user.properties"/> |
216 |
+ |
<exclude name="etc/notes/**"/> |
217 |
+ |
</jar> |
218 |
+ |
|
219 |
+ |
</target> |
220 |
|
|
221 |
|
<target name="clean" |
222 |
|
description="Removes all build products"> |
258 |
|
|
259 |
|
<!-- Internal targets --> |
260 |
|
|
278 |
– |
<target name="set-warnings-if" if="build.warnings"> |
279 |
– |
|
280 |
– |
<property name="build.warnings.arg" value="-warnunchecked"/> |
281 |
– |
|
282 |
– |
</target> |
261 |
|
|
262 |
< |
|
285 |
< |
<target name="set-warnings-unless" unless="build.warnings"> |
286 |
< |
|
287 |
< |
<property name="build.warnings.arg" value=""/> |
288 |
< |
|
289 |
< |
</target> |
290 |
< |
|
291 |
< |
|
292 |
< |
<target name="init" |
293 |
< |
depends="set-warnings-if, set-warnings-unless"> |
262 |
> |
<target name="init"> |
263 |
|
|
264 |
|
<!-- Version is kept in a separate file --> |
265 |
|
<loadfile property="version" srcFile="version.properties"/> |
266 |
|
<echo>Building JSR-166 version ${version}</echo> |
267 |
|
|
299 |
– |
<!-- Common options in javac invocations --> |
300 |
– |
<property name="build.javac.args" |
301 |
– |
value="${build.bootclasspath.arg} ${build.warnings.arg} ${build.novariance.arg}"/> |
302 |
– |
|
268 |
|
</target> |
269 |
|
|
270 |
|
|
287 |
|
|
288 |
|
|
289 |
|
<target name="compile-emulation" |
290 |
< |
depends="init" |
290 |
> |
depends="init, configure-compiler" |
291 |
|
if="build.emulation.true"> |
292 |
|
|
293 |
|
<mkdir dir="${build.emulation.dir}"/> |
300 |
|
source="${build.sourcelevel}" |
301 |
|
fork="true"> |
302 |
|
|
303 |
< |
<bootclasspath refid="javac.bootclasspath"/> |
304 |
< |
<compilerarg line="${build.javac.args}"/> |
303 |
> |
<compilerarg line="${gjc.args}"/> |
304 |
> |
<bootclasspath refid="compile.bootclasspath"/> |
305 |
|
|
306 |
|
</javac> |
307 |
|
|
315 |
|
|
316 |
|
<jar destfile="${product.jar}" duplicate="add"> |
317 |
|
<fileset dir="${build.classes.dir}"> |
318 |
< |
<patternset refid="emulation.excludes"/> |
318 |
> |
<patternset refid="atomic.exclusion"/> |
319 |
> |
<patternset refid="unsafe.exclusion"/> |
320 |
|
</fileset> |
321 |
|
<fileset dir="${build.emulation.dir}"/> |
322 |
|
</jar> |
356 |
|
</fileset> |
357 |
|
</copy> |
358 |
|
|
359 |
+ |
<!-- Not needed now, used for doccheck filtering: |
360 |
+ |
<property name="generic.declarations" |
361 |
+ |
value="public interface E {} public interface T {} public interface K {} public interface V {}" |
362 |
+ |
/> |
363 |
+ |
--> |
364 |
+ |
|
365 |
|
<copy todir="${build.filter.src.dir}"> |
366 |
|
<fileset dir="${src.dir}"> |
367 |
|
<exclude name="**/*.html"/> |
368 |
< |
<patternset refid="emulation.excludes"/> |
368 |
> |
<patternset refid="unsafe.exclusion"/> |
369 |
|
</fileset> |
370 |
|
<filterchain> |
371 |
+ |
|
372 |
+ |
<!-- |
373 |
+ |
# This filter gets rid of angle-bracketed type parameters |
374 |
+ |
# so that javadoc can run on the result. The following |
375 |
+ |
# heuristic seems to work: |
376 |
+ |
# |
377 |
+ |
# For all lines not starting with space(s)-asterisk-space(s), |
378 |
+ |
# replace <something> with a space, where there may be more |
379 |
+ |
# than one right angle bracket at the end, and "something" |
380 |
+ |
# must not contain parens or pipes. (This may need some |
381 |
+ |
# tweaking.) |
382 |
+ |
--> |
383 |
+ |
|
384 |
|
<filterreader classname="jsr166.ant.filters.ReplaceFilter" |
385 |
|
classpath="${build.ant.dir}"> |
401 |
– |
<!-- |
402 |
– |
# These arguments are to get rid of angle-bracketed type |
403 |
– |
# parameters so that javadoc can run on the result. The |
404 |
– |
# following heuristic that seems to work: |
405 |
– |
# |
406 |
– |
# For all lines not starting with space(s)-asterisk-space(s), |
407 |
– |
# replace <something> with a space, where there may be more |
408 |
– |
# than one right angle bracket at the end, and "something" |
409 |
– |
# must not contain parens or pipes. (This may need some |
410 |
– |
# tweaking.) |
411 |
– |
--> |
386 |
|
<param name="notmatching" value="^\s+\*\s.*$"/> |
387 |
< |
<param name="pattern" value="<[^|>()]+?>+"/> |
387 |
> |
<param name="pattern" value="<[^|>()]+?>+"/> |
388 |
|
<param name="replacement" value=" "/> |
389 |
|
</filterreader> |
390 |
+ |
|
391 |
+ |
|
392 |
+ |
<!-- |
393 |
+ |
# This filter uncomments lines beginning with "//@" so that |
394 |
+ |
# javadoc can see imports that are needed to resolve links |
395 |
+ |
# but that shouldn't be in the compiled code. |
396 |
+ |
--> |
397 |
+ |
|
398 |
|
<filterreader classname="jsr166.ant.filters.ReplaceFilter" |
399 |
|
classpath="${build.ant.dir}"> |
400 |
< |
<!-- |
401 |
< |
# These arguments are to uncomment lines beginning with |
420 |
< |
# "//@" so that javadoc can see imports that are needed |
421 |
< |
# to resolve links but that shouldn't be in the compiled |
422 |
< |
# code. |
423 |
< |
--> |
424 |
< |
<param name="matching" value="^//@.*$"/> |
425 |
< |
<param name="pattern" value="^//@"/> |
400 |
> |
<param name="matching" value="^//@.*$"/> |
401 |
> |
<param name="pattern" value="^//@"/> |
402 |
|
<param name="replacement" value=""/> |
403 |
|
</filterreader> |
404 |
+ |
|
405 |
+ |
|
406 |
+ |
<!-- |
407 |
+ |
# The next two filters try to make the source look like |
408 |
+ |
# something that doccheck can process. The first removes |
409 |
+ |
# -source 1.4 assertions and the second adds in a bunch |
410 |
+ |
# of single letter public nested marker interfaces so that |
411 |
+ |
# the generic type parameters are recognized. |
412 |
+ |
# |
413 |
+ |
# Currently commented out because doccheck doesn't work. :-( |
414 |
+ |
--> |
415 |
+ |
|
416 |
+ |
<!-- |
417 |
+ |
<filterreader classname="jsr166.ant.filters.ReplaceFilter" |
418 |
+ |
classpath="${build.ant.dir}"> |
419 |
+ |
<param name="matching" value="^\s*assert[\s ].*$"/> |
420 |
+ |
<param name="pattern" value="assert"/> |
421 |
+ |
<param name="replacement" value="//assert"/> |
422 |
+ |
</filterreader> |
423 |
+ |
|
424 |
+ |
<filterreader classname="jsr166.ant.filters.ReplaceFilter" |
425 |
+ |
classpath="${build.ant.dir}"> |
426 |
+ |
<param name="matching" value="^(.*(class|interface|implements) .*|)\{.*$"/> |
427 |
+ |
<param name="pattern" value="$"/> |
428 |
+ |
<param name="replacement" value=" ${generic.declarations}"/> |
429 |
+ |
</filterreader> |
430 |
+ |
--> |
431 |
+ |
|
432 |
|
</filterchain> |
433 |
|
</copy> |
434 |
|
|
440 |
|
|
441 |
|
<mkdir dir="${build.testcases.dir}"/> |
442 |
|
|
443 |
+ |
<!-- |
444 |
+ |
<echo>javac ${gjc.args}</echo> |
445 |
+ |
<echo>bootclasspath=${test.compile.bootclasspath}</echo> |
446 |
+ |
<echo>classpath="${test.classpath}"</echo> |
447 |
+ |
--> |
448 |
+ |
|
449 |
|
<javac srcdir="${test.src.dir}" |
450 |
|
destdir="${build.testcases.dir}" |
451 |
|
debug="${build.debug}" |
454 |
|
source="${build.sourcelevel}" |
455 |
|
fork="true"> |
456 |
|
|
457 |
< |
<classpath refid="test.classpath"/> |
458 |
< |
<bootclasspath refid="javac.bootclasspath"/> |
459 |
< |
<compilerarg line="${build.javac.args}"/> |
457 |
> |
<compilerarg line="${gjc.args}"/> |
458 |
> |
<bootclasspath refid="test.compile.bootclasspath"/> |
459 |
> |
<classpath refid="test.classpath"/> |
460 |
|
|
461 |
|
</javac> |
462 |
|
|
478 |
|
dir="${build.reports.dir}" |
479 |
|
fork="true"> |
480 |
|
|
481 |
< |
<jvmarg value="${test.bootclasspath.arg}"/> |
481 |
> |
<jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/> |
482 |
|
|
483 |
|
<formatter type="xml"/> |
484 |
|
|
519 |
|
</target> |
520 |
|
|
521 |
|
|
522 |
< |
<target name="check-junit"> |
522 |
> |
<target name="configure-compiler"> |
523 |
|
|
524 |
< |
<!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 --> |
525 |
< |
<available property="junit.available" |
516 |
< |
classname="junit.framework.Protectable"/> |
524 |
> |
<property name="gjc.version" |
525 |
> |
value="2.0"/> |
526 |
|
|
527 |
< |
<fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests" |
528 |
< |
unless="junit.available"/> |
527 |
> |
<condition property="novariance.arg" value="-novariance"> |
528 |
> |
<and> |
529 |
> |
<equals arg1="${gjc.version}" arg2="2.0"/> |
530 |
> |
<or> |
531 |
> |
<not><isset property="gjc.novariance"/></not> |
532 |
> |
<istrue value="${gjc.novariance}"/> |
533 |
> |
</or> |
534 |
> |
</and> |
535 |
> |
</condition> |
536 |
> |
|
537 |
> |
<property name="novariance.arg" |
538 |
> |
value=""/> |
539 |
> |
|
540 |
> |
<property name="gjc.dir" |
541 |
> |
value="${lib.dir}/gjc"/> |
542 |
> |
|
543 |
> |
<property name="javac.jar" |
544 |
> |
location="${gjc.dir}/${gjc.version}/javac.jar"/> |
545 |
> |
|
546 |
> |
<property name="collect.jar" |
547 |
> |
location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/> |
548 |
> |
|
549 |
> |
|
550 |
> |
<condition property="warnunchecked.arg" value="-warnunchecked"> |
551 |
> |
<istrue value="${gjc.warnunchecked}"/> |
552 |
> |
</condition> |
553 |
> |
|
554 |
> |
<property name="warnunchecked.arg" value=""/> |
555 |
> |
|
556 |
> |
<condition property="prepare.src.dir" value="${build.dir}/prepare-src"> |
557 |
> |
<istrue value="${build.nothreads}"/> |
558 |
> |
</condition> |
559 |
> |
|
560 |
> |
|
561 |
> |
<!-- |
562 |
> |
! Bootclasspath munging for source compilation. |
563 |
> |
--> |
564 |
> |
|
565 |
> |
<path id="pre.bootclasspath"> |
566 |
> |
<pathelement location="${javac.jar}"/> |
567 |
> |
</path> |
568 |
> |
|
569 |
> |
<path id="compile.bootclasspath"> |
570 |
> |
<pathelement location="${build.classes.dir}"/> |
571 |
> |
<pathelement location="${collect.jar}"/> |
572 |
> |
<pathelement location="${rt.jar}"/> |
573 |
> |
</path> |
574 |
> |
|
575 |
> |
<!-- Flatten paths into platform-appropriate strings --> |
576 |
> |
<property name="pre.bootclasspath" refid="pre.bootclasspath"/> |
577 |
> |
<property name="compile.bootclasspath" refid="compile.bootclasspath"/> |
578 |
> |
|
579 |
> |
|
580 |
> |
<!-- Common options in javac invocations --> |
581 |
> |
<property name="gjc.args" |
582 |
> |
value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}" |
583 |
> |
/> |
584 |
|
|
585 |
|
</target> |
586 |
|
|
587 |
|
|
588 |
< |
<target name="check-emulation"> |
588 |
> |
<target name="prepare-src" |
589 |
> |
depends="configure-compiler" |
590 |
> |
if="prepare.src.dir"> |
591 |
> |
|
592 |
> |
<mkdir dir="${prepare.src.dir}"/> |
593 |
> |
<copy todir="${prepare.src.dir}"> |
594 |
> |
<fileset dir="${src.dir}"> |
595 |
> |
<exclude name="java/lang/**"/> |
596 |
> |
</fileset> |
597 |
> |
</copy> |
598 |
> |
|
599 |
> |
</target> |
600 |
> |
|
601 |
> |
|
602 |
> |
<target name="configure-emulation"> |
603 |
> |
|
604 |
|
<condition property="build.emulation.true"> |
605 |
|
<or> |
606 |
< |
<isset property="build.emulation"/> |
607 |
< |
<os family="windows"/> |
606 |
> |
<and> |
607 |
> |
<os family="windows"/> |
608 |
> |
<not> |
609 |
> |
<isset property="build.emulation"/> |
610 |
> |
</not> |
611 |
> |
</and> |
612 |
> |
<istrue value="${build.emulation}"/> |
613 |
|
</or> |
614 |
|
</condition> |
615 |
+ |
|
616 |
+ |
</target> |
617 |
+ |
|
618 |
+ |
|
619 |
+ |
<target name="configure-tests" |
620 |
+ |
depends="configure-compiler"> |
621 |
+ |
|
622 |
+ |
<!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 --> |
623 |
+ |
<available property="junit.available" |
624 |
+ |
classname="junit.framework.Protectable"/> |
625 |
+ |
|
626 |
+ |
<fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests" |
627 |
+ |
unless="junit.available"/> |
628 |
+ |
|
629 |
+ |
|
630 |
+ |
<!-- |
631 |
+ |
! Bootclasspath munging for testing, so JUnit can test our local |
632 |
+ |
! modifications to java.*. |
633 |
+ |
--> |
634 |
+ |
|
635 |
+ |
<path id="test.classpath"> |
636 |
+ |
<pathelement location="${product.jar}"/> |
637 |
+ |
<pathelement location="${build.testcases.dir}"/> |
638 |
+ |
<pathelement location="${junit.jar}"/> |
639 |
+ |
</path> |
640 |
+ |
|
641 |
+ |
<path id="test.compile.bootclasspath"> |
642 |
+ |
<pathelement location="${javac.jar}"/> |
643 |
+ |
<pathelement location="${collect.jar}"/> |
644 |
+ |
<pathelement location="${rt.jar}"/> |
645 |
+ |
</path> |
646 |
+ |
|
647 |
+ |
<path id="test.run.bootclasspath"> |
648 |
+ |
<pathelement location="${javac.jar}"/> |
649 |
+ |
<path refid="test.classpath"/> |
650 |
+ |
</path> |
651 |
+ |
|
652 |
+ |
<!-- Flatten test classpaths into platform-appropriate strings --> |
653 |
+ |
<property name="test.classpath" refid="test.classpath"/> |
654 |
+ |
<property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/> |
655 |
+ |
<property name="test.run.bootclasspath" refid="test.run.bootclasspath"/> |
656 |
+ |
|
657 |
|
</target> |
658 |
|
|
659 |
|
|