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.36 by tim, Thu May 29 17:29:08 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  
65  <!--
66   ! 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
62    <!-- Files excluded from emulation and dist-docs -->
63    <patternset id="emulation.excludes">
64      <exclude name="java/util/Random.*"/>
# Line 117 | Line 70
70    <!-- Main targets -->
71  
72    <target name="compile"
73 <          depends="init"
73 >          depends="init, configure-compiler, prepare-src"
74            description="Compiles main sources to build folder">
75  
76 +    <property name="prepare.src.dir" value="${src.dir}"/>
77 +
78      <mkdir dir="${build.classes.dir}"/>
79  
80 <    <javac srcdir="${src.dir}"
80 >    <javac srcdir="${prepare.src.dir}"
81            destdir="${build.classes.dir}"
82              debug="${build.debug}"
83         debuglevel="${build.debuglevel}"
# Line 139 | Line 94
94  
95  
96    <target name="jar"
97 <          depends="check-emulation, init-jar, native-jar, emulation-jar"
97 >          depends="configure-emulation, init-jar, native-jar, emulation-jar"
98            description="Builds library jar from compiled sources"/>
99  
100  
101    <target name="test"
102 <          depends="init, check-junit, report-tests"
102 >          depends="init, configure-tests, report-tests"
103            description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
104  
105  
# Line 204 | Line 159
159  
160  
161    <target name="strip"
162 <          depends="init"
162 >          depends="init, configure-compiler"
163            description="Strip generics from java source (not working yet)">
164  
165      <mkdir dir="${build.stripped.dir}"/>
# Line 275 | Line 230
230  
231    <!-- Internal targets -->
232  
278  <target name="set-warnings-if" if="build.warnings">
279
280    <property name="build.warnings.arg" value="-warnunchecked"/>
281
282  </target>
283
284
285  <target name="set-warnings-unless" unless="build.warnings">
286
287    <property name="build.warnings.arg" value=""/>
233  
234 <  </target>
290 <
291 <
292 <  <target name="init"
293 <          depends="set-warnings-if, set-warnings-unless">
234 >  <target name="init">
235  
236      <!-- Version is kept in a separate file -->
237      <loadfile property="version" srcFile="version.properties"/>
238      <echo>Building JSR-166 version ${version}</echo>
239  
299    <!-- Common options in javac invocations -->
300    <property name="build.javac.args"
301             value="${build.bootclasspath.arg} ${build.warnings.arg} ${build.novariance.arg}"/>
302
240    </target>
241  
242  
# Line 322 | Line 259
259  
260  
261    <target name="compile-emulation"
262 <          depends="init"
262 >          depends="init, configure-compiler"
263            if="build.emulation.true">
264  
265      <mkdir dir="${build.emulation.dir}"/>
# Line 390 | Line 327
327        </fileset>
328      </copy>
329  
330 +    <!-- Not needed now, used for doccheck filtering:
331 +    <property name="generic.declarations"
332 +             value="public interface E {} public interface T {} public interface K {} public interface V {}"
333 +    />
334 +    -->
335 +
336      <copy todir="${build.filter.src.dir}">
337        <fileset dir="${src.dir}">
338          <exclude name="**/*.html"/>
339          <patternset refid="emulation.excludes"/>
340        </fileset>
341        <filterchain>
342 +
343 +        <!--
344 +         # This filter gets rid of angle-bracketed type parameters
345 +         # so that javadoc can run on the result. The following
346 +         # heuristic seems to work:
347 +         #
348 +         # For all lines not starting with space(s)-asterisk-space(s),
349 +         #   replace <something> with a space, where there may be more
350 +         #   than one right angle bracket at the end, and "something"
351 +         #   must not contain parens or pipes. (This may need some
352 +         #   tweaking.)
353 +         -->
354 +
355          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
356                        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           -->
357            <param name="notmatching" value="^\s+\*\s.*$"/>
358 <          <param name="pattern" value="&lt;[^|>()]+?>+"/>
358 >          <param name="pattern"     value="&lt;[^|>()]+?>+"/>
359            <param name="replacement" value=" "/>
360          </filterreader>
361 +
362 +
363 +        <!--
364 +         # This filter uncomments lines beginning with "//@" so that
365 +         # javadoc can see imports that are needed to resolve links
366 +         # but that shouldn't be in the compiled code.
367 +         -->
368 +
369          <filterreader classname="jsr166.ant.filters.ReplaceFilter"
370                        classpath="${build.ant.dir}">
371 <          <!--
372 <           # 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="^//@"/>
371 >          <param name="matching"    value="^//@.*$"/>
372 >          <param name="pattern"     value="^//@"/>
373            <param name="replacement" value=""/>
374          </filterreader>
375 +
376 +
377 +        <!--
378 +         # The next two filters try to make the source look like
379 +         # something that doccheck can process. The first removes
380 +         # -source 1.4 assertions and the second adds in a bunch
381 +         # of single letter public nested marker interfaces so that
382 +         # the generic type parameters are recognized.
383 +         #
384 +         # Currently commented out because doccheck doesn't work. :-(
385 +         -->
386 +
387 +        <!--
388 +        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
389 +                      classpath="${build.ant.dir}">
390 +          <param name="matching"    value="^\s*assert[\s ].*$"/>
391 +          <param name="pattern"     value="assert"/>
392 +          <param name="replacement" value="//assert"/>
393 +        </filterreader>
394 +
395 +        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
396 +                      classpath="${build.ant.dir}">
397 +          <param name="matching"    value="^(.*(class|interface|implements) .*|)\{.*$"/>
398 +          <param name="pattern"     value="$"/>
399 +          <param name="replacement" value=" ${generic.declarations}"/>
400 +        </filterreader>
401 +        -->
402 +
403        </filterchain>
404      </copy>
405  
# Line 509 | Line 484
484    </target>
485  
486  
487 <  <target name="check-junit">
487 >  <target name="configure-compiler">
488  
489 <    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
490 <    <available property="junit.available"
516 <               classname="junit.framework.Protectable"/>
489 >    <property name="gjc.version"
490 >             value="2.0"/>
491  
492 <    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
493 <          unless="junit.available"/>
492 >    <condition property="build.novariance" value="-novariance">
493 >      <and>
494 >        <equals arg1="${gjc.version}" arg2="2.0"/>
495 >        <or>
496 >          <not><isset property="gjc.novariance"/></not>
497 >          <istrue value="${gjc.novariance}"/>
498 >        </or>
499 >      </and>
500 >    </condition>
501 >
502 >    <property name="build.novariance"
503 >             value=""/>
504 >
505 >    <property name="gjc.dir"
506 >             value="${lib.dir}/gjc"/>
507 >
508 >    <property name="javac.jar"
509 >          location="${gjc.dir}/${gjc.version}/javac.jar"/>
510 >
511 >    <property name="collect.jar"
512 >          location="${gjc.dir}/${gjc.version}/collect${build.novariance}.jar"/>
513 >
514 >
515 >    <condition property="build.warnunchecked" value="-warnunchecked">
516 >      <istrue value="${gjc.warnunchecked}"/>
517 >    </condition>
518 >
519 >    <property name="build.warnunchecked" value=""/>
520 >
521 >    <condition property="prepare.src.dir" value="${build.dir}/prepare-src">
522 >      <istrue value="${build.nothreads}"/>
523 >    </condition>
524 >
525 >
526 >    <!--
527 >     ! Bootclasspath munging for source compilation.
528 >     -->
529 >
530 >    <path id="javac.bootclasspath.prefix">
531 >      <!-- <pathelement location="${src.dir}"/> -->
532 >      <pathelement location="${javac.jar}"/>
533 >    </path>
534 >
535 >    <path id="javac.bootclasspath">
536 >      <!-- <pathelement location="${src.dir}"/> -->
537 >      <pathelement location="${collect.jar}"/>
538 >      <pathelement location="${rt.jar}"/>
539 >    </path>
540 >
541 >    <!-- Flatten bootclasspath prefix into a platform-appropriate string -->
542 >    <property name="javac.bootclasspath.prefix"
543 >             refid="javac.bootclasspath.prefix"/>
544 >
545 >    <!-- Turn the flattened bootclasspath prefix into a javac argument -->
546 >    <property name="build.bootclasspath.arg"
547 >             value='-J-Xbootclasspath/p:${javac.bootclasspath.prefix}'/>
548 >
549 >    <!-- Flatten bootclasspath for trace message -->
550 >    <property name="javac.bootclasspath"
551 >             refid="javac.bootclasspath"/>
552 >
553 >    <!-- Common options in javac invocations -->
554 >    <property name="build.javac.args"
555 >             value="${build.bootclasspath.arg} ${build.warnunchecked} ${build.novariance}"/>
556 >
557 >    <echo>javac ${build.javac.args}</echo>
558 >    <echo>bootclasspath=${javac.bootclasspath}</echo>
559  
560    </target>
561  
562  
563 <  <target name="check-emulation">
563 >  <target name="prepare-src"
564 >          depends="configure-compiler"
565 >          if="prepare.src.dir">
566 >
567 >    <mkdir dir="${prepare.src.dir}"/>
568 >    <copy todir="${prepare.src.dir}">
569 >      <fileset dir="${src.dir}">
570 >        <exclude name="java/lang/**"/>
571 >      </fileset>
572 >    </copy>
573 >
574 >  </target>
575 >
576 >
577 >  <target name="configure-emulation">
578 >
579      <condition property="build.emulation.true">
580        <or>
581 <        <isset property="build.emulation"/>
582 <        <os family="windows"/>
581 >        <and>
582 >          <os family="windows"/>
583 >          <not>
584 >            <isset property="build.emulation"/>
585 >          </not>
586 >        </and>
587 >        <istrue value="${build.emulation}"/>
588        </or>
589      </condition>
590 +
591 +  </target>
592 +
593 +
594 +  <target name="configure-tests">
595 +
596 +    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
597 +    <available property="junit.available"
598 +               classname="junit.framework.Protectable"/>
599 +
600 +    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
601 +          unless="junit.available"/>
602 +
603 +
604 +    <!--
605 +     ! Bootclasspath munging for testing, so JUnit can test our local
606 +     ! modifications to java.*.
607 +     -->
608 +
609 +    <path id="test.classpath">
610 +      <pathelement location="${product.jar}"/>
611 +      <pathelement location="${build.testcases.dir}"/>
612 +      <pathelement location="${junit.jar}"/>
613 +    </path>
614 +
615 +    <!-- Flatten test classpath into a platform-appropriate string -->
616 +    <property name="test.classpath" refid="test.classpath"/>
617 +
618 +    <!-- Turn the flattened test classpath into a javac argument -->
619 +    <property name="test.bootclasspath.arg"
620 +             value='-Xbootclasspath/p:${test.classpath}'/>
621 +
622    </target>
623  
624  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines