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.28 by tim, Wed May 28 13:37:59 2003 UTC vs.
Revision 1.32 by tim, Thu May 29 04:35:42 2003 UTC

# Line 1 | Line 1
1   <project name="jsr166" default="usage">
2  
3    <description>
4 <    Build file for JSR-166
4 > ------------------------------------------------------------------------------
5 >  Build file for JSR-166
6  
7 <    JUnit 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"/>
# Line 68 | Line 54 | ant [target], where target is one of:
54  
55    <!-- Jar locations -->
56    <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>
71  <property name="javac.jar"            location="${lib.dir}/javac.jar"/>
72  <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  
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
62    <!-- Files excluded from emulation and dist-docs -->
63    <patternset id="emulation.excludes">
64      <exclude name="java/util/Random.*"/>
# Line 128 | Line 70 | ant [target], where target is one of:
70    <!-- Main targets -->
71  
72    <target name="compile"
73 <          depends="init"
73 >          depends="init, configure-compiler"
74            description="Compiles main sources to build folder">
75  
76      <mkdir dir="${build.classes.dir}"/>
# Line 142 | Line 84 | ant [target], where target is one of:
84               fork="true">
85  
86        <bootclasspath refid="javac.bootclasspath"/>
87 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
87 >      <compilerarg line="${build.javac.args}"/>
88  
89      </javac>
90  
# Line 150 | Line 92 | ant [target], where target is one of:
92  
93  
94    <target name="jar"
95 <          depends="native-jar, emulation-jar"
95 >          depends="configure-emulation, init-jar, native-jar, emulation-jar"
96            description="Builds library jar from compiled sources"/>
97  
98  
99    <target name="test"
100 <          depends="init, check-junit, report-tests"
101 <          description="Runs all tests (requires JUnit 3.8+ in ${ant.home}/lib)" />
100 >          depends="init, configure-tests, report-tests"
101 >          description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
102  
103  
104    <target name="checkstyle"
# Line 203 | Line 145 | ant [target], where target is one of:
145                source="${build.docsourcelevel}">
146  
147        <tag name="revised" description="Last revised:"/>
148 <      <tag name="spec" description="Specified by:"/>
149 <      <tag name="editor" description="Last edited by:"/>
150 <      <tag name="fixme" description="FIX ME:"/>
148 >      <tag name="spec"    description="Specified by:"/>
149 >      <tag name="editor"  description="Last edited by:"/>
150 >      <tag name="fixme"   description="FIX ME:"/>
151 >
152        <packageset dir="${build.filter.src.dir}"/>
153  
154      </javadoc>
# Line 213 | Line 156 | ant [target], where target is one of:
156    </target>
157  
158  
216  <!--
217   # javac -s doesn't reliably generate compilable code. It generates
218   # bridge methods (marked as "synthetic") that can have identical
219   # signatures to existing methods except for the return value.
220   -->
159    <target name="strip"
160 <          depends="init">
160 >          depends="init, configure-compiler"
161 >          description="Strip generics from java source (not working yet)">
162  
163      <mkdir dir="${build.stripped.dir}"/>
164  
165 +    <!--
166 +     # javac -s doesn't reliably generate compilable code. It generates
167 +     # bridge methods (marked as "synthetic") that can have identical
168 +     # signatures to existing methods except for the return value.
169 +     -->
170      <javac srcdir="${src.dir}"
171            destdir="${build.stripped.dir}"
172              debug="${build.debug}"
# Line 232 | Line 176 | ant [target], where target is one of:
176               fork="true">
177  
178        <bootclasspath refid="javac.bootclasspath"/>
179 <      <compilerarg line="${javac.args} ${build.warnings.option} -s"/>
179 >      <compilerarg line="${build.javac.args} -s"/>
180  
181      </javac>
182  
# Line 284 | Line 228 | ant [target], where target is one of:
228  
229    <!-- Internal targets -->
230  
287  <target name="set-warnings-if" if="build.warnings">
231  
232 <    <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"
302 <          depends="set-warnings-if, set-warnings-unless">
232 >  <target name="init">
233  
234      <!-- Version is kept in a separate file -->
235      <loadfile property="version" srcFile="version.properties"/>
# Line 316 | Line 246 | ant [target], where target is one of:
246  
247  
248    <target name="native-jar"
249 <          depends="compile, init-jar"
250 <          unless="build.emulation">
249 >          depends="compile"
250 >          unless="build.emulation.true">
251  
252      <jar destfile="${product.jar}">
253        <fileset dir="${build.classes.dir}"/>
# Line 326 | Line 256 | ant [target], where target is one of:
256    </target>
257  
258  
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
259    <target name="compile-emulation"
260 <          depends="init"
261 <          if="build.emulation">
260 >          depends="init, configure-compiler"
261 >          if="build.emulation.true">
262  
263      <mkdir dir="${build.emulation.dir}"/>
264  
# Line 353 | Line 271 | ant [target], where target is one of:
271               fork="true">
272  
273        <bootclasspath refid="javac.bootclasspath"/>
274 <      <compilerarg line="${javac.args} ${build.warnings.option}"/>
274 >      <compilerarg line="${build.javac.args}"/>
275  
276      </javac>
277  
# Line 361 | Line 279 | ant [target], where target is one of:
279  
280  
281    <target name="emulation-jar"
282 <          depends="base-jar, compile-emulation"
283 <          if="build.emulation">
282 >          depends="compile-emulation"
283 >          if="build.emulation.true">
284 >
285  
286 <    <jar destfile="${product.jar}" update="true" duplicate="add">
286 >    <jar destfile="${product.jar}" duplicate="add">
287 >      <fileset dir="${build.classes.dir}">
288 >        <patternset refid="emulation.excludes"/>
289 >      </fileset>
290        <fileset dir="${build.emulation.dir}"/>
291      </jar>
292  
# Line 399 | Line 321 | ant [target], where target is one of:
321  
322      <copy todir="${build.filter.src.dir}">
323        <fileset dir="${src.dir}">
324 +        <include name="**/*.html"/>
325 +      </fileset>
326 +    </copy>
327 +
328 +    <copy todir="${build.filter.src.dir}">
329 +      <fileset dir="${src.dir}">
330 +        <exclude name="**/*.html"/>
331          <patternset refid="emulation.excludes"/>
332        </fileset>
333        <filterchain>
# Line 450 | Line 379 | ant [target], where target is one of:
379             source="${build.sourcelevel}"
380               fork="true">
381  
453      <bootclasspath refid="javac.bootclasspath"/>
454      <compilerarg line="${javac.args} ${build.warnings.option}"/>
382        <classpath refid="test.classpath"/>
383 +      <bootclasspath refid="javac.bootclasspath"/>
384 +      <compilerarg line="${build.javac.args}"/>
385  
386      </javac>
387  
# Line 474 | Line 403 | ant [target], where target is one of:
403                      dir="${build.reports.dir}"
404                     fork="true">
405  
406 <      <jvmarg value="${test.javac.args}"/>
406 >      <jvmarg value="${test.bootclasspath.arg}"/>
407  
408        <formatter type="xml"/>
409  
# Line 515 | Line 444 | ant [target], where target is one of:
444    </target>
445  
446  
447 <  <target name="check-junit">
447 >  <target name="configure-compiler">
448 >
449 >    <property name="gjc.version"
450 >             value="1.3"/>
451 >
452 >    <condition property="build.novariance" value="-novariance">
453 >      <and>
454 >        <equals arg1="${gjc.version}" arg2="2.0"/>
455 >        <or>
456 >          <not><isset property="gjc.novariance"/></not>
457 >          <istrue value="${gjc.novariance}"/>
458 >        </or>
459 >      </and>
460 >    </condition>
461 >
462 >    <property name="build.novariance"
463 >             value=""/>
464 >
465 >    <property name="gjc.dir"
466 >             value="${lib.dir}/gjc"/>
467 >
468 >    <property name="javac.jar"
469 >          location="${gjc.dir}/${gjc.version}/javac.jar"/>
470 >
471 >    <property name="collect.jar"
472 >          location="${gjc.dir}/${gjc.version}/collect${build.novariance}.jar"/>
473 >
474 >
475 >    <condition property="build.warnunchecked" value="-warnunchecked">
476 >      <istrue value="${gjc.warnunchecked}"/>
477 >    </condition>
478 >
479 >    <property name="build.warnunchecked" value=""/>
480 >
481 >
482 >    <!--
483 >     ! Bootclasspath munging for source compilation.
484 >     -->
485 >
486 >    <path id="javac.bootclasspath.prefix">
487 >      <!-- <pathelement location="${src.dir}"/> -->
488 >      <pathelement location="${javac.jar}"/>
489 >    </path>
490 >
491 >    <path id="javac.bootclasspath">
492 >      <!-- <pathelement location="${src.dir}"/> -->
493 >      <pathelement location="${collect.jar}"/>
494 >      <pathelement location="${rt.jar}"/>
495 >    </path>
496 >
497 >    <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
498 >    <property name="javac.bootclasspath.prefix"
499 >             refid="javac.bootclasspath.prefix"/>
500 >
501 >    <!-- Turn the flattened bootclasspath prefix into a javac argument -->
502 >    <property name="build.bootclasspath.arg"
503 >             value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>
504 >
505 >    <!-- Flatten bootclasspath for trace message -->
506 >    <property name="javac.bootclasspath"
507 >             refid="javac.bootclasspath"/>
508 >
509 >    <!-- Common options in javac invocations -->
510 >    <property name="build.javac.args"
511 >             value="${build.bootclasspath.arg} ${build.warnunchecked} ${build.novariance}"/>
512 >
513 >    <echo>javac ${build.javac.args}
514 > bootclasspath is ${javac.bootclasspath}</echo>
515 >
516 >  </target>
517 >
518 >
519 >  <target name="configure-emulation">
520 >
521 >    <condition property="build.emulation.true">
522 >      <or>
523 >        <and>
524 >          <os family="windows"/>
525 >          <not>
526 >            <isset property="build.emulation"/>
527 >          </not>
528 >        </and>
529 >        <istrue value="${build.emulation}"/>
530 >      </or>
531 >    </condition>
532 >
533 >  </target>
534 >
535 >
536 >  <target name="configure-tests">
537  
538      <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
539      <available property="junit.available"
# Line 524 | Line 542 | ant [target], where target is one of:
542      <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
543            unless="junit.available"/>
544  
545 +
546 +    <!--
547 +     ! Bootclasspath munging for testing, so JUnit can test our local
548 +     ! modifications to java.*.
549 +     -->
550 +
551 +    <path id="test.classpath">
552 +      <pathelement location="${product.jar}"/>
553 +      <pathelement location="${build.testcases.dir}"/>
554 +      <pathelement location="${junit.jar}"/>
555 +    </path>
556 +
557 +    <!-- Flatten test classpath into a platform-appropriate string -->
558 +    <property name="test.classpath" refid="test.classpath"/>
559 +
560 +    <!-- Turn the flattened test classpath into a javac argument -->
561 +    <property name="test.bootclasspath.arg"
562 +             value='-Xbootclasspath/p:${test.classpath}'/>
563 +
564    </target>
565  
566  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines