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.31 by tim, Wed May 28 21:15:50 2003 UTC vs.
Revision 1.44 by tim, Thu Jun 26 11:55:50 2003 UTC

# Line 7 | Line 7
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  
# Line 26 | Line 26
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"/>
# Line 55 | Line 54
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}"
# Line 130 | Line 98
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  
# Line 139 | Line 107
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  
# Line 204 | Line 172
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}"/>
# Line 222 | Line 190
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  
# Line 234 | Line 202
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 +      <exclude name="lib/gjc/2.1/**"/>
218 +      <exclude name="**/SyntaxTest.java"/>
219 +    </jar>
220 +
221 +  </target>
222  
223    <target name="clean"
224            description="Removes all build products">
# Line 275 | Line 260
260  
261    <!-- Internal targets -->
262  
278  <target name="set-warnings-if" if="build.warnings">
279
280    <property name="build.warnings.arg" value="-warnunchecked"/>
281
282  </target>
283
263  
264 <  <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">
264 >  <target name="init">
265  
266      <!-- Version is kept in a separate file -->
267      <loadfile property="version" srcFile="version.properties"/>
268      <echo>Building JSR-166 version ${version}</echo>
269  
299    <!-- Common options in javac invocations -->
300    <property name="build.javac.args"
301             value="${build.bootclasspath.arg} ${build.warnings.arg} ${build.novariance.arg}"/>
302
270    </target>
271  
272  
# Line 322 | Line 289
289  
290  
291    <target name="compile-emulation"
292 <          depends="init"
292 >          depends="init, configure-compiler"
293            if="build.emulation.true">
294  
295      <mkdir dir="${build.emulation.dir}"/>
# Line 335 | Line 302
302             source="${build.sourcelevel}"
303               fork="true">
304  
305 <      <bootclasspath refid="javac.bootclasspath"/>
306 <      <compilerarg line="${build.javac.args}"/>
305 >      <compilerarg    line="${gjc.args}"/>
306 >      <bootclasspath refid="compile.bootclasspath"/>
307  
308      </javac>
309  
# Line 350 | Line 317
317  
318      <jar destfile="${product.jar}" duplicate="add">
319        <fileset dir="${build.classes.dir}">
320 <        <patternset refid="emulation.excludes"/>
320 >        <patternset refid="atomic.exclusion"/>
321 >        <patternset refid="unsafe.exclusion"/>
322        </fileset>
323        <fileset dir="${build.emulation.dir}"/>
324      </jar>
# Line 390 | Line 358
358        </fileset>
359      </copy>
360  
361 +    <!-- Not needed now, used for doccheck filtering:
362 +    <property name="generic.declarations"
363 +             value="public interface E {} public interface T {} public interface K {} public interface V {}"
364 +    />
365 +    -->
366 +
367      <copy todir="${build.filter.src.dir}">
368        <fileset dir="${src.dir}">
369          <exclude name="**/*.html"/>
370 <        <patternset refid="emulation.excludes"/>
370 >        <patternset refid="unsafe.exclusion"/>
371        </fileset>
372        <filterchain>
373 +
374 +        <!--
375 +         # This filter gets rid of angle-bracketed type parameters
376 +         # so that javadoc can run on the result. The following
377 +         # heuristic seems to work:
378 +         #
379 +         # For all lines not starting with space(s)-asterisk-space(s),
380 +         #   replace <something> with a space, where there may be more
381 +         #   than one right angle bracket at the end, and "something"
382 +         #   must not contain parens or pipes. (This may need some
383 +         #   tweaking.)
384 +         -->
385 +
386          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
387                        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           -->
388            <param name="notmatching" value="^\s+\*\s.*$"/>
389 <          <param name="pattern" value="&lt;[^|>()]+?>+"/>
389 >          <param name="pattern"     value="&lt;[^|>()]+?>+"/>
390            <param name="replacement" value=" "/>
391          </filterreader>
392 +
393 +
394 +        <!--
395 +         # This filter uncomments lines beginning with "//@" so that
396 +         # javadoc can see imports that are needed to resolve links
397 +         # but that shouldn't be in the compiled code.
398 +         -->
399 +
400          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
401                        classpath="${build.ant.dir}">
402 <          <!--
403 <           # 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="^//@"/>
402 >          <param name="matching"    value="^//@.*$"/>
403 >          <param name="pattern"     value="^//@"/>
404            <param name="replacement" value=""/>
405          </filterreader>
406 +
407 +
408 +        <!--
409 +         # The next two filters try to make the source look like
410 +         # something that doccheck can process. The first removes
411 +         # -source 1.4 assertions and the second adds in a bunch
412 +         # of single letter public nested marker interfaces so that
413 +         # the generic type parameters are recognized.
414 +         #
415 +         # Currently commented out because doccheck doesn't work. :-(
416 +         -->
417 +
418 +        <!--
419 +        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
420 +                      classpath="${build.ant.dir}">
421 +          <param name="matching"    value="^\s*assert[\s ].*$"/>
422 +          <param name="pattern"     value="assert"/>
423 +          <param name="replacement" value="//assert"/>
424 +        </filterreader>
425 +
426 +        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
427 +                      classpath="${build.ant.dir}">
428 +          <param name="matching"    value="^(.*(class|interface|implements) .*|)\{.*$"/>
429 +          <param name="pattern"     value="$"/>
430 +          <param name="replacement" value=" ${generic.declarations}"/>
431 +        </filterreader>
432 +        -->
433 +
434        </filterchain>
435      </copy>
436  
# Line 436 | Line 442
442  
443      <mkdir dir="${build.testcases.dir}"/>
444  
445 + <!--
446 +    <echo>javac ${gjc.args}</echo>
447 +    <echo>bootclasspath=${test.compile.bootclasspath}</echo>
448 +    <echo>classpath="${test.classpath}"</echo>
449 + -->
450 +
451      <javac srcdir="${test.src.dir}"
452            destdir="${build.testcases.dir}"
453              debug="${build.debug}"
# Line 444 | Line 456
456             source="${build.sourcelevel}"
457               fork="true">
458  
459 <      <classpath refid="test.classpath"/>
460 <      <bootclasspath refid="javac.bootclasspath"/>
461 <      <compilerarg line="${build.javac.args}"/>
459 >      <compilerarg    line="${gjc.args}"/>
460 >      <bootclasspath refid="test.compile.bootclasspath"/>
461 >      <classpath     refid="test.classpath"/>
462  
463      </javac>
464  
# Line 468 | Line 480
480                      dir="${build.reports.dir}"
481                     fork="true">
482  
483 <      <jvmarg value="${test.bootclasspath.arg}"/>
483 >      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
484  
485        <formatter type="xml"/>
486  
# Line 509 | Line 521
521    </target>
522  
523  
524 <  <target name="check-junit">
524 >  <target name="configure-compiler">
525  
526 <    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
527 <    <available property="junit.available"
528 <               classname="junit.framework.Protectable"/>
526 >    <property name="gjc.version"
527 >             value="2.0"/>
528 >
529 >    <condition property="novariance.arg" value="-novariance">
530 >      <and>
531 >        <equals arg1="${gjc.version}" arg2="2.0"/>
532 >        <or>
533 >          <not><isset property="gjc.novariance"/></not>
534 >          <istrue value="${gjc.novariance}"/>
535 >        </or>
536 >      </and>
537 >    </condition>
538 >
539 >    <property name="novariance.arg"
540 >             value=""/>
541 >
542 >    <property name="gjc.dir"
543 >             value="${lib.dir}/gjc"/>
544 >
545 >    <property name="javac.jar"
546 >          location="${gjc.dir}/${gjc.version}/javac.jar"/>
547 >
548 >    <property name="collect.jar"
549 >          location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/>
550 >
551 >
552 >    <condition property="warnunchecked.arg" value="-warnunchecked">
553 >      <istrue value="${gjc.warnunchecked}"/>
554 >    </condition>
555 >
556 >    <property name="warnunchecked.arg" value=""/>
557 >
558 >    <condition property="prepare.src.dir" value="${build.dir}/prepare-src">
559 >      <istrue value="${build.nothreads}"/>
560 >    </condition>
561 >
562 >
563 >    <!--
564 >     ! Bootclasspath munging for source compilation.
565 >     -->
566 >
567 >    <path id="pre.bootclasspath">
568 >      <pathelement location="${javac.jar}"/>
569 >    </path>
570 >
571 >    <path id="compile.bootclasspath">
572 >      <pathelement location="${build.classes.dir}"/>
573 >      <pathelement location="${collect.jar}"/>
574 >      <pathelement location="${rt.jar}"/>
575 >    </path>
576 >
577 >    <!-- Flatten paths into platform-appropriate strings -->
578 >    <property name="pre.bootclasspath"     refid="pre.bootclasspath"/>
579 >    <property name="compile.bootclasspath" refid="compile.bootclasspath"/>
580  
581 <    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
582 <          unless="junit.available"/>
581 >
582 >    <!-- Common options in javac invocations -->
583 >    <property name="gjc.args"
584 >             value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}"
585 >    />
586  
587    </target>
588  
589  
590 <  <target name="check-emulation">
590 >  <target name="prepare-src"
591 >          depends="configure-compiler"
592 >          if="prepare.src.dir">
593 >
594 >    <mkdir dir="${prepare.src.dir}"/>
595 >    <copy todir="${prepare.src.dir}">
596 >      <fileset dir="${src.dir}">
597 >        <exclude name="java/lang/**"/>
598 >      </fileset>
599 >    </copy>
600 >
601 >  </target>
602 >
603 >
604 >  <target name="configure-emulation">
605 >
606      <condition property="build.emulation.true">
607        <or>
608 <        <isset property="build.emulation"/>
609 <        <os family="windows"/>
608 >        <and>
609 >          <os family="windows"/>
610 >          <not>
611 >            <isset property="build.emulation"/>
612 >          </not>
613 >        </and>
614 >        <istrue value="${build.emulation}"/>
615        </or>
616      </condition>
617 +
618 +  </target>
619 +
620 +
621 +  <target name="configure-tests"
622 +       depends="configure-compiler">
623 +
624 +    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
625 +    <available property="junit.available"
626 +               classname="junit.framework.Protectable"/>
627 +
628 +    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
629 +          unless="junit.available"/>
630 +
631 +
632 +    <!--
633 +     ! Bootclasspath munging for testing, so JUnit can test our local
634 +     ! modifications to java.*.
635 +     -->
636 +
637 +    <path id="test.classpath">
638 +      <pathelement location="${product.jar}"/>
639 +      <pathelement location="${build.testcases.dir}"/>
640 +      <pathelement location="${junit.jar}"/>
641 +    </path>
642 +
643 +    <path id="test.compile.bootclasspath">
644 +      <pathelement location="${javac.jar}"/>
645 +      <pathelement location="${collect.jar}"/>
646 +      <pathelement location="${rt.jar}"/>
647 +    </path>
648 +
649 +    <path id="test.run.bootclasspath">
650 +      <pathelement location="${javac.jar}"/>
651 +      <path refid="test.classpath"/>
652 +    </path>
653 +
654 +    <!-- Flatten test classpaths into platform-appropriate strings -->
655 +    <property name="test.classpath"             refid="test.classpath"/>
656 +    <property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/>
657 +    <property name="test.run.bootclasspath"     refid="test.run.bootclasspath"/>
658 +
659    </target>
660  
661  
# Line 557 | Line 685
685    </target>
686  
687  
688 +  <target name="ng" depends="test">
689 +    <java classname="SuperfluousAbstract" fork="true">
690 +
691 +      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
692 +
693 +    </java>
694 +  </target>
695 +
696 +
697   </project>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines