[cvs] / jsr166 / build.xml Repository:
ViewVC logotype

Diff of /jsr166/build.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.56, Mon Sep 1 04:21:55 2003 UTC revision 1.239, Sun Mar 26 10:40:29 2017 UTC
# Line 1  Line 1 
1  <project name="jsr166" default="usage">  <project name="jsr166" default="usage"
2      xmlns:if="ant:if" xmlns:unless="ant:unless"
3      xmlns:ivy="antlib:org.apache.ivy.ant">
4    
5    <description>    <description>
6  ------------------------------------------------------------------------------  ------------------------------------------------------------------------------
# Line 6  Line 8 
8    
9    Usage: ant [target]    Usage: ant [target]
10    
11      See http://gee.cs.oswego.edu/dl/concurrency-interest/index.html for
12      more details.
13    
14    User-specific settings are read from user.properties.    User-specific settings are read from user.properties.
15    See user.properties.sample for an explanation of some useful settings.    See user.properties.sample for an explanation of some useful settings.
16    
17      The repository contains all dependencies except for ant and the JDK
18      itself.  Because the JDK version matters and because different
19      targets require different JDKs, we assume that users have created a
20      hierarchy containing:
21      $HOME/jdk/jdk7
22      $HOME/jdk/jdk8
23      $HOME/jdk/jdk9
24      $HOME/jdk/jdk10
25      where each of the above is a JDK or a symlink to same, and
26      $HOME/jdk/src/jdk7
27      $HOME/jdk/src/jdk8
28      $HOME/jdk/src/jdk9
29      $HOME/jdk/src/jdk10
30      where each of the above is a complete JDK source tree
31      (e.g. mercurial forest) or a symlink to same.
32    
33      Alternatively, define ant variables thus:
34      ant -Djdk$N.home=... -Djdk$N.src.home=...
35      for $N in 7 8 9 10 ...
36    
37      As of 2016-03, the sources in src/main are for jdk9+ only.
38  ------------------------------------------------------------------------------  ------------------------------------------------------------------------------
39    </description>    </description>
40    
41    <target name="usage" description="Advises user to run with -projecthelp">    <!-- Run 'ant -projecthelp' (default target) -->
42      <echo>Run "ant -projecthelp" for full usage information.</echo>    <target name="usage">
43        <java classname="org.apache.tools.ant.Main">
44          <arg value="-projecthelp" />
45        </java>
46    </target>    </target>
47    
48      <!-- HOWTO printf debug: <echo message="prop=${prop}"/> -->
49    
50    <!-- User-specific settings -->    <!-- User-specific settings -->
51    <property file="user.properties"/>    <property file="user.properties"/>
52    
53    
54    <!-- Compilation options -->    <!-- Compilation options -->
55    <property name="build.sourcelevel"    value="1.5"/>    <property name="build.sourcelevel"    value="6"/>
   <property name="build.docsourcelevel" value="1.4"/>  
56    <property name="build.debug"          value="true"/>    <property name="build.debug"          value="true"/>
57    <property name="build.debuglevel"     value="source,lines,vars"/>    <property name="build.debuglevel"     value="source,lines,vars"/>
58    <property name="build.deprecation"    value="false"/>    <property name="build.deprecation"    value="false"/>
59      <property name="build.javadoc.access" value="protected"/>
60    
61    <!-- Build locations -->    <!-- Build locations -->
62    <property name="build.dir"            location="build"/>    <property name="build.dir"            location="build"/>
63    <property name="build.classes.dir"    location="${build.dir}/classes"/>    <property name="build.classes.dir"    location="${build.dir}/classes"/>
   <property name="build.emulation.dir"  location="${build.dir}/emulation"/>  
64    <property name="build.testcases.dir"  location="${build.dir}/testcases"/>    <property name="build.testcases.dir"  location="${build.dir}/testcases"/>
65    <property name="build.lib.dir"        location="${build.dir}/lib"/>    <property name="build.loops.dir"             location="${build.dir}/loops"/>
66    <property name="build.ant.dir"        location="${build.dir}/ant"/>  
67    <property name="build.javadocs.dir"   location="${build.dir}/javadocs"/>    <property name="build.4jdk7.dir"             location="${build.dir}/jsr166-4jdk7"/>
68    <property name="build.sinjdocs.dir"   location="${build.dir}/sinjdocs"/>    <property name="build.4jdk7.classes.dir"     location="${build.4jdk7.dir}/classes"/>
69    <property name="build.stripped.dir"   location="${build.dir}/stripped"/>    <property name="build.4jdk7.tck.classes.dir" location="${build.4jdk7.dir}/tck-classes"/>
70    <property name="build.reports.dir"    location="${build.dir}/reports"/>    <property name="build.4jdk7.docs.dir"        location="${build.4jdk7.dir}/docs"/>
71    <property name="build.doccheck.dir"   location="${build.dir}/doccheck"/>  
72    <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>    <property name="build.4jdk8.dir"             location="${build.dir}/jsr166-4jdk8"/>
73    <property name="build.filter.doccheck.dir" location="${build.dir}/filterdocchk"/>    <property name="build.4jdk8.classes.dir"     location="${build.4jdk8.dir}/classes"/>
74      <property name="build.4jdk8.tck.classes.dir" location="${build.4jdk8.dir}/tck-classes"/>
75      <property name="build.4jdk8.docs.dir"        location="${build.4jdk8.dir}/docs"/>
76    
77      <property name="build.jsr166x.dir"           location="${build.dir}/jsr166x"/>
78      <property name="build.jsr166y.dir"           location="${build.dir}/jsr166y"/>
79      <property name="build.jsr166e.dir"           location="${build.dir}/jsr166e"/>
80      <property name="build.extra166y.dir"         location="${build.dir}/extra166y"/>
81    
82      <property name="build.jsr166x.classes.dir"   location="${build.jsr166x.dir}/classes"/>
83      <property name="build.jsr166y.classes.dir"   location="${build.jsr166y.dir}/classes"/>
84      <property name="build.jsr166e.classes.dir"   location="${build.jsr166e.dir}/classes"/>
85      <property name="build.extra166y.classes.dir" location="${build.extra166y.dir}/classes"/>
86    
87      <!-- JDK locations -->
88      <property name="jdks.home"  location="${user.home}/jdk"/>
89    
90      <macrodef name="defjdklocations">
91        <attribute name="v"/>
92        <sequential>
93        <property name="jdk@{v}.home"     location="${jdks.home}/jdk@{v}"/>
94        <property name="java@{v}"         location="${jdk@{v}.home}/bin/java"/>
95        <property name="javac@{v}"        location="${jdk@{v}.home}/bin/javac"/>
96        <property name="javadoc@{v}"      location="${jdk@{v}.home}/bin/javadoc"/>
97        <property name="jdk@{v}.src.home" location="${jdks.home}/src/jdk@{v}"/>
98        <local name="have.java.base"/>
99        <available property="have.java.base"
100          file="${jdk@{v}.src.home}/jdk/src/java.base/share/classes" type="dir"/>
101        <property name="jdk@{v}.src.dir" location="${jdk@{v}.src.home}/jdk/src/java.base/share/classes"
102          if:set="have.java.base"/>
103        <property name="jdk@{v}.src.dir" location="${jdk@{v}.src.home}/jdk/src/share/classes"
104          unless:set="have.java.base"/>
105        <local name="modules"/>
106        <available property="modules" file="${jdk@{v}.home}/jmods" type="dir"/>
107        <local name="boot.jar.dir"/>
108        <property name="boot.jar.dir"   location="${jdk@{v}.home}/jre/lib" unless:set="modules"/>
109        <path id="bootclasspath@{v}" unless:set="modules">
110          <pathelement path="${boot.jar.dir}/resources.jar"/>
111          <pathelement path="${boot.jar.dir}/rt.jar"/>
112          <pathelement path="${boot.jar.dir}/jsse.jar"/>
113          <pathelement path="${boot.jar.dir}/jce.jar"/>
114          <pathelement path="${boot.jar.dir}/charsets.jar"/>
115        </path>
116        <property name="bootclasspath@{v}" value="${toString:bootclasspath@{v}}" unless:set="modules"/>
117        </sequential>
118      </macrodef>
119    
120      <macrodef name="mirror-dir">
121        <attribute name="src"/>
122        <attribute name="dst"/>
123        <sequential>
124        <delete dir="@{dst}"/>
125        <mkdir dir="@{dst}"/>
126        <copy todir="@{dst}" preservelastmodified="true">
127          <fileset dir="@{src}"/>
128        </copy>
129        </sequential>
130      </macrodef>
131    
132      <defjdklocations v="6"/>
133      <defjdklocations v="7"/>
134      <defjdklocations v="8"/>
135      <defjdklocations v="9"/>
136      <defjdklocations v="10"/>
137    
138    <!-- Source locations -->    <!-- Source locations -->
139    <property name="src.dir"              location="${basedir}/src/main"/>    <property name="src.dir"              location="${basedir}/src/main"/>
   <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>  
140    <property name="test.src.dir"         location="${basedir}/src/test"/>    <property name="test.src.dir"         location="${basedir}/src/test"/>
141    <property name="ant.src.dir"          location="${basedir}/etc/ant"/>    <property name="loops.src.dir"        location="${basedir}/src/loops"/>
142    <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>    <property name="tck.src.dir"          location="${test.src.dir}/tck"/>
143      <property name="jtreg7.src.dir"       location="${test.src.dir}/jtreg-jdk7"/>
144      <property name="jtreg8.src.dir"       location="${test.src.dir}/jtreg-jdk8"/>
145      <property name="jtreg9.src.dir"       location="${test.src.dir}/jtreg"/>
146      <property name="jtreg10.src.dir"      location="${test.src.dir}/jtreg"/>
147      <property name="jtreg.src.dir"        location="${jtreg9.src.dir}"/>
148    <property name="lib.dir"              location="${basedir}/lib"/>    <property name="lib.dir"              location="${basedir}/lib"/>
149    <property name="dist.dir"             location="${basedir}/dist"/>    <property name="dist.dir"             location="${basedir}/dist"/>
150      <property name="topsrc.dir"           location="${basedir}/src"/>
151    <!-- Distribution locations -->    <property name="4jdk7src.dir"         location="${topsrc.dir}/jdk7"/>
152    <property name="dist.javadocs.dir"    location="${dist.dir}/docs"/>    <property name="4jdk8src.dir"         location="${topsrc.dir}/jdk8"/>
153      <property name="jsr166xsrc.dir"       location="${topsrc.dir}/jsr166x"/>
154      <property name="jsr166ysrc.dir"       location="${topsrc.dir}/jsr166y"/>
155      <property name="jsr166esrc.dir"       location="${topsrc.dir}/jsr166e"/>
156      <property name="extra166ysrc.dir"     location="${topsrc.dir}/extra166y"/>
157    
158      <!-- Javadoc locations -->
159      <property name="docs.dir"          location="${build.dir}/docs"/>
160      <property name="4jdk7docs.dir"     location="${build.4jdk7.dir}/docs"/>
161      <property name="4jdk8docs.dir"     location="${build.4jdk8.dir}/docs"/>
162      <property name="jsr166xdocs.dir"   location="${build.jsr166x.dir}/docs"/>
163      <property name="jsr166ydocs.dir"   location="${build.jsr166y.dir}/docs"/>
164      <property name="jsr166edocs.dir"   location="${build.jsr166e.dir}/docs"/>
165      <property name="extra166ydocs.dir" location="${build.extra166y.dir}/docs"/>
166    
167      <property name="dist.docs.dir"          location="${dist.dir}/docs"/>
168      <property name="dist.4jdk7docs.dir"     location="${dist.dir}/jsr166-4jdk7docs"/>
169      <property name="dist.4jdk8docs.dir"     location="${dist.dir}/jsr166-4jdk8docs"/>
170      <property name="dist.jsr166xdocs.dir"   location="${dist.dir}/jsr166xdocs"/>
171      <property name="dist.jsr166ydocs.dir"   location="${dist.dir}/jsr166ydocs"/>
172      <property name="dist.jsr166edocs.dir"   location="${dist.dir}/jsr166edocs"/>
173      <property name="dist.extra166ydocs.dir" location="${dist.dir}/extra166ydocs"/>
174    
175    <!-- Jar locations -->    <!-- Jar locations -->
176    <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>    <property name="product.jar"      location="${build.dir}/jsr166.jar"/>
177      <property name="4jdk7product.jar" location="${build.4jdk7.dir}/jsr166-4jdk7.jar"/>
178      <property name="4jdk8product.jar" location="${build.4jdk8.dir}/jsr166-4jdk8.jar"/>
179      <property name="jsr166x.jar"      location="${build.jsr166x.dir}/jsr166x.jar"/>
180      <property name="jsr166y.jar"      location="${build.jsr166y.dir}/jsr166y.jar"/>
181      <property name="jsr166e.jar"      location="${build.jsr166e.dir}/jsr166e.jar"/>
182      <property name="extra166y.jar"    location="${build.extra166y.dir}/extra166y.jar"/>
183    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>    <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
   <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>  
   <property name="sinjdoc.jar"          location="${lib.dir}/sinjdoc.jar"/>  
184    
185      <!-- Canonical location of jdk docs root, to use with javadoc -Xdocrootparent flag -->
186      <property name="java5.docroot.url"      value="http://docs.oracle.com/javase/1.5.0/docs"/>
187      <property name="java6.docroot.url"      value="http://docs.oracle.com/javase/6/docs"/>
188      <property name="java7.docroot.url"      value="http://docs.oracle.com/javase/7/docs"/>
189      <property name="java8.docroot.url"      value="http://docs.oracle.com/javase/8/docs"/>
190      <!-- The expected canonical location does not yet exist as of 2016-04 -->
191      <!-- <property name="java9.docroot.url" value="http://docs.oracle.com/javase/9/docs"/> -->
192      <property name="java9.docroot.url"      value="http://download.java.net/java/jdk9/docs"/>
193      <!-- Default jdk doc location (latest stable release seems best) -->
194      <property name="java.docroot.url"       value="${java8.docroot.url}"/>
195    
196      <!-- Canonical location of jdk API docs, to use with javadoc link attribute -->
197      <property name="java5.api.url"      value="${java5.docroot.url}/api/"/>
198      <property name="java6.api.url"      value="${java6.docroot.url}/api/"/>
199      <property name="java7.api.url"      value="${java7.docroot.url}/api/"/>
200      <property name="java8.api.url"      value="${java8.docroot.url}/api/"/>
201      <property name="java9.api.url"      value="${java9.docroot.url}/api/"/>
202      <property name="java.api.url"       value="${java.docroot.url}/api/"/>
203    
204      <!-- Define the "jtreg" task -->
205      <!-- See the docs in "jtreg -onlineHelp" -->
206      <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"
207               classpath="${lib.dir}/jtreg.jar" />
208    
209      <!-- Tck options; see JSR166TestCase.java
210       To profile a single tck test class:
211       ant -Djsr166.profileTests=true -Djsr166.profileThreshold=10 -Djsr166.tckTestClass=CompletableFutureTest tck
212       To stress test a single tck test class:
213       ant -Djsr166.tckTestClass=CountedCompleterTest -Djsr166.runsPerTest=100 tck
214       To stress test a single tck test method:
215       ant -Djsr166.tckTestClass=RecursiveTaskTest -Djsr166.runsPerTest=1000 -Djsr166.methodFilter=testAbnormalInvokeAll3 tck
216      -->
217      <property name="jsr166.tckTestClass"     value="JSR166TestCase"/>
218      <macrodef name="run-tck-tests">
219        <attribute name="tck.src.dir" default="${tck.src.dir}"/>
220        <attribute name="target"/>
221        <attribute name="compile-target" default="@{target}"/>
222        <attribute name="workdir"/>
223        <attribute name="classes"/>
224        <!--
225            <attribute name="jvmflags" default="-XX:+UseParallelGC -XX:-UseBiasedLocking -ea -esa -Djsr166.testImplementationDetails=true"/>
226        -->
227            <attribute name="jvmflags" default="-ea -esa -Djsr166.testImplementationDetails=true"/>
228        <element name="javac-elements" optional="true"/>
229    
230        <sequential>
231    
232        <local name="modules"/>
233        <condition property="modules">
234          <available file="${jdk@{compile-target}.home}/jmods" type="dir"/>
235        </condition>
236    
237        <local name="use-doclint"/>
238        <condition property="use-doclint">
239          <not> <equals arg1="@{target}" arg2="7"/> </not>
240        </condition>
241    
242        <mkdir dir="@{workdir}/tck-classes"/>
243    
244        <javac srcdir="@{tck.src.dir}"
245               destdir="@{workdir}/tck-classes"
246               debug="${build.debug}"
247               debuglevel="${build.debuglevel}"
248               deprecation="${build.deprecation}"
249               source="@{compile-target}"
250               target="@{compile-target}"
251               classpath="${junit.jar}"
252               includeAntRuntime="false"
253               includeJavaRuntime="false"
254               encoding="ASCII"
255               executable="${javac@{compile-target}}"
256               fork="true">
257    
258          <include name="*.java"/>
259          <compilerarg value="-XDignore.symbol.file=true"/>
260          <compilerarg value="-Xlint:all,-unchecked,-rawtypes,-serial,-deprecation,-try"/>
261          <compilerarg value="-Xdoclint:reference/private" if:set="use-doclint"/>
262          <compilerarg value="-Xbootclasspath/p:@{classes}" unless:set="modules"/>
263          <compilerarg value="--patch-module=java.base=@{classes}" if:set="modules"/>
264          <compilerarg line="${build.args}"/>
265          <javac-elements/>
266    
267        </javac>
268    
269        <java classname="${jsr166.tckTestClass}"
270              failonerror="true"
271              jvm="${java@{target}}"
272              fork="true">
273            <jvmarg value="-Xbootclasspath/p:@{classes}" unless:set="modules"/>
274            <jvmarg value="--patch-module=java.base=@{classes}" if:set="modules"/>
275            <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" if:set="modules"/>
276            <jvmarg value="--add-opens=java.base/java.util=ALL-UNNAMED" if:set="modules"/>
277            <jvmarg value="--add-opens=java.base/java.util.concurrent=ALL-UNNAMED" if:set="modules"/>
278            <jvmarg value="--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED" if:set="modules"/>
279            <jvmarg value="--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED" if:set="modules"/>
280            <jvmarg line="@{jvmflags}"/>
281            <!-- ant -Dvmoptions="-Xmx8m" -Djsr166.tckTestClass=CompletableFutureTest tck -->
282            <jvmarg line="${vmoptions}" if:set="vmoptions"/>
283    
284            <!-- ant -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 tck -->
285            <syspropertyset id="system-properties-used-by-tck">
286              <propertyref prefix="java.util.concurrent.ForkJoinPool"/>
287              <propertyref prefix="jsr166."/>
288              <propertyref name="test.timeout.factor"/>
289            </syspropertyset>
290    
291    <!-- Files excluded from dist-docs and emulation jar -->          <classpath>
292    <patternset id="unsafe.exclusion">            <pathelement location="${junit.jar}"/>
293      <exclude name="java/util/Random.*"/>            <pathelement location="@{workdir}/tck-classes"/>
294      <exclude name="sun/misc/Unsafe.*"/>          </classpath>
295        </java>
296    
297        </sequential>
298      </macrodef>
299    
300      <!-- Define jtreg test sets for different jdk versions -->
301      <fileset dir="${jtreg9.src.dir}">
302        <patternset id="jdk9.jtreg.tests">
303          <include name="**/*.java"/>
304    </patternset>    </patternset>
305      </fileset>
306    
307    <!-- Files excludes from emulation jar -->    <fileset dir="${jtreg8.src.dir}">
308    <patternset id="atomic.exclusion">      <patternset id="jdk8.jtreg.tests">
309      <exclude name="java/util/concurrent/atomic/AtomicBoolean*"/>        <include name="**/*.java"/>
     <exclude name="java/util/concurrent/atomic/AtomicInteger*"/>  
     <exclude name="java/util/concurrent/atomic/AtomicLong*"/>  
     <exclude name="java/util/concurrent/atomic/AtomicReference*"/>  
     <exclude name="java/util/concurrent/locks/LockSupport*"/>  
     <exclude name="java/util/concurrent/locks/ReentrantLock*"/>  
310    </patternset>    </patternset>
311      </fileset>
312    
313      <fileset dir="${jtreg7.src.dir}">
314        <patternset id="jdk7.jtreg.tests">
315          <include name="**/*.java"/>
316        </patternset>
317      </fileset>
318    
319      <!-- ant -Djtreg.flags=-timeoutFactor:4 -->
320      <property name="jtreg.flags" value=""/>
321    
322    <!-- Main targets -->    <macrodef name="run-jtreg-tests">
323        <!-- ant -Djtreg9.src.dir=src/test/jtreg/util/concurrent/CompletableFuture jtreg -->
324        <attribute name="source" default="7"/>
325        <attribute name="target"/>
326        <attribute name="workdir"/>
327        <attribute name="classes"/>
328        <attribute name="jtregflags" default=""/>
329    
330        <sequential>
331    
332        <!-- ant -Djtreg.verbose=time,fail,error jtreg -->
333        <property name="jtreg.verbose" value="nopass,fail,error"/>
334    
335        <local name="modules"/>
336        <condition property="modules">
337          <available file="${jdk@{target}.home}/jmods" type="dir"/>
338        </condition>
339    
340    <target name="compile"      <delete dir="@{workdir}/JTwork"   quiet="true"/>
341            depends="init, configure-compiler, prepare-src"      <jtreg dir="${jtreg@{target}.src.dir}"
342            description="Compiles main sources to build folder">             jdk="${jdk@{target}.home}"
343               workDir="@{workdir}/JTwork">
344          <patternset refid="jdk@{target}.jtreg.tests"/>
345          <arg value="-Xbootclasspath/p:@{classes}" unless:set="modules"/>
346          <arg value="-javacoptions:--patch-module java.base=@{classes}" if:set="modules"/>
347          <arg value="-vmoptions:--patch-module java.base=@{classes}" if:set="modules"/>
348          <arg value="-agentvm"/>
349          <arg value="-noreport"/>
350          <arg value="-verbose:${jtreg.verbose}"/>
351          <arg value="-vmoptions:-esa -ea"/>
352          <arg value="-automatic"/>
353          <arg value="-k:!ignore"/>
354          <arg line="@{jtregflags}"/>
355          <arg line="${jtreg.flags}"/>
356        </jtreg>
357        </sequential>
358      </macrodef>
359    
360      <!-- ALoops classpath -->
361      <path id="loops.classpath">
362        <pathelement location="${build.loops.dir}"/>
363      </path>
364    
365      <!-- Support @jls tag, used in jdk8+ javadoc -->
366      <property name="javadoc.jls.cite" value="The Java&amp;trade; Language Specification"/>
367      <property name="javadoc.jls.option" value="jls:a:See &lt;cite&gt;${javadoc.jls.cite}&lt;/cite&gt;:"/>
368    
369      <property name="prepare.src.dir" value="${src.dir}"/>    <!-- Main targets -->
370    
371      <mkdir dir="${build.classes.dir}"/>    <property name="build.main.java.version" value="9"/>
372      <property name="build.main.javac" value="${javac9}"/>
373    
374      <target name="dists"
375  <!--  <!--
376      <echo>javac ${gjc.args}</echo>                depends="dist, 4jdk8dist, 4jdk7dist, jsr166edist, jsr166ydist, extra166ydist, jsr166xdist"
     <echo>bootclasspath=${compile.bootclasspath}</echo>  
377  -->  -->
378              depends="dist, 4jdk8dist"
379              description="Builds all public jars and docs"/>
380    
381      <target name="compile"
382              depends="configure-compiler"
383              description="Compiles src/main sources to build dir">
384    
385        <local name="modules"/>
386        <condition property="modules">
387          <and>
388            <available file="${jdk9.home}/jmods" type="dir"/>
389            <equals arg1="9" arg2="${build.main.java.version}"/>
390          </and>
391        </condition>
392    
393        <local name="destdir"/>
394        <property name="destdir" value="${build.classes.dir}/java.base" if:set="modules"/>
395        <property name="destdir" value="${build.classes.dir}" unless:set="modules"/>
396    
397      <javac srcdir="${prepare.src.dir}"      <mkdir dir="${destdir}"/>
398            destdir="${build.classes.dir}"  
399        <javac srcdir="${src.dir}"
400               destdir="${destdir}"
401              debug="${build.debug}"              debug="${build.debug}"
402         debuglevel="${build.debuglevel}"         debuglevel="${build.debuglevel}"
403        deprecation="${build.deprecation}"        deprecation="${build.deprecation}"
404             source="${build.sourcelevel}"             classpath=""
405               includeAntRuntime="false"
406               includeJavaRuntime="false"
407               encoding="ASCII"
408               executable="${build.main.javac}"
409               fork="true">               fork="true">
410    
411        <compilerarg    line="${gjc.args}"/>        <include name="**/*.java"/>
412  <!--        <compilerarg value="--patch-module=java.base=${src.dir}" if:set="modules"/>
413        <bootclasspath refid="compile.bootclasspath"/>        <compilerarg value="-Xprefer:source"/>
414  -->        <compilerarg value="-XDignore.symbol.file=true"/>
415          <compilerarg value="-Xlint:all"/>
416          <compilerarg value="-Werror"/>
417          <compilerarg value="-Xdoclint:all/protected,reference/private"/>
418          <compilerarg line="-Xmaxerrs 1000 -Xmaxwarns 1000"/>
419          <compilerarg line="${build.args}"/>
420    
421      </javac>      </javac>
   
422    </target>    </target>
423    
424    
425    <target name="jar"    <target name="jar"
426            depends="configure-emulation, init-jar, native-jar, emulation-jar"            depends="compile"
427            description="Builds library jar from compiled sources"/>            description="Builds library jar for src/main from compiled sources">
428        <local name="subdir"/>
429        <available property="subdir" file="${build.classes.dir}/java.base" type="dir" value="/java.base"/>
430        <jar destfile="${product.jar}">
431          <fileset dir="${build.classes.dir}${subdir}"/>
432          <manifest>
433            <attribute name="Built-By" value="${user.name}"/>
434            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
435          </manifest>
436        </jar>
437      </target>
438    
439    
440    <target name="test"    <target name="docs"
441            depends="init, configure-tests, report-tests"            description="Builds javadocs for src/main to dist dir">
           description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />  
442    
443        <delete dir="${docs.dir}"/>
444        <mkdir dir="${docs.dir}"/>
445    
446    <target name="checkstyle"      <!-- the packagenames="none" hack below prevents scanning the -->
447            depends="filter-src"      <!-- sourcepath for packages -->
           description="Reports on style errors in Java source (verbose, mostly chaff)">  
448    
449      <taskdef resource="checkstyletask.properties"  <!-- TODO: sourcepath="${src.dir}:${jdk9.src.dir}" -->
450              classpath="${lib.dir}/checkstyle-all-2.4.jar"/>  <!-- TODO: sourcepath="${src.dir}:${jdk9.src.dir}:${jdk9.src.home}/jdk/src/java.logging/share/classes" -->
451    <!-- TODO: sourcepath="${src.dir}:${jdk9.home}/src.zip" -->
452    <!-- TODO: <arg line="-sourcepath ${src.dir}:${jdk9.home}/src.zip"/> -->
453    <!-- TODO: <arg line="- -module-source-path ${jdk9.home}/src.zip"/> -->
454        <javadoc destdir="${docs.dir}"
455                 packagenames="none"
456                 link="${java9.api.url}"
457                 overview="${src.dir}/intro.html"
458                 access="${build.javadoc.access}"
459                 sourcepath="${src.dir}"
460                 classpath=""
461                 executable="${javadoc9}">
462          <fileset dir="${src.dir}" defaultexcludes="yes">
463            <include name="**/*.java"/>
464          </fileset>
465          <arg line="-Xdocrootparent ${java9.docroot.url}"/>
466          <arg line="-Xmaxerrs 1000 -Xmaxwarns 1000"/>
467          <arg value="-XDignore.symbol.file=true"/>
468          <arg value="--patch-module=java.base=${src.dir}"/>
469          <arg value="-tag"/>
470          <arg value="${javadoc.jls.option}"/>
471    <!-- @apiNote currently unused -->
472    <!--       <arg value="-tag"/> -->
473    <!--       <arg value="apiNote:a:API Note:"/> -->
474          <arg value="-tag"/>
475          <arg value="implSpec:a:Implementation Requirements:"/>
476          <arg value="-tag"/>
477          <arg value="implNote:a:Implementation Note:"/>
478    <!-- tags added in jdk9: currently unused -->
479    <!--       <arg value="-tag"/> -->
480    <!--       <arg value="revised:X"/> -->
481    <!--       <arg value="-tag"/> -->
482    <!--       <arg value="spec:X"/> -->
483        </javadoc>
484      </target>
485    
     <checkstyle>  
       <formatter type="plain"/>  <!-- also available: type="xml" -->  
       <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>  
     </checkstyle>  
486    
487    </target>    <target name="dist"
488              depends="dist-clean, dist-jar, dist-docs"
489              description="Puts all distributable products in single hierarchy"/>
490    
491    
492      <target name="release"
493              depends="dist"
494              description="Puts entire CVS tree, plus distribution productions, in a jar">
495    
496        <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>
497    
498    <target name="doccheck"      <jar basedir="${basedir}" destfile="${release.jar}">
499            depends="filter-doccheck"        <!-- <exclude name="build/**"/> -->
500            description="Reports on javadoc style errors">        <exclude name="${release.jar}"/>
501          <exclude name="user.properties"/>
502          <exclude name="etc/notes/**"/>
503          <exclude name="src/emulation/**"/>
504          <exclude name="**/SyntaxTest.java"/>
505          <exclude name="**/SuperfluousAbstract.java"/>
506          <manifest>
507            <attribute name="Built-By" value="${user.name}"/>
508            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
509          </manifest>
510        </jar>
511      </target>
512    
     <delete dir="${build.doccheck.dir}"/>  
     <mkdir dir="${build.doccheck.dir}"/>  
513    
514      <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"    <target name="clean"
515           docletpath="${lib.dir}/doccheck.jar"            description="Removes all build products">
             destdir="${build.doccheck.dir}">  
       <packageset dir="${build.filter.doccheck.dir}"/>  
     </javadoc>  
516    
517      <echo>DocCheck output is in ${build.doccheck.dir}</echo>      <delete dir="${build.dir}"/>
518    
519    </target>    </target>
520    
521    
522    <target name="docs"    <target name="dist-clean"
523            depends="filter-src"            description="Removes all build and distribution products">
           description="Builds javadocs with custom tags to build folder">  
524    
525      <delete dir="${build.javadocs.dir}"/>      <delete dir="${build.dir}"/>
526      <mkdir dir="${build.javadocs.dir}"/>      <delete dir="${dist.dir}"/>
527    
528      <javadoc destdir="${build.javadocs.dir}"    </target>
                 link="http://java.sun.com/j2se/1.4.1/docs/api"  
             overview="${src.dir}/intro.html"  
               source="${build.docsourcelevel}">  
529    
       <tag name="revised" description="Last revised:"/>  
       <tag name="spec"    description="Specified by:"/>  
       <tag name="editor"  description="Last edited by:"/>  
       <tag name="fixme"   description="FIX ME:"/>  
530    
531        <packageset dir="${build.filter.src.dir}"/>    <target name="dist-jar"
532              depends="clean, jar">
533        <copy file="${product.jar}" todir="${dist.dir}"/>
534      </target>
535    
536      </javadoc>    <target name="dist-docs"
537              depends="clean, docs">
538        <mirror-dir src="${docs.dir}" dst="${dist.docs.dir}"/>
539      </target>
540    
541      <target name="tck"
542              depends="jar"
543              description="Runs tck tests for src/main directly">
544    
545        <run-tck-tests
546          target="${build.main.java.version}"
547          workdir="${build.dir}"
548          classes="${product.jar}">
549          <javac-elements>
550            <compilerarg value="-Werror"/>
551          </javac-elements>
552        </run-tck-tests>
553      </target>
554    
555      <target name="tck-parallelism-1"
556              description="Runs tck with common pool parallelism 1">
557        <antcall target="tck">
558          <param name="java.util.concurrent.ForkJoinPool.common.parallelism" value="1"/>
559        </antcall>
560      </target>
561    
562      <target name="tck-parallelism-0"
563              description="Runs tck with common pool parallelism 0">
564        <antcall target="tck">
565          <param name="java.util.concurrent.ForkJoinPool.common.parallelism" value="0"/>
566        </antcall>
567      </target>
568    
569      <target name="tck-security-manager"
570              description="Runs tck with a security manager">
571        <antcall target="tck">
572          <param name="jsr166.useSecurityManager" value="true"/>
573        </antcall>
574      </target>
575    
576      <target name="jtreg"
577              depends="jar"
578              description="Runs jtreg tests for src/main using the jtreg ant task">
579        <run-jtreg-tests
580           target="${build.main.java.version}"
581           workdir="${build.dir}"
582           classes="${product.jar}"/>
583    </target>    </target>
584    
585      <target name="test"
586              depends="tck, tck-parallelism-1, tck-parallelism-0, jtreg"
587              description="Runs tck and jtreg tests for src/main">
588      </target>
589    
590    <target name="sinjdocs"  <!--   <target name="jtreg8" description="Runs jtreg tests with jdk8"> -->
           depends="configure-tests"  
           description="Builds javadocs with custom tags to build folder">  
591    
592      <delete dir="${build.sinjdocs.dir}"/>  <!--     <antcall target="jtreg"> -->
593      <mkdir dir="${build.sinjdocs.dir}"/>  <!--       <param name="build.main.java.version" value="8"/> -->
594    <!--       <param name="build.main.javac" value="${javac8}"/> -->
595    <!--     </antcall> -->
596    
597      <java classname="net.cscott.sinjdoc.Main" fork="true">  <!--   </target> -->
598    
599        <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>  <!--   <target name="test89" -->
600    <!--           description="Runs tck and jtreg tests for src/main for multiple java versions"> -->
601    
602        <classpath>  <!--     <antcall target="clean"/> -->
603          <pathelement location="${sinjdoc.jar}"/>  <!--     <antcall target="test"> -->
604          <pathelement location="${lib.dir}/jutil.jar"/>  <!--       <param name="build.main.java.version" value="8"/> -->
605          <pathelement location="${lib.dir}/cup.jar"/>  <!--       <param name="build.main.javac" value="${javac8}"/> -->
606          <path refid="test.classpath"/>  <!--     </antcall> -->
       </classpath>  
607    
608    <!--     <antcall target="clean"/> -->
609    <!--     <antcall target="test"> -->
610    <!--       <param name="build.main.java.version" value="9"/> -->
611    <!--       <param name="build.main.javac" value="${javac9}"/> -->
612    <!--     </antcall> -->
613    
614        <arg value="-d"/>          <arg value="${build.sinjdocs.dir}"/>  <!--   </target> -->
       <arg value="-sourcepath"/> <arg value="${src.dir}"/>  
       <arg value="-overview"/>   <arg value="${src.dir}/intro.html"/>  
       <arg value="-source"/>     <arg value="${build.sourcelevel}"/>  
       <!-- <arg value="-verbose"/> -->  
       <!-- <arg value="-link"/>  <arg value="http://java.sun.com/j2se/1.4.1/docs/api"/> -->  
       <arg value="java.lang"/>  
       <arg value="java.util"/>  
       <arg value="java.util.concurrent"/>  
       <arg value="java.util.concurrent.atomic"/>  
       <arg value="java.util.concurrent.locks"/>  
615    
       <!--  
       <arg value="-help"/>  
       -->  
616    
617      </java>  
618      <target name="configure-compiler">
619        <fail message="ant version too old">
620          <condition> <not> <antversion atleast="1.9.1"/> </not> </condition>
621        </fail>
622    
623        <property name="unchecked.option" value="-Xlint:unchecked"/>
624    
625        <condition property="warnunchecked.arg" value="${unchecked.option}">
626          <istrue value="${build.warnunchecked}"/>
627        </condition>
628    
629        <property name="warnunchecked.arg" value=""/>
630    
631    
632        <!-- Common options in javac invocations -->
633        <property name="build.args" value="${warnunchecked.arg}"/>
634    
635    </target>    </target>
636    
637    
   <target name="strip"  
           depends="init, configure-compiler"  
           description="Strip generics from java source (not working yet)">  
638    
639      <mkdir dir="${build.stripped.dir}"/>    <!-- Various demos and test programs -->
640    
641      <!--  
642       # javac -s doesn't reliably generate compilable code. It generates    <!-- description="Benchmark from Doug Lea's AQS paper" -->
643       # bridge methods (marked as "synthetic") that can have identical    <target name="loops" depends="configure-compiler">
644       # signatures to existing methods except for the return value.  
645       -->      <mkdir dir="${build.loops.dir}"/>
646      <javac srcdir="${src.dir}"  
647            destdir="${build.stripped.dir}"      <javac srcdir="${loops.src.dir}"
648              destdir="${build.loops.dir}"
649              debug="${build.debug}"              debug="${build.debug}"
650         debuglevel="${build.debuglevel}"         debuglevel="${build.debuglevel}"
651        deprecation="${build.deprecation}"        deprecation="${build.deprecation}"
652             source="${build.sourcelevel}"             source="${build.sourcelevel}"
653               target="${build.sourcelevel}"
654             encoding="ASCII"
655               fork="true">               fork="true">
656    
657        <compilerarg    line="${gjc.args} -s"/>        <compilerarg line="${build.args}"/>
658  <!--        <classpath refid="loops.classpath"/>
659        <bootclasspath refid="compile.bootclasspath"/>        <compilerarg value="-XDignore.symbol.file=true"/>
 -->  
660    
661      </javac>      </javac>
662    
663        <java classname="ALoops" fork="true">
664          <classpath refid="loops.classpath"/>
665        </java>
666    
667    </target>    </target>
668    
669    
670    <target name="dist"    <target name="compile-test-loops" depends="jar"
671            depends="init, dist-clean, dist-jar, dist-docs"            description="compile all the perf tests in src/test/loops">
           description="Puts all distributable products in single hierarchy"/>  
672    
673    <target name="release"      <mkdir dir="${build.dir}/test/loops"/>
           depends="dist"  
           description="Puts entire CVS tree, plus distribution productions, in a jar">  
674    
675  <!--      <javac srcdir="${basedir}/src/test/loops"
676      #keep build dir? - dl             destdir="${build.dir}/test/loops"
677      <delete dir="${build.dir}"/>             debug="${build.debug}"
678  -->             debuglevel="${build.debuglevel}"
679      <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>             deprecation="${build.deprecation}"
680               includeAntRuntime="false"
681               includeJavaRuntime="false"
682               encoding="ASCII"
683               executable="${javac9}"
684               fork="true">
685    
686      <jar basedir="${basedir}" destfile="${release.jar}">        <include name="*.java"/>
687        <exclude name="${release.jar}"/>        <compilerarg value="-XDignore.symbol.file=true"/>
688        <exclude name="user.properties"/>        <compilerarg value="-Xlint:all,-unchecked,-rawtypes,-serial"/>
689        <exclude name="etc/notes/**"/>        <compilerarg value="-Xbootclasspath/p:${product.jar}"/>
690        <exclude name="lib/gjc/2.1/**"/>        <compilerarg line="${build.args}"/>
691        <exclude name="**/SyntaxTest.java"/>  
692      </jar>      </javac>
693    
694    </target>    </target>
695    
   <target name="clean"  
           description="Removes all build products">  
696    
697      <delete dir="${build.dir}"/>    <!-- jsr166 4jdk8 -->
     <delete dir="${build.classes.dir}"/>  
     <delete dir="${build.lib.dir}"/>  
698    
699    </target>    <target name="4jdk8compile"
700              depends="configure-compiler"
701              description="Compiles src/jdk8 sources, targeting jdk8">
702    
703        <mkdir dir="${build.4jdk8.classes.dir}"/>
704    
705    <target name="dist-clean"      <javac srcdir="${4jdk8src.dir}"
706            description="Removes all build and distribution products">             destdir="${build.4jdk8.classes.dir}"
707               debug="${build.debug}"
708               debuglevel="${build.debuglevel}"
709               deprecation="${build.deprecation}"
710               source="8"
711               target="8"
712               classpath=""
713               bootclasspath="${bootclasspath8}"
714               includeAntRuntime="false"
715               includeJavaRuntime="false"
716               encoding="ASCII"
717               executable="${javac8}"
718               fork="true">
719    
720      <delete dir="${dist.dir}"/>        <include name="**/*.java"/>
721          <compilerarg value="-Xprefer:source"/>
722          <compilerarg value="-XDignore.symbol.file=true"/>
723          <compilerarg value="-Xlint:all"/>
724          <compilerarg value="-Werror"/>
725          <compilerarg line="${build.args}"/>
726    
727        </javac>
728    </target>    </target>
729    
730      <target name="4jdk8doclint"
731              depends="configure-compiler"
732              description="Finds doclint warnings">
733    
734    <target name="dist-docs"      <mkdir dir="${build.4jdk8.classes.dir}"/>
           depends="filter-src"  
           description="Builds javadocs without custom tags to dist folder">  
735    
736      <delete dir="${dist.javadocs.dir}"/>      <javac srcdir="${4jdk8src.dir}"
737      <mkdir dir="${dist.javadocs.dir}"/>             destdir="${build.4jdk8.classes.dir}"
738               debug="${build.debug}"
739               debuglevel="${build.debuglevel}"
740               deprecation="${build.deprecation}"
741               source="8"
742               target="8"
743               classpath=""
744               bootclasspath="${bootclasspath8}"
745               includeAntRuntime="false"
746               includeJavaRuntime="false"
747               encoding="ASCII"
748               executable="${javac8}"
749               fork="true">
750    
751      <javadoc destdir="${dist.javadocs.dir}"        <include name="**/*.java"/>
752                  link="http://java.sun.com/j2se/1.4.1/docs/api"        <compilerarg value="-Xprefer:source"/>
753              overview="${src.dir}/intro.html"        <compilerarg value="-XDignore.symbol.file=true"/>
754                source="${build.docsourcelevel}">        <compilerarg value="-Xlint:all"/>
755          <compilerarg value="-Xdoclint:all/protected,reference/private"/>
756          <compilerarg line="${build.args}"/>
757    
758        <packageset dir="${build.filter.src.dir}"/>      </javac>
759      </target>
760    
761      </javadoc>  
762      <target name="4jdk8jar"
763              depends="4jdk8compile"
764              description="Builds library jar from compiled sources">
765    
766        <jar destfile="${4jdk8product.jar}">
767          <fileset dir="${build.4jdk8.classes.dir}"/>
768          <manifest>
769            <attribute name="Built-By" value="${user.name}"/>
770            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
771          </manifest>
772        </jar>
773    
774    </target>    </target>
775    
776    
777      <target name="4jdk8-tck"
778              depends="4jdk8jar"
779              description="Runs tck tests for jsr166-4jdk8 directly">
780    
781        <run-tck-tests
782          target="8"
783          workdir="${build.4jdk8.dir}"
784          classes="${4jdk8product.jar}">
785          <javac-elements>
786            <!-- JDK9+ test classes -->
787            <exclude name="*9Test.java"/>
788            <exclude name="*10Test.java"/>
789            <compilerarg value="-Werror"/>
790          </javac-elements>
791        </run-tck-tests>
792      </target>
793    
794    
795    <!-- Internal targets -->    <target name="4jdk8-jtreg"
796              depends="4jdk8jar"
797              description="Runs jtreg tests for jsr166-4jdk8 using the jtreg ant task">
798        <run-jtreg-tests
799           target="8"
800           workdir="${build.4jdk8.dir}"
801           classes="${4jdk8product.jar}"/>
802      </target>
803    
804    
805    <target name="init">    <target name="4jdk8-test"
806              depends="4jdk8-tck, 4jdk8-jtreg"
807              description="Runs tck and jtreg tests for jsr166-4jdk8">
808      </target>
809    
     <!-- Version is kept in a separate file -->  
     <loadfile property="version" srcFile="version.properties"/>  
     <echo>Building JSR-166 version ${version}</echo>  
     <echo>java.home is ${java.home}</echo>  
810    
811      <target name="4jdk8docs"
812              description="Builds javadocs for src/jdk8 to dist dir">
813    
814        <delete dir="${4jdk8docs.dir}"/>
815        <mkdir dir="${4jdk8docs.dir}"/>
816    
817        <javadoc destdir="${4jdk8docs.dir}"
818                 packagenames="none"
819                 link="${java8.api.url}"
820                 overview="${4jdk8src.dir}/intro.html"
821                 access="${build.javadoc.access}"
822                 sourcepath="${4jdk8src.dir}:${jdk8.src.dir}"
823                 classpath=""
824                 executable="${javadoc8}"
825                 failonerror = "true">
826          <fileset dir="${4jdk8src.dir}" defaultexcludes="yes">
827            <include name="**/*.java"/>
828          </fileset>
829          <arg line="-Xdocrootparent ${java8.docroot.url}"/>
830          <arg value="-XDignore.symbol.file=true"/>
831          <arg value="-tag"/>
832          <arg value="${javadoc.jls.option}"/>
833    <!-- @apiNote currently unused -->
834    <!--       <arg value="-tag"/> -->
835    <!--       <arg value="apiNote:a:&lt;em&gt;API Note:&lt;/em&gt;"/> -->
836          <arg value="-tag"/>
837          <arg value="implSpec:a:&lt;em&gt;Implementation Requirements:&lt;/em&gt;"/>
838          <arg value="-tag"/>
839          <arg value="implNote:a:&lt;em&gt;Implementation Note:&lt;/em&gt;"/>
840        </javadoc>
841    </target>    </target>
842    
843    
844    <target name="init-jar">    <target name="4jdk8dist"
845              depends="4jdk8dist-jar, 4jdk8dist-docs"
846              description="Puts all distributable products in single hierarchy"/>
847    
848    
849      <target name="4jdk8clean"
850              description="Removes all 4jdk8 build products">
851    
852      <mkdir dir="${build.lib.dir}"/>      <delete dir="${build.4jdk8.dir}"/>
853    
854    </target>    </target>
855    
856    
857    <target name="native-jar"    <target name="4jdk8dist-jar"
858            depends="compile"            depends="4jdk8clean, 4jdk8jar">
859            unless="build.emulation.true">      <copy file="${4jdk8product.jar}" todir="${dist.dir}"/>
860      </target>
861    
     <jar destfile="${product.jar}">  
       <fileset dir="${build.classes.dir}"/>  
     </jar>  
862    
863      <target name="4jdk8dist-docs"
864              depends="4jdk8clean, 4jdk8docs">
865        <mirror-dir src="${4jdk8docs.dir}" dst="${dist.4jdk8docs.dir}"/>
866    </target>    </target>
867    
868    
   <target name="compile-emulation"  
           depends="init, configure-compiler"  
           if="build.emulation.true">  
869    
870      <mkdir dir="${build.emulation.dir}"/>    <!-- jsr166 4jdk7 -->
871    
872      <target name="4jdk7compile"
873              depends="configure-compiler"
874              description="Compiles src/jdk7 sources, targeting jdk7">
875    
876        <mkdir dir="${build.4jdk7.classes.dir}"/>
877    
878      <javac srcdir="${emulation.src.dir}"      <javac srcdir="${4jdk7src.dir}"
879            destdir="${build.emulation.dir}"             destdir="${build.4jdk7.classes.dir}"
880              debug="${build.debug}"              debug="${build.debug}"
881         debuglevel="${build.debuglevel}"         debuglevel="${build.debuglevel}"
882        deprecation="${build.deprecation}"        deprecation="${build.deprecation}"
883             source="${build.sourcelevel}"             source="6"
884               target="6"
885               classpath=""
886               bootclasspath="${bootclasspath6}"
887               includeAntRuntime="false"
888               includeJavaRuntime="false"
889               encoding="ASCII"
890               executable="${javac7}"
891               fork="true">               fork="true">
892    
893        <compilerarg    line="${gjc.args}"/>        <include name="**/*.java"/>
894  <!--        <compilerarg value="-Xprefer:source"/>
895        <bootclasspath refid="compile.bootclasspath"/>        <compilerarg value="-XDignore.symbol.file=true"/>
896  -->        <compilerarg value="-Xlint:all"/>
897          <compilerarg value="-Werror"/>
898          <compilerarg line="${build.args}"/>
899    
900      </javac>      </javac>
   
901    </target>    </target>
902    
903      <target name="4jdk7doclint"
904              depends="configure-compiler"
905              description="Finds doclint warnings">
906    
907    <target name="emulation-jar"      <mkdir dir="${build.4jdk7.classes.dir}"/>
           depends="compile-emulation"  
           if="build.emulation.true">  
908    
909        <javac srcdir="${4jdk7src.dir}"
910               destdir="${build.4jdk7.classes.dir}"
911               debug="${build.debug}"
912               debuglevel="${build.debuglevel}"
913               deprecation="${build.deprecation}"
914               source="6"
915               target="6"
916               classpath=""
917               bootclasspath="${bootclasspath6}"
918               includeAntRuntime="false"
919               includeJavaRuntime="false"
920               encoding="ASCII"
921               executable="${javac8}"
922               fork="true">
923    
924      <jar destfile="${product.jar}" duplicate="add">        <include name="**/*.java"/>
925        <fileset dir="${build.classes.dir}">        <compilerarg value="-Xprefer:source"/>
926          <patternset refid="atomic.exclusion"/>        <compilerarg value="-XDignore.symbol.file=true"/>
927          <patternset refid="unsafe.exclusion"/>        <compilerarg value="-Xlint:all"/>
928        </fileset>        <compilerarg value="-Xdoclint:all/protected"/>
929        <fileset dir="${build.emulation.dir}"/>        <compilerarg line="${build.args}"/>
     </jar>  
930    
931        </javac>
932    </target>    </target>
933    
934    
935    <target name="dist-jar"    <target name="4jdk7jar"
936            depends="clean, jar">            depends="4jdk7compile"
937              description="Builds library jar from compiled sources">
938    
939        <jar destfile="${4jdk7product.jar}">
940          <fileset dir="${build.4jdk7.classes.dir}"/>
941          <manifest>
942            <attribute name="Built-By" value="${user.name}"/>
943            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
944          </manifest>
945        </jar>
946    
947      </target>
948    
     <copy file="${product.jar}" todir="${dist.dir}"/>  
949    
950      <target name="4jdk7-tck"
951              depends="4jdk7jar"
952              description="Runs tck tests for jsr166-4jdk7 directly">
953    
954        <run-tck-tests
955          target="7"
956          workdir="${build.4jdk7.dir}"
957          classes="${4jdk7product.jar}">
958          <javac-elements>
959            <!-- JDK8+ test classes -->
960            <exclude name="*8Test.java"/>
961            <exclude name="*9Test.java"/>
962            <exclude name="*10Test.java"/>
963            <exclude name="DoubleAccumulatorTest.java"/>
964            <exclude name="DoubleAdderTest.java"/>
965            <exclude name="LongAccumulatorTest.java"/>
966            <exclude name="LongAdderTest.java"/>
967            <exclude name="CompletableFutureTest.java"/>
968            <exclude name="SplittableRandomTest.java"/>
969            <exclude name="StampedLockTest.java"/>
970            <exclude name="SubmissionPublisherTest.java"/>
971            <compilerarg value="-Werror"/>
972          </javac-elements>
973        </run-tck-tests>
974    </target>    </target>
975    
976    
977    <target name="compile-ant-filter"    <!-- Runs tck tests for jsr166-4jdk7 via junit task (dead experiment) -->
978            depends="init">    <target name="4jdk7-tck-junit"
979              depends="4jdk7compile">
980    
981      <mkdir dir="${build.ant.dir}"/>      <junit printsummary="true"
982               showoutput="true"
983               errorProperty="junit.failed"
984               failureProperty="junit.failed"
985               includeantruntime="true"
986               jvm="${java7}"
987               fork="true">
988    
989          <jvmarg value="-Xbootclasspath/p:${4jdk7product.jar}"/>
990          <jvmarg value="-server"/>
991    
992          <classpath>
993            <pathelement location="${junit.jar}"/>
994            <pathelement location="${build.4jdk7.tck.classes.dir}"/>
995          </classpath>
996    
997      <javac srcdir="${ant.src.dir}"        <formatter type="brief"/>
           destdir="${build.ant.dir}"  
            source="1.4"  
     />  
998    
999          <test name="${jsr166.tckTestClass}" haltonfailure="no">
1000          </test>
1001    
1002        </junit>
1003    </target>    </target>
1004    
1005      <target name="4jdk7-jtreg"
1006              depends="4jdk7jar"
1007              description="Runs jtreg tests for jsr166-4jdk7 using the jtreg ant task">
1008        <run-jtreg-tests
1009           target="7"
1010           workdir="${build.4jdk7.dir}"
1011           classes="${4jdk7product.jar}"/>
1012      </target>
1013    
   <target name="filter-src"  
           depends="compile-ant-filter">  
1014    
1015      <mkdir dir="${build.filter.src.dir}"/>    <target name="4jdk7-test"
1016              depends="4jdk7-tck, 4jdk7-jtreg"
1017              description="Runs tck and jtreg tests for jsr166-4jdk7">
1018      </target>
1019    
     <copy todir="${build.filter.src.dir}">  
       <fileset dir="${src.dir}">  
         <include name="**/*.html"/>  
       </fileset>  
     </copy>  
1020    
1021      <copy todir="${build.filter.src.dir}">    <target name="4jdk7docs"
1022        <fileset dir="${src.dir}">            description="Builds javadocs for src/jdk7 to dist dir">
1023          <exclude name="**/*.html"/>  
1024          <patternset refid="unsafe.exclusion"/>      <delete dir="${4jdk7docs.dir}"/>
1025        <mkdir dir="${4jdk7docs.dir}"/>
1026    
1027        <javadoc destdir="${4jdk7docs.dir}"
1028                 packagenames="none"
1029                 link="${java7.api.url}"
1030                 overview="${4jdk7src.dir}/intro.html"
1031                 access="${build.javadoc.access}"
1032                 sourcepath="${4jdk7src.dir}:${jdk7.src.dir}"
1033                 classpath=""
1034                 executable="${javadoc7}"
1035                 failonerror = "true">
1036          <fileset dir="${4jdk7src.dir}" defaultexcludes="yes">
1037            <include name="**/*.java"/>
1038        </fileset>        </fileset>
1039        <filterchain>        <arg line="-Xdocrootparent ${java7.docroot.url}"/>
1040          <arg value="-XDignore.symbol.file=true"/>
1041        </javadoc>
1042      </target>
1043    
         <!--  
          # This filter gets rid of angle-bracketed type parameters  
          # so that javadoc can run on the result. The following  
          # heuristic seems to work:  
          #  
          # For all lines not starting with space(s)-asterisk-space(s),  
          #   replace <something> with a space, where there may be more  
          #   than one right angle bracket at the end, and "something"  
          #   must not contain parens or pipes. (This may need some  
          #   tweaking.)  
          -->  
1044    
1045          <filterreader classname="jsr166.ant.filters.ReplaceFilter"    <target name="4jdk7dist"
1046                        classpath="${build.ant.dir}">            depends="4jdk7dist-jar, 4jdk7dist-docs"
1047            <param name="notmatching" value="^\s+\*\s.*$"/>            description="Puts all distributable products in single hierarchy"/>
           <param name="pattern"     value="&lt;[^|>()]+?>+"/>  
           <param name="replacement" value=" "/>  
         </filterreader>  
1048    
1049    
1050          <!--    <target name="4jdk7clean"
1051           # This filter uncomments lines beginning with "//@" so that            description="Removes all 4jdk7 build products">
          # javadoc can see imports that are needed to resolve links  
          # but that shouldn't be in the compiled code.  
          -->  
1052    
1053          <filterreader classname="jsr166.ant.filters.ReplaceFilter"      <delete dir="${build.4jdk7.dir}"/>
                       classpath="${build.ant.dir}">  
           <param name="matching"    value="^//@.*$"/>  
           <param name="pattern"     value="^//@"/>  
           <param name="replacement" value=""/>  
         </filterreader>  
       </filterchain>  
     </copy>  
1054    
1055    </target>    </target>
1056    
1057    
1058      <target name="4jdk7dist-jar"
1059              depends="4jdk7clean, 4jdk7jar">
1060        <copy file="${4jdk7product.jar}" todir="${dist.dir}"/>
1061      </target>
1062    
1063    
1064    <target name="filter-doccheck"    <target name="4jdk7dist-docs"
1065            depends="filter-src">            depends="4jdk7clean, 4jdk7docs">
1066        <mirror-dir src="${4jdk7docs.dir}" dst="${dist.4jdk7docs.dir}"/>
1067      </target>
1068    
     <mkdir dir="${build.filter.doccheck.dir}"/>  
1069    
1070      <copy todir="${build.filter.doccheck.dir}">    <!-- jsr166x -->
       <fileset dir="${build.filter.src.dir}">  
         <include name="**/*.html"/>  
       </fileset>  
     </copy>  
1071    
1072      <property name="generic.declarations"    <target name="jsr166xcompile"
1073               value="/** Fake type parameter. */ public interface E {} /** Fake type parameter. */ public interface T {} /** Fake type parameter. */ public interface K {} /** Fake type parameter. */ public interface V {}"            depends="configure-compiler"
1074      />            description="Compiles jsr166x sources to build dir">
   
     <copy todir="${build.filter.doccheck.dir}">  
       <fileset dir="${build.filter.src.dir}">  
         <exclude name="**/*.html"/>  
       </fileset>  
       <filterchain>  
         <!--  
          # These two filters try to make the source look like  
          # something that doccheck can process. The first removes  
          # -source 1.4 assertions and the second adds in a bunch  
          # of single letter public nested marker interfaces so that  
          # the generic type parameters are recognized.  
          -->  
1075    
1076          <filterreader classname="jsr166.ant.filters.ReplaceFilter"      <mkdir dir="${build.jsr166x.classes.dir}"/>
                       classpath="${build.ant.dir}">  
           <param name="matching"    value="^\s*assert[\s ].*$"/>  
           <param name="pattern"     value="assert"/>  
           <param name="replacement" value="//assert"/>  
         </filterreader>  
   
         <filterreader classname="jsr166.ant.filters.ReplaceFilter"  
                       classpath="${build.ant.dir}">  
           <param name="matching"    value="^([^*]*(class|interface|implements) .*|)\{.*$"/>  
           <param name="pattern"     value="$"/>  
           <param name="replacement" value=" ${generic.declarations}"/>  
         </filterreader>  
1077    
1078        </filterchain>      <javac srcdir="${topsrc.dir}"
1079      </copy>             destdir="${build.jsr166x.classes.dir}"
1080               debug="${build.debug}"
1081               debuglevel="${build.debuglevel}"
1082               deprecation="${build.deprecation}"
1083               classpath=""
1084               bootclasspath="${bootclasspath6}"
1085               source="5"
1086               target="5"
1087               includeAntRuntime="false"
1088               includeJavaRuntime="false"
1089               encoding="ASCII"
1090               executable="${javac7}"
1091               fork="true">
1092    
1093          <include name="jsr166x/**/*.java"/>
1094          <compilerarg value="-XDignore.symbol.file=true"/>
1095          <compilerarg value="-Xlint:all,-unchecked,-rawtypes"/>
1096          <compilerarg value="-Werror"/>
1097          <compilerarg line="${build.args}"/>
1098    
1099        </javac>
1100    </target>    </target>
1101    
1102    
1103    <target name="compile-tests"    <target name="jsr166xjar"
1104            depends="jar">            depends="jsr166xcompile"
1105              description="Builds library jar from compiled sources">
1106    
1107        <jar destfile="${jsr166x.jar}">
1108          <fileset dir="${build.jsr166x.classes.dir}"/>
1109          <manifest>
1110            <attribute name="Built-By" value="${user.name}"/>
1111            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
1112          </manifest>
1113        </jar>
1114    
1115      <mkdir dir="${build.testcases.dir}"/>    </target>
1116    
 <!--  
     <echo>javac ${gjc.args}</echo>  
     <echo>bootclasspath=${test.compile.bootclasspath}</echo>  
     <echo>classpath="${test.classpath}"</echo>  
 -->  
1117    
1118      <javac srcdir="${test.src.dir}"    <target name="jsr166xdocs"
1119            destdir="${build.testcases.dir}"            description="Builds javadocs to dist dir">
1120    
1121        <delete dir="${jsr166xdocs.dir}"/>
1122        <mkdir dir="${jsr166xdocs.dir}"/>
1123    
1124        <javadoc destdir="${jsr166xdocs.dir}"
1125                 packagenames="jsr166x.*"
1126                 link="${java.api.url}"
1127                 access="${build.javadoc.access}"
1128                 sourcepath="${topsrc.dir}:${jdk6.src.dir}"
1129                 bootclasspath="${bootclasspath6}"
1130                 source="5"
1131                 executable="${javadoc7}"
1132                 failonerror = "true">
1133          <arg line="-Xdocrootparent ${java.docroot.url}"/>
1134          <arg value="-XDignore.symbol.file=true"/>
1135    
1136        </javadoc>
1137      </target>
1138    
1139    
1140      <target name="jsr166xdist"
1141              depends="jsr166xdist-jar, jsr166xdist-docs"
1142              description="Puts all distributable products in single hierarchy"/>
1143    
1144    
1145      <target name="jsr166xclean"
1146              description="Removes all jsr166x build products">
1147    
1148        <delete dir="${build.jsr166x.dir}"/>
1149    
1150      </target>
1151    
1152    
1153      <target name="jsr166xdist-jar"
1154              depends="jsr166xclean, jsr166xjar">
1155        <copy file="${jsr166x.jar}" todir="${dist.dir}"/>
1156      </target>
1157    
1158      <target name="jsr166xdist-docs"
1159              depends="jsr166xclean, jsr166xdocs">
1160        <mirror-dir src="${jsr166xdocs.dir}" dst="${dist.jsr166xdocs.dir}"/>
1161      </target>
1162    
1163      <!-- jsr166y -->
1164    
1165    
1166      <target name="jsr166ycompile"
1167              depends="configure-compiler"
1168              description="Compiles jsr166y sources">
1169    
1170        <mkdir dir="${build.jsr166y.classes.dir}"/>
1171    
1172        <javac srcdir="${topsrc.dir}"
1173               destdir="${build.jsr166y.classes.dir}"
1174              debug="${build.debug}"              debug="${build.debug}"
1175         debuglevel="${build.debuglevel}"         debuglevel="${build.debuglevel}"
1176        deprecation="${build.deprecation}"        deprecation="${build.deprecation}"
1177             source="${build.sourcelevel}"             source="6"
1178               target="6"
1179               classpath=""
1180               bootclasspath="${bootclasspath6}"
1181               includeAntRuntime="false"
1182               includeJavaRuntime="false"
1183               encoding="ASCII"
1184               executable="${javac7}"
1185               fork="true">               fork="true">
1186    
1187        <compilerarg    line="${gjc.args}"/>        <include name="jsr166y/**/*.java"/>
1188  <!--        <compilerarg value="-XDignore.symbol.file=true"/>
1189        <bootclasspath refid="test.compile.bootclasspath"/>        <compilerarg value="-Xlint:all"/>
1190  -->        <compilerarg value="-Werror"/>
1191        <classpath     refid="test.classpath"/>        <compilerarg line="${build.args}"/>
   
       <include name="java/**"/>  
       <include name="jsr166/**"/>  
1192    
1193      </javac>      </javac>
1194      </target>
1195    
1196    
1197      <target name="jsr166yjar"
1198              depends="jsr166ycompile"
1199              description="Builds library jar from compiled sources">
1200    
1201        <jar destfile="${jsr166y.jar}" index="true">
1202          <fileset dir="${build.jsr166y.classes.dir}"/>
1203          <manifest>
1204            <attribute name="Built-By" value="${user.name}"/>
1205            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
1206          </manifest>
1207        </jar>
1208    
1209    </target>    </target>
1210    
1211    
1212    <target name="run-tests"    <target name="jsr166ydocs"
1213            depends="compile-tests">            description="Builds javadocs to dist dir">
1214    
1215      <!-- May be overridden by user.properties -->      <delete dir="${jsr166ydocs.dir}"/>
1216      <property name="testcase" value="*"/>      <mkdir dir="${jsr166ydocs.dir}"/>
1217    
1218      <mkdir dir="${build.reports.dir}"/>      <javadoc destdir="${jsr166ydocs.dir}"
1219                 packagenames="jsr166y.*"
1220                 link="${java.api.url}"
1221                 access="${build.javadoc.access}"
1222                 sourcepath="${topsrc.dir}:${jdk6.src.dir}"
1223                 bootclasspath="${bootclasspath6}"
1224                 source="6"
1225                 executable="${javadoc7}"
1226                 failonerror = "true">
1227          <arg line="-Xdocrootparent ${java.docroot.url}"/>
1228          <arg value="-XDignore.symbol.file=true"/>
1229    
1230      <junit printsummary="true"      </javadoc>
1231               showoutput="true"    </target>
           errorProperty="junit.failed"  
         failureProperty="junit.failed"  
                     dir="${build.reports.dir}"  
                    fork="true">  
1232    
       <jvmarg value="-Xbootclasspath:${test.run.bootclasspath}"/>  
1233    
1234        <formatter type="xml"/>    <target name="jsr166ydist"
1235              depends="jsr166ydist-jar, jsr166ydist-docs"
1236              description="Puts all distributable products in single hierarchy"/>
1237    
       <batchtest todir="${build.reports.dir}">  
         <fileset dir="${test.src.dir}">  
           <include name="java/**/${testcase}Test.java"/>  
           <include name="jsr166/**/${testcase}Test.java"/>  
         </fileset>  
       </batchtest>  
1238    
1239      </junit>    <target name="jsr166yclean"
1240              description="Removes all jsr166y build products">
1241    
1242        <delete dir="${build.jsr166y.dir}"/>
1243    
1244      </target>
1245    
1246    
1247      <target name="jsr166ydist-jar"
1248              depends="jsr166yclean, jsr166yjar">
1249        <copy file="${jsr166y.jar}" todir="${dist.dir}"/>
1250    </target>    </target>
1251    
1252      <target name="jsr166ydist-docs"
1253              depends="jsr166yclean, jsr166ydocs">
1254        <mirror-dir src="${jsr166ydocs.dir}" dst="${dist.jsr166ydocs.dir}"/>
1255      </target>
1256    
   <target name="report-tests"  
           depends="run-tests">  
1257    
1258      <!-- Sets junit.report.format to frames if redirection is present,    <!-- extra166y -->
          otherwise sets it to noframes. -->  
     <available property="junit.report.format"  
                   value="frames"  
               classname="org.apache.xalan.lib.Redirect"  
     />  
     <property name="junit.report.format" value="noframes"/>  
   
     <junitreport todir="${build.reports.dir}">  
       <fileset dir="${build.reports.dir}">  
         <include name="TEST-*.xml"/>  
       </fileset>  
       <report styledir="${stylesheet.dir}"  
                 format="${junit.report.format}"  
                  todir="${build.reports.dir}"  
       />  
     </junitreport>  
1259    
     <fail message="Test Cases Failed" if="junit.failed"/>  
1260    
1261    </target>    <target name="extra166ycompile"
1262              depends="configure-compiler, jsr166yjar"
1263              description="Compiles extra166y sources">
1264    
1265        <mkdir dir="${build.extra166y.classes.dir}"/>
1266    
1267    <target name="configure-compiler">      <javac srcdir="${topsrc.dir}"
1268               destdir="${build.extra166y.classes.dir}"
1269               debug="${build.debug}"
1270               debuglevel="${build.debuglevel}"
1271               deprecation="${build.deprecation}"
1272               bootclasspath="@{jsr166y.jar}:${bootclasspath6}"
1273               classpath=""
1274               source="6"
1275               target="6"
1276               includeAntRuntime="false"
1277               includeJavaRuntime="false"
1278               encoding="ASCII"
1279               executable="${javac7}"
1280               fork="true">
1281    
1282      <property name="gjc.version"        <include name="extra166y/**/*.java"/>
1283               value="2.2"/>        <compilerarg value="-XDignore.symbol.file=true"/>
1284          <compilerarg value="-Xlint:all,-unchecked,-rawtypes,-serial"/>
1285          <compilerarg value="-Werror"/>
1286          <compilerarg line="${build.args}"/>
1287    
1288      <condition property="novariance.arg" value="-novariance">      </javac>
1289        <and>    </target>
         <equals arg1="${gjc.version}" arg2="2.0"/>  
         <or>  
           <not><isset property="gjc.novariance"/></not>  
           <istrue value="${gjc.novariance}"/>  
         </or>  
       </and>  
     </condition>  
1290    
     <property name="novariance.arg"  
              value=""/>  
1291    
1292      <property name="gjc.dir"    <target name="extra166yjar"
1293               value="${lib.dir}/gjc"/>            depends="extra166ycompile"
1294              description="Builds library jar from compiled sources">
1295    
1296        <jar destfile="${extra166y.jar}" index="true">
1297          <fileset dir="${build.extra166y.classes.dir}"/>
1298          <manifest>
1299            <attribute name="Built-By" value="${user.name}"/>
1300            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
1301          </manifest>
1302        </jar>
1303    
1304      <property name="javac.jar"    </target>
           location="${gjc.dir}/${gjc.version}/javac.jar"/>  
1305    
     <property name="collect.jar"  
           location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/>  
1306    
1307  <!--    <target name="extra166ydocs"
1308      <property name="unchecked.option" value="-warnunchecked"/>            description="Builds javadocs to build dir">
 -->  
1309    
1310      <property name="unchecked.option" value="-Xlint:unchecked"/>      <delete dir="${extra166ydocs.dir}"/>
1311        <mkdir dir="${extra166ydocs.dir}"/>
1312    
1313      <condition property="warnunchecked.arg" value="${unchecked.option}">      <javadoc destdir="${extra166ydocs.dir}"
1314        <istrue value="${gjc.warnunchecked}"/>               packagenames="extra166y.*"
1315      </condition>               link="${java.api.url}"
1316                 access="${build.javadoc.access}"
1317                 sourcepath="${topsrc.dir}:${jdk6.src.dir}"
1318                 bootclasspath="${bootclasspath6}"
1319                 source="6"
1320                 executable="${javadoc7}">
1321          <arg line="-Xdocrootparent ${java.docroot.url}"/>
1322          <arg value="-XDignore.symbol.file=true"/>
1323    
1324      <property name="warnunchecked.arg" value=""/>      </javadoc>
1325      </target>
1326    
     <condition property="prepare.src.dir" value="${build.dir}/prepare-src">  
       <istrue value="${build.nothreads}"/>  
     </condition>  
1327    
1328      <target name="extra166ydist"
1329              depends="extra166ydist-jar, extra166ydist-docs"
1330              description="Puts all distributable products in single hierarchy"/>
1331    
     <!--  
      ! Bootclasspath munging for source compilation.  
      -->  
1332    
1333      <path id="pre.bootclasspath">    <target name="extra166yclean"
1334  <!--            description="Removes all extra166y build products">
       <pathelement location="${javac.jar}"/>  
 -->  
     </path>  
1335    
1336      <path id="compile.bootclasspath">      <delete dir="${build.extra166y.dir}"/>
       <pathelement location="${build.classes.dir}"/>  
 <!--  
       <pathelement location="${collect.jar}"/>  
 -->  
       <pathelement location="${rt.jar}"/>  
     </path>  
1337    
1338      <!-- Flatten paths into platform-appropriate strings -->    </target>
     <property name="pre.bootclasspath"     refid="pre.bootclasspath"/>  
     <property name="compile.bootclasspath" refid="compile.bootclasspath"/>  
1339    
1340    
1341      <!-- Common options in javac invocations -->    <target name="extra166ydist-jar"
1342  <!--            depends="extra166yclean, extra166yjar">
1343      <property name="gjc.args"      <copy file="${extra166y.jar}" todir="${dist.dir}"/>
1344               value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}"    </target>
     />  
 -->  
     <property name="gjc.args" value="${warnunchecked.arg} ${novariance.arg}"/>  
1345    
1346      <target name="extra166ydist-docs"
1347              depends="extra166yclean, extra166ydocs">
1348        <mirror-dir src="${extra166ydocs.dir}" dst="${dist.extra166ydocs.dir}"/>
1349    </target>    </target>
1350    
1351      <!-- jsr166e -->
1352    
1353      <property name="build.jsr166e.java.version" value="6"/>
1354      <property name="build.jsr166e.javac" value="${javac6}"/>
1355    
1356    <target name="prepare-src"    <target name="jsr166ecompile"
1357            depends="configure-compiler"            depends="configure-compiler"
1358            if="prepare.src.dir">            description="Compiles jsr166e sources">
1359    
1360      <mkdir dir="${prepare.src.dir}"/>      <mkdir dir="${build.jsr166e.classes.dir}"/>
1361      <copy todir="${prepare.src.dir}">  
1362        <fileset dir="${src.dir}">      <javac srcdir="${topsrc.dir}"
1363          <exclude name="java/lang/**"/>             destdir="${build.jsr166e.classes.dir}"
1364        </fileset>             debug="${build.debug}"
1365      </copy>             debuglevel="${build.debuglevel}"
1366               deprecation="${build.deprecation}"
1367               source="${build.jsr166e.java.version}"
1368               target="${build.jsr166e.java.version}"
1369               classpath=""
1370               includeAntRuntime="false"
1371               includeJavaRuntime="false"
1372               executable="${build.jsr166e.javac}"
1373               fork="true">
1374    
1375          <include name="jsr166e/**/*.java"/>
1376          <compilerarg value="-XDignore.symbol.file=true"/>
1377          <compilerarg value="-Xlint:all"/>
1378          <compilerarg value="-Werror"/>
1379          <compilerarg line="${build.args}"/>
1380    
1381        </javac>
1382    </target>    </target>
1383    
1384      <!-- jsr166e: find doclint errors -->
1385      <target name="jsr166edoclint">
1386    
1387    <target name="configure-emulation">      <mkdir dir="${build.jsr166e.classes.dir}"/>
1388    
1389      <condition property="build.emulation.true">      <javac srcdir="${topsrc.dir}"
1390        <istrue value="${build.emulation}"/>             destdir="${build.jsr166e.classes.dir}"
1391      </condition>             debug="${build.debug}"
1392               debuglevel="${build.debuglevel}"
1393               deprecation="${build.deprecation}"
1394               source="${build.jsr166e.java.version}"
1395               target="${build.jsr166e.java.version}"
1396               classpath=""
1397               bootclasspath="${bootclasspath6}"
1398               includeAntRuntime="false"
1399               includeJavaRuntime="false"
1400               executable="${javac8}"
1401               fork="true">
1402    
1403          <include name="jsr166e/**/*.java"/>
1404          <compilerarg value="-XDignore.symbol.file=true"/>
1405          <compilerarg value="-Xlint:all"/>
1406          <compilerarg value="-Werror"/>
1407          <compilerarg value="-Xdoclint:all/protected"/>
1408    
1409        </javac>
1410    </target>    </target>
1411    
1412    
1413    <target name="configure-tests"    <target name="jsr166ejar"
1414         depends="configure-compiler">            depends="jsr166ecompile"
1415              description="Builds library jar from compiled sources">
1416    
1417        <jar destfile="${jsr166e.jar}" index="true">
1418          <fileset dir="${build.jsr166e.classes.dir}"/>
1419          <manifest>
1420            <attribute name="Built-By" value="${user.name}"/>
1421            <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
1422          </manifest>
1423        </jar>
1424    
1425      <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->    </target>
     <available property="junit.available"  
                classname="junit.framework.Protectable"/>  
   
     <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"  
           unless="junit.available"/>  
   
     <!-- Xalan -->  
     <available property="xalan.available"  
                classname="org.apache.xalan.Version"/>  
1426    
     <fail message="Need Xalan 2.5.1 jar in ${ant.home}${file.separator}lib to run tests"  
           unless="xalan.available"/>  
1427    
1428      <target name="jsr166edocs"
1429              description="Builds javadocs to build dir">
1430    
1431      <!--      <delete dir="${jsr166edocs.dir}"/>
1432       ! Bootclasspath munging for testing, so JUnit can test our local      <mkdir dir="${jsr166edocs.dir}"/>
      ! modifications to java.*.  
      -->  
1433    
1434      <path id="test.classpath">      <javadoc destdir="${jsr166edocs.dir}"
1435        <pathelement location="${product.jar}"/>               packagenames="jsr166e.*"
1436        <pathelement location="${rt.jar}"/>               link="${java.api.url}"
1437        <pathelement location="${build.testcases.dir}"/>               access="${build.javadoc.access}"
1438        <pathelement location="${junit.jar}"/>               sourcepath="${topsrc.dir}:${jdk6.src.dir}"
1439      </path>               source="${build.jsr166e.java.version}"
1440                 executable="${javadoc7}"
1441                 failonerror = "true">
1442          <arg line="-Xdocrootparent ${java.docroot.url}"/>
1443          <arg value="-XDignore.symbol.file=true"/>
1444    
1445      <path id="test.compile.bootclasspath">      </javadoc>
1446        <pathelement location="${javac.jar}"/>    </target>
       <pathelement location="${collect.jar}"/>  
       <pathelement location="${rt.jar}"/>  
     </path>  
1447    
     <path id="test.run.bootclasspath">  
 <!--  
       <pathelement location="${javac.jar}"/>  
 -->  
       <path refid="test.classpath"/>  
     </path>  
1448    
1449      <!-- Flatten test classpaths into platform-appropriate strings -->    <target name="jsr166e-tck-one-java-version"
1450      <property name="test.classpath"             refid="test.classpath"/>            depends="jsr166ejar">
     <property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/>  
     <property name="test.run.bootclasspath"     refid="test.run.bootclasspath"/>  
1451    
1452        <echo message="Testing with jdk${build.jsr166e.java.version} ..."/>
1453    
1454        <run-tck-tests
1455          tck.src.dir="${test.src.dir}/tck-jsr166e"
1456          target="${build.jsr166e.java.version}"
1457          workdir="${build.jsr166e.dir}"
1458          classes="${jsr166e.jar}"/>
1459    </target>    </target>
1460    
1461      <target name="jsr166e-tck"
1462              description="Runs tck tests for jsr166e for multiple java versions">
1463    
1464    <!--     <antcall target="clean"/> -->
1465    <!--     <antcall target="jsr166e-tck-one-java-version"> -->
1466    <!--       <param name="build.jsr166e.java.version" value="8"/> -->
1467    <!--       <param name="build.jsr166e.javac" value="${javac8}"/> -->
1468    <!--     </antcall> -->
1469    
1470    <!-- Anthill targets -->      <antcall target="clean"/>
1471        <antcall target="jsr166e-tck-one-java-version">
1472          <param name="build.jsr166e.java.version" value="7"/>
1473          <param name="build.jsr166e.javac" value="${javac7}"/>
1474        </antcall>
1475    
1476    <target name="anthill-build">      <antcall target="clean"/>
1477        <antcall target="jsr166e-tck-one-java-version">
1478          <param name="build.jsr166e.java.version" value="6"/>
1479          <param name="build.jsr166e.javac" value="${javac6}"/>
1480        </antcall>
1481      </target>
1482    
     <!-- Override this in user.properties -->  
     <property name="tiger.home" location="e:/j2sdk1.5.0"/>  
1483    
1484      <exec resultproperty="result.property" dir="${basedir}" executable="${tiger.home}/bin/java">    <target name="jsr166e-test"
1485        <arg value="-Xmx256000000"/>            depends="jsr166e-tck"
1486        <!-- classpath of new JVM -->            description="Runs all tests for jsr166e">
       <arg value="-classpath"/> <arg path="${java.class.path}"/>  
       <!-- location of Ant home directory -->  
       <arg value="-Dant.home=${ant.home}"/>  
       <!-- the Ant main class -->  
       <arg value="org.apache.tools.ant.Main"/>  
       <!-- The build file -->  
       <arg value="-buildfile"/>  <arg value="build.xml"/>  
       <!-- the target to build on the new Ant instance -->  
       <arg value="-DJAVA_HOME=${tiger.home}"/>  
       <arg value="do-anthill-build"/>  
     </exec>  
1487    </target>    </target>
1488    
1489    <target name="do-anthill-build"    <target name="jsr166edist"
1490            depends="jar, test, docs, dist-docs"/>            depends="jsr166edist-jar, jsr166edist-docs"
1491              description="Puts all distributable products in single hierarchy"/>
   <target name="anthill-publish">  
1492    
     <copy todir="${deployDir}/docs/private">  
       <fileset dir="${build.javadocs.dir}"/>  
     </copy>  
1493    
1494      <copy todir="${deployDir}/docs/public">    <target name="jsr166eclean"
1495        <fileset dir="${dist.javadocs.dir}"/>            description="Removes all jsr166e build products">
1496      </copy>      <delete dir="${build.jsr166e.dir}"/>
1497      </target>
1498    
     <copy tofile="${deployDir}/index.html"  
           file="${basedir}/etc/anthill-index.html"/>  
1499    
1500      <copy todir="${deployDir}/notes">    <target name="jsr166edist-jar"
1501        <fileset dir="${basedir}/etc/notes"/>            depends="jsr166eclean, jsr166ejar">
1502      </copy>      <copy file="${jsr166e.jar}" todir="${dist.dir}"/>
1503      </target>
1504    
1505      <target name="jsr166edist-docs"
1506              depends="jsr166eclean, jsr166edocs">
1507        <mirror-dir src="${jsr166edocs.dir}" dst="${dist.jsr166edocs.dir}"/>
1508    </target>    </target>
1509    
1510    
1511    <target name="ng" depends="test">  <!-- Find buglets that can be detected by static build tools -->
     <java classname="SuperfluousAbstract" fork="true">  
1512    
1513        <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>    <target name="lint">
1514        <antcall target="dists">
1515          <param name="build.javadoc.access" value="public"/>
1516        </antcall>
1517      </target>
1518    
1519      </java>  <!-- Generates all doclint warnings, even for private methods (rarely useful) -->
1520      <target name="lint-private">
1521        <antcall target="dist">
1522          <param name="build.javadoc.access" value="private"/>
1523        </antcall>
1524    </target>    </target>
1525    
1526    
1527    <!-- ==============================================================
1528      Experimental errorprone support - http://errorprone.info
1529      You may need to bring your own errorprone jar.
1530    =================================================================== -->
1531      <target name="errorprone"
1532              depends="clean, configure-compiler"
1533              description="Run errorprone over jsr166 source code">
1534    
1535        <local name="destdir"/>
1536        <property name="destdir" value="${build.classes.dir}/java.base"/>
1537        <mkdir dir="${destdir}"/>
1538    
1539        <javac srcdir="${src.dir}"
1540               destdir="${destdir}"
1541               debug="${build.debug}"
1542               debuglevel="${build.debuglevel}"
1543               deprecation="${build.deprecation}"
1544               classpath=""
1545               includeAntRuntime="false"
1546               includeJavaRuntime="false"
1547               encoding="ASCII"
1548               executable="${build.main.javac}"
1549               fork="true">
1550    
1551          <include name="**/*.java"/>
1552          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
1553          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
1554          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
1555          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
1556          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
1557          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"/>
1558          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
1559          <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/>
1560          <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/>
1561          <compilerarg line="-processorpath ${lib.dir}/error_prone_ant-2.0.20-SNAPSHOT.jar"/>
1562          <compilerarg value="-Xplugin:ErrorProne
1563                              -Xep:IdentityBinaryExpression:WARN
1564                              -Xep:MissingOverride:OFF
1565                              -Xep:MixedArrayDimensions:WARN
1566                              -Xep:RemoveUnusedImports:ERROR
1567                              -Xep:MethodCanBeStatic:WARN"/>
1568          <compilerarg value="--patch-module=java.base=${src.dir}"/>
1569          <compilerarg value="-Xprefer:source"/>
1570          <compilerarg value="-XDignore.symbol.file=true"/>
1571          <compilerarg value="-Xlint:all"/>
1572          <compilerarg value="-Xdoclint:all/protected,reference/private"/>
1573          <compilerarg line="-Xmaxerrs 3000 -Xmaxwarns 3000"/>
1574          <compilerarg line="${build.args}"/>
1575        </javac>
1576    
1577        <jar destfile="${product.jar}">
1578          <fileset dir="${destdir}"/>
1579        </jar>
1580    
1581        <run-tck-tests
1582          target="${build.main.java.version}"
1583          workdir="${build.dir}"
1584          classes="${product.jar}">
1585          <javac-elements>
1586            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
1587            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
1588            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
1589            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
1590            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
1591            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"/>
1592            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
1593            <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/>
1594            <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/>
1595            <compilerarg line="-processorpath ${lib.dir}/error_prone_ant-2.0.20-SNAPSHOT.jar"/>
1596            <compilerarg value="-Xplugin:ErrorProne
1597                                -Xep:IdentityBinaryExpression:WARN
1598                                -Xep:BoxedPrimitiveConstructor:OFF
1599                                -Xep:HashtableContains:OFF
1600                                -Xep:ModifyingCollectionWithItself:OFF
1601                                -Xep:MissingOverride:OFF
1602                                -Xep:MixedArrayDimensions:WARN
1603                                -Xep:RemoveUnusedImports:ERROR
1604                                -Xep:MethodCanBeStatic:WARN"/>
1605            <compilerarg line="-Xmaxerrs 3000 -Xmaxwarns 3000"/>
1606          </javac-elements>
1607        </run-tck-tests>
1608      </target>
1609    
1610    
1611    <!-- ==============================================================
1612      Running guava tests against jsr166 code
1613    =================================================================== -->
1614    
1615    <!-- <ivy:cachepath pathid="lib.path.id" inline="true" conf="*" -->
1616    <!--   organisation="com.google.guava" module="guava-testlib" revision="21.0"/> -->
1617    <!-- <property name="guava.version" value="21.0"/> -->
1618    
1619    <!-- HOWTO debug print a path id -->
1620    <!-- <pathconvert property="guava.testlib.classpath" refid="guava.testlib.classpath" /> -->
1621    <!-- <echo message="guava.testlib.classpath=${guava.testlib.classpath}"/> -->
1622    
1623    <!-- <ivy:retrieve pathid="guava.tests.classpath" type="jar" inline="true" conf="*" pattern="${lib.dir}/[type]/[artifact].[ext]" -->
1624    <!--   organisation="com.google.guava" module="guava-tests"/> -->
1625    <!-- <get src="http://repo2.maven.org/maven2/com/google/guava/guava-tests/${guava.version}/guava-tests-${guava.version}-tests.jar" -->
1626    <!--   dest="${lib.dir}/jar/guava-tests-tests.jar" usetimestamp="true"/> -->
1627    <!--     <ivy:cachepath pathid="lib.path.id" inline="true" conf="*" type="*" -->
1628    <!--       organisation="com.google.guava" module="guava-testlib" revision="${guava.version}"/> -->
1629    
1630    <!-- <test name="com.google.common.collect.testing.TestsForQueuesInJavaUtil"/> -->
1631    <!-- <test name="com.google.common.collect.testing.TestsForListsInJavaUtil"/> -->
1632    <!-- <test name="com.google.common.collect.testing.TestsForSetsInJavaUtil"/> -->
1633    <!-- <test name="com.google.common.collect.testing.TestsForMapsInJavaUtil"/> -->
1634    
1635    <!-- <ivy:retrieve pathid="guava.testlib.classpath" -->
1636    <!--   type="*" inline="true" conf="*(private),*(public)" -->
1637    <!--   pattern="${guava.dir}/[artifact].[ext]" -->
1638    <!--   organisation="com.google.guava" module="guava-testlib"/> -->
1639    
1640    <!-- Work around bug below by downloading guava-testlib-tests.jar "by hand": -->
1641    <!-- https://issues.apache.org/jira/browse/IVY-1444 -->
1642    <!-- maven tests artifacts cannot be downloaded because they are mapped to private configurations -->
1643    
1644      <target name="init-ivy">
1645        <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar"
1646             dest="${build.dir}/ivy.jar" usetimestamp="true" skipexisting="true"/>
1647        <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
1648                 classpath="${build.dir}/ivy.jar"/>
1649      </target>
1650    
1651      <target name="guava-tests" depends="jar, init-ivy"
1652              description="Guava tests run against jsr166 collections">
1653        <property name="guava.dir" value="${build.dir}/guava-testlib"/>
1654        <mkdir dir="${guava.dir}"/>
1655        <ivy:retrieve pathid="guava.testlib.classpath"
1656          type="jar,bundle" inline="true" conf="default,master"
1657          pattern="${guava.dir}/[artifact].[ext]"
1658          organisation="com.google.guava" module="guava-testlib"/>
1659        <property name="guava.version" value="21.0"/>
1660        <get src="http://repo2.maven.org/maven2/com/google/guava/guava-testlib/${guava.version}/guava-testlib-${guava.version}-tests.jar"
1661             dest="${guava.dir}/guava-testlib-tests.jar" usetimestamp="true"/>
1662        <junit printsummary="true" showoutput="true" haltonfailure="true"
1663               jvm="${java9}" fork="true">
1664          <jvmarg line="-ea -esa --patch-module java.base=${product.jar}"/>
1665          <formatter type="brief"/>
1666          <classpath>
1667            <pathelement location="${guava.dir}/guava-testlib-tests.jar"/>
1668            <path refid="guava.testlib.classpath"/>
1669          </classpath>
1670    
1671          <!-- "6" in "OpenJdk6Tests" misleadingly means "6+" -->
1672          <test name="com.google.common.collect.testing.OpenJdk6Tests"/>
1673        </junit>
1674      </target>
1675    
1676  </project>  </project>

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.239

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8