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

Diff of /jsr166/build.xml

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

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

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.261

dl@cs.oswego.edu
ViewVC Help
Powered by ViewVC 1.1.27