ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/build.xml
(Generate patch)

Comparing jsr166/build.xml (file contents):
Revision 1.49 by tim, Sat Aug 2 02:38:24 2003 UTC vs.
Revision 1.326 by jsr166, Fri Nov 25 19:33:39 2022 UTC

# Line 1 | Line 1
1 < <project name="jsr166" default="usage">
1 > <project name="jsr166" default="usage"
2 >  xmlns:if="ant:if"
3 >  xmlns:unless="ant:unless"
4 >  xmlns:ivy="antlib:org.apache.ivy.ant">
5  
6    <description>
7   ------------------------------------------------------------------------------
# Line 6 | Line 9
9  
10    Usage: ant [target]
11  
12 +  See http://gee.cs.oswego.edu/dl/concurrency-interest/index.html for
13 +  more details.
14 +
15    User-specific settings are read from user.properties.
16    See user.properties.sample for an explanation of some useful settings.
17 +
18 +  The repository contains all dependencies except for ant and the JDK
19 +  itself.  Because the JDK version matters and because different
20 +  targets require different JDKs, we assume that users have created a
21 +  hierarchy containing:
22 +  $HOME/jdk/jdk17
23 +  $HOME/jdk/jdk19
24 +  where each of the above is a JDK or a symlink to same, and
25 +  $HOME/jdk/src/jdk17
26 +  where each of the above is a JDK source tree or a symlink to same.
27 +
28 +  Alternatively, define ant variables thus:
29 +  ant -Djdk$N.home=... -Djdk$N.src.home=...
30 +  for $N in 17 .. 19 ...
31 +
32 +  As of 2016-03, the sources in src/main are for jdk9+ only.
33 +  As of 2019-08, the sources in src/main are for jdk11+ only.
34 +  As of 2019-10, compatibility support for jdk8 is dropped entirely.
35 +  As of 2022-02, the sources in src/main are for jdk17+ only.
36   ------------------------------------------------------------------------------
37    </description>
38  
39 <  <target name="usage" description="Advises user to run with -projecthelp">
40 <    <echo>Run "ant -projecthelp" for full usage information.</echo>
39 >  <!-- Run 'ant -projecthelp' (default target) -->
40 >  <target name="usage">
41 >    <java classname="org.apache.tools.ant.Main">
42 >      <arg value="-projecthelp" />
43 >    </java>
44    </target>
45  
46 +  <!-- HOWTO printf debug: <echo message="prop=${prop}"/> -->
47  
48    <!-- User-specific settings -->
49    <property file="user.properties"/>
50  
51  
52    <!-- Compilation options -->
24  <property name="build.sourcelevel"    value="1.5"/>
25  <property name="build.docsourcelevel" value="1.4"/>
53    <property name="build.debug"          value="true"/>
54    <property name="build.debuglevel"     value="source,lines,vars"/>
55    <property name="build.deprecation"    value="false"/>
56 +  <property name="build.javadoc.access" value="protected"/>
57  
58    <!-- Build locations -->
59 <  <property name="build.dir"            location="build"/>
60 <  <property name="build.classes.dir"    location="${build.dir}/classes"/>
61 <  <property name="build.emulation.dir"  location="${build.dir}/emulation"/>
62 <  <property name="build.testcases.dir"  location="${build.dir}/testcases"/>
63 <  <property name="build.lib.dir"        location="${build.dir}/lib"/>
64 <  <property name="build.ant.dir"        location="${build.dir}/ant"/>
65 <  <property name="build.javadocs.dir"   location="${build.dir}/javadocs"/>
66 <  <property name="build.stripped.dir"   location="${build.dir}/stripped"/>
67 <  <property name="build.reports.dir"    location="${build.dir}/reports"/>
68 <  <property name="build.doccheck.dir"   location="${build.dir}/doccheck"/>
69 <  <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/>
70 <  <property name="build.filter.doccheck.dir" location="${build.dir}/filterdocchk"/>
59 >  <property name="build.dir"                   location="build"/>
60 >  <property name="build.classes.dir"           location="${build.dir}/classes"/>
61 >  <property name="build.testcases.dir"         location="${build.dir}/testcases"/>
62 >  <property name="build.loops.dir"             location="${build.dir}/loops"/>
63 >
64 >  <!-- JDK locations -->
65 >  <property name="jdks.home"  location="${user.home}/jdk"/>
66 >
67 >  <macrodef name="defjdklocations">
68 >    <attribute name="v"/>
69 >    <sequential>
70 >    <property name="jdk@{v}.home"     location="${jdks.home}/jdk@{v}"/>
71 >    <property name="java@{v}"         location="${jdk@{v}.home}/bin/java"/>
72 >    <property name="javac@{v}"        location="${jdk@{v}.home}/bin/javac"/>
73 >    <property name="javadoc@{v}"      location="${jdk@{v}.home}/bin/javadoc"/>
74 >    <property name="jdk@{v}.src.home" location="${jdks.home}/src/jdk@{v}"/>
75 >    <property name="jdk@{v}.src.dir"  location="${jdk@{v}.src.home}/jdk/src/java.base/share/classes"/>
76 >    </sequential>
77 >  </macrodef>
78 >
79 >  <macrodef name="mirror-dir">
80 >    <attribute name="src"/>
81 >    <attribute name="dst"/>
82 >    <sequential>
83 >    <delete dir="@{dst}"/>
84 >    <mkdir dir="@{dst}"/>
85 >    <copy todir="@{dst}" preservelastmodified="true">
86 >      <fileset dir="@{src}"/>
87 >    </copy>
88 >    </sequential>
89 >  </macrodef>
90 >
91 >  <defjdklocations v="17"/>
92 >  <defjdklocations v="18"/>
93 >  <defjdklocations v="19"/>
94  
95    <!-- Source locations -->
96    <property name="src.dir"              location="${basedir}/src/main"/>
46  <property name="emulation.src.dir"    location="${basedir}/src/emulation"/>
97    <property name="test.src.dir"         location="${basedir}/src/test"/>
98 <  <property name="ant.src.dir"          location="${basedir}/etc/ant"/>
99 <  <property name="stylesheet.dir"       location="${basedir}/etc/xsl"/>
98 >  <property name="loops.src.dir"        location="${basedir}/src/loops"/>
99 >  <property name="tck.src.dir"          location="${test.src.dir}/tck"/>
100 >  <property name="jtreg17.src.dir"      location="${test.src.dir}/jtreg"/>
101 >  <property name="jtreg18.src.dir"      location="${test.src.dir}/jtreg"/>
102 >  <property name="jtreg19.src.dir"      location="${test.src.dir}/jtreg"/>
103 >  <property name="jtreg.src.dir"        location="${jtreg17.src.dir}"/>
104    <property name="lib.dir"              location="${basedir}/lib"/>
105    <property name="dist.dir"             location="${basedir}/dist"/>
106 +  <property name="topsrc.dir"           location="${basedir}/src"/>
107  
108 <  <!-- Distribution locations -->
109 <  <property name="dist.javadocs.dir"    location="${dist.dir}/docs"/>
108 >  <!-- Javadoc locations -->
109 >  <property name="docs.dir"          location="${build.dir}/docs"/>
110 >  <property name="dist.docs.dir"     location="${dist.dir}/docs"/>
111  
112    <!-- Jar locations -->
113 <  <property name="product.jar"          location="${build.lib.dir}/jsr166.jar"/>
114 <  <property name="junit.jar"            location="${lib.dir}/junit.jar"/>
59 <  <property name="rt.jar"               location="${java.home}/lib/rt.jar"/>
60 <  <property name="sinjdoc.jar"          location="${lib.dir}/sinjdoc.jar"/>
61 <
62 <
63 <  <!-- Files excluded from dist-docs and emulation jar -->
64 <  <patternset id="unsafe.exclusion">
65 <    <exclude name="java/util/Random.*"/>
66 <    <exclude name="sun/misc/Unsafe.*"/>
67 <  </patternset>
68 <
69 <  <!-- Files excludes from emulation jar -->
70 <  <patternset id="atomic.exclusion">
71 <    <exclude name="java/util/concurrent/atomic/AtomicBoolean*"/>
72 <    <exclude name="java/util/concurrent/atomic/AtomicInteger*"/>
73 <    <exclude name="java/util/concurrent/atomic/AtomicLong*"/>
74 <    <exclude name="java/util/concurrent/atomic/AtomicReference*"/>
75 <  </patternset>
76 <
113 >  <property name="product.jar"      location="${build.dir}/jsr166.jar"/>
114 >  <property name="junit.jar"        location="${lib.dir}/junit.jar"/>
115  
116 <
117 <  <!-- Main targets -->
118 <
119 <  <target name="compile"
120 <          depends="init, configure-compiler, prepare-src"
121 <          description="Compiles main sources to build folder">
122 <
123 <    <property name="prepare.src.dir" value="${src.dir}"/>
124 <
125 <    <mkdir dir="${build.classes.dir}"/>
126 <
127 < <!--
128 <    <echo>javac ${gjc.args}</echo>
129 <    <echo>bootclasspath=${compile.bootclasspath}</echo>
130 < -->
131 <
132 <    <javac srcdir="${prepare.src.dir}"
133 <          destdir="${build.classes.dir}"
134 <            debug="${build.debug}"
135 <       debuglevel="${build.debuglevel}"
136 <      deprecation="${build.deprecation}"
137 <           source="${build.sourcelevel}"
138 <             fork="true">
139 <
140 <      <compilerarg    line="${gjc.args}"/>
141 <      <bootclasspath refid="compile.bootclasspath"/>
116 >  <!-- Canonical location of jdk docs root, to use with javadoc -Xdocrootparent flag -->
117 >  <!-- Switched to https: in 2017-10 - JDK-8190312 -->
118 >  <property name="java17.docroot.url" value="https://docs.oracle.com/en/java/javase/17/docs"/>
119 >  <property name="java18.docroot.url" value="https://download.java.net/java/early_access/jdk18/docs"/>
120 >  <property name="java19.docroot.url" value="https://download.java.net/java/early_access/jdk19/docs"/>
121 >  <!-- Default jdk doc location (latest stable LTS release seems best) -->
122 >  <property name="java.docroot.url"   value="${java17.docroot.url}"/>
123 >
124 >  <!-- Canonical location of jdk API docs, to use with javadoc link attribute -->
125 >  <property name="java17.api.url"     value="${java17.docroot.url}/api/"/>
126 >  <property name="java18.api.url"     value="${java18.docroot.url}/api/"/>
127 >  <property name="java19.api.url"     value="${java19.docroot.url}/api/"/>
128 >  <property name="java.api.url"       value="${java.docroot.url}/api/"/>
129 >
130 >  <!-- Define the "jtreg" task -->
131 >  <!-- See the docs in "jtreg -onlineHelp" -->
132 >  <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"
133 >           classpath="${lib.dir}/jtreg.jar" />
134 >
135 >  <!-- Tck configuration options; see JSR166TestCase.java
136 >   To profile a single tck test class:
137 >   ant -Djsr166.profileTests=true -Djsr166.profileThreshold=10 -Djsr166.tckTestClass=CompletableFutureTest tck
138 >   To stress test a single tck test class:
139 >   ant -Djsr166.tckTestClass=CountedCompleterTest -Djsr166.runsPerTest=100 tck
140 >   To stress test a single tck test method:
141 >   ant -Djsr166.tckTestClass=RecursiveTaskTest -Djsr166.runsPerTest=1000 -Djsr166.methodFilter=testAbnormalInvokeAll3 tck
142 >  -->
143 >  <property name="jsr166.tckTestClass"     value="JSR166TestCase"/>
144 >  <macrodef name="run-tck-tests">
145 >    <attribute name="tck.src.dir" default="${tck.src.dir}"/>
146 >    <attribute name="target"/>
147 >    <attribute name="compile-target" default="@{target}"/>
148 >    <attribute name="workdir"/>
149 >    <attribute name="classes"/>
150 >    <!--
151 >        <attribute name="jvmflags" default="-XX:+UseParallelGC -XX:-UseBiasedLocking -ea -esa -Djsr166.testImplementationDetails=true"/>
152 >    -->
153 >        <attribute name="jvmflags" default="-ea -esa -Djsr166.testImplementationDetails=true"/>
154 >    <element name="javac-elements" optional="true"/>
155 >
156 >    <sequential>
157 >
158 >    <mkdir dir="@{workdir}/tck-classes"/>
159 >
160 >    <javac srcdir="@{tck.src.dir}"
161 >           destdir="@{workdir}/tck-classes"
162 >           debug="${build.debug}"
163 >           debuglevel="${build.debuglevel}"
164 >           deprecation="${build.deprecation}"
165 >           source="@{compile-target}"
166 >           target="@{compile-target}"
167 >           classpath="${junit.jar}"
168 >           includeAntRuntime="false"
169 >           includeJavaRuntime="false"
170 >           encoding="ASCII"
171 >           executable="${javac@{compile-target}}"
172 >           fork="true">
173 >
174 >      <include name="*.java"/>
175 >      <compilerarg value="-XDignore.symbol.file=true"/>
176 >      <compilerarg value="-Xlint:all,-unchecked,-rawtypes,-serial,-deprecation,-try"/>
177 >      <compilerarg value="-Xdoclint:reference/private"/>
178 >      <compilerarg value="--patch-module=java.base=@{classes}"/>
179 >      <compilerarg line="${build.args}"/>
180 >      <javac-elements/>
181  
182      </javac>
183  
184 <  </target>
185 <
186 <
187 <  <target name="jar"
188 <          depends="configure-emulation, init-jar, native-jar, emulation-jar"
189 <          description="Builds library jar from compiled sources"/>
190 <
191 <
192 <  <target name="test"
193 <          depends="init, configure-tests, report-tests"
194 <          description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" />
184 >    <java classname="${jsr166.tckTestClass}"
185 >          failonerror="true"
186 >          jvm="${java@{target}}"
187 >          fork="true">
188 >        <jvmarg value="--patch-module=java.base=@{classes}"/>
189 >        <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED"/>
190 >        <jvmarg value="--add-opens=java.base/java.util=ALL-UNNAMED"/>
191 >        <jvmarg value="--add-opens=java.base/java.util.concurrent=ALL-UNNAMED"/>
192 >        <jvmarg value="--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED"/>
193 >        <jvmarg value="--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED"/>
194 >        <jvmarg line="@{jvmflags}"/>
195 >        <!-- ant -Dvmoptions="-Xmx8m" -Djsr166.tckTestClass=CompletableFutureTest tck -->
196 >        <jvmarg line="${vmoptions}" if:set="vmoptions"/>
197 >
198 >        <!-- ant -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 tck -->
199 >        <syspropertyset id="system-properties-used-by-tck">
200 >          <propertyref prefix="java.util.concurrent.ForkJoinPool"/>
201 >          <propertyref prefix="jsr166."/>
202 >          <propertyref name="test.timeout.factor"/>
203 >        </syspropertyset>
204 >
205 >        <classpath>
206 >          <pathelement location="${junit.jar}"/>
207 >          <pathelement location="@{workdir}/tck-classes"/>
208 >        </classpath>
209 >    </java>
210  
211 +    </sequential>
212 +  </macrodef>
213  
214 <  <target name="checkstyle"
215 <          depends="filter-src"
216 <          description="Reports on style errors in Java source (verbose, mostly chaff)">
214 >  <!-- Define jtreg test sets for different jdk versions -->
215 >  <!-- ant -Djtreg.test.pattern="**/ConcurrentHashMap/" -->
216 >  <!-- ant -Djtreg.test.pattern="**/ToArray.java" -->
217 >  <property name="jtreg.test.pattern" value="**/*.java"/>
218 >  <macrodef name="defjtregtests">
219 >    <attribute name="v"/>
220 >    <sequential>
221 >      <fileset dir="${jtreg@{v}.src.dir}">
222 >        <patternset id="jdk@{v}.jtreg.tests">
223 >          <include name="${jtreg.test.pattern}"/>
224 >        </patternset>
225 >      </fileset>
226 >    </sequential>
227 >  </macrodef>
228  
229 <    <taskdef resource="checkstyletask.properties"
230 <            classpath="${lib.dir}/checkstyle-all-2.4.jar"/>
229 >  <defjtregtests v="17"/>
230 >  <defjtregtests v="18"/>
231 >  <defjtregtests v="19"/>
232 >
233 >  <!-- ant -Djtreg.flags=-timeoutFactor:4 -->
234 >  <property name="jtreg.flags" value=""/>
235 >
236 >  <macrodef name="run-jtreg-tests">
237 >    <attribute name="target"/>
238 >    <attribute name="workdir"/>
239 >    <attribute name="classes"/>
240 >    <attribute name="verbose" default="${jtreg.verbose}"/>
241 >    <attribute name="jtregflags" default=""/>
242 >    <element name="jtreg-elements" optional="true"/>
243 >
244 >    <sequential>
245 >
246 >    <!-- ant -Djtreg.verbose=time,fail,error jtreg -->
247 >    <property name="jtreg.verbose" value="nopass,fail,error"/>
248 >
249 >    <!-- concurrency > 1 mitigates slowness of some jtreg tests -->
250 >    <!-- BUT concurrency:auto starts "too many" VMs; just 1 free core each -->
251 >    <!-- In 2020 concurrency:3 seems like a sweet spot -->
252 >    <!-- Override using:  ant -Djtreg.concurrency="N" jtreg -->
253 >    <property name="jtreg.concurrency" value="3"/>
254 >
255 >    <delete dir="@{workdir}/JTwork" quiet="true"/>
256 >    <jtreg dir="${jtreg@{target}.src.dir}"
257 >           jdk="${jdk@{target}.home}"
258 >           workDir="@{workdir}/JTwork">
259 >      <patternset refid="jdk@{target}.jtreg.tests"/>
260 >      <arg value="-javacoption:--patch-module=java.base=@{classes}"/>
261 >      <arg value="-vmoption:--patch-module=java.base=@{classes}"/>
262 >      <arg value="-vmoption:-Xmx256m"/>
263 >      <arg value="-concurrency:${jtreg.concurrency}"/>
264 >      <arg value="-vmoptions:-esa -ea"/>
265 >      <arg value="-vmoptions:${vmoptions}" if:set="vmoptions"/>
266 >      <arg value="-agentvm"/>
267 >      <arg value="-noreport"/>
268 >      <arg value="-verbose:@{verbose}"/>
269 >      <arg value="-automatic"/>
270 >      <arg value="-k:!ignore"/>
271 >      <arg line="@{jtregflags}"/>
272 >      <arg line="${jtreg.flags}"/>
273 >      <jtreg-elements/>
274 >    </jtreg>
275 >    </sequential>
276 >  </macrodef>
277 >
278 >  <!-- ALoops classpath -->
279 >  <path id="loops.classpath">
280 >    <pathelement location="${build.loops.dir}"/>
281 >  </path>
282 >
283 >  <!-- Support @jls tag, used in jdk8+ javadoc -->
284 >  <!-- TODO: switch to @jls taglet, as supported by jdk14+ javadoc -->
285 >  <property name="javadoc.jls.cite" value="The Java&amp;trade; Language Specification"/>
286 >  <property name="javadoc.jls.option" value="jls:a:See &lt;cite&gt;${javadoc.jls.cite}&lt;/cite&gt;:"/>
287  
288 <    <checkstyle>
128 <      <formatter type="plain"/>  <!-- also available: type="xml" -->
129 <      <fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
130 <    </checkstyle>
288 >  <!-- Main targets -->
289  
290 <  </target>
290 >  <!-- Default values: may seem strange ... -->
291 >  <!-- At runtime, target latest, but build for current LTS -->
292 >  <property name="java.runtime.target" value="19"/>
293 >  <property name="build.main.java" value="${java17}"/>
294 >  <property name="build.main.javac" value="${javac17}"/>
295 >  <property name="build.main.javadoc" value="${javadoc19}"/>
296 >  <property name="build.main.javadoc.source" value="${java.runtime.target}"/>
297  
298 +  <target name="dists"
299 +          depends="dist"
300 +          description="Builds all public jars and docs"/>
301  
302 <  <target name="doccheck"
303 <          depends="filter-doccheck"
304 <          description="Reports on javadoc style errors">
302 >  <target name="compile"
303 >          depends="configure-compiler"
304 >          description="Compiles src/main sources to build dir">
305  
306 <    <delete dir="${build.doccheck.dir}"/>
307 <    <mkdir dir="${build.doccheck.dir}"/>
306 >    <local name="destdir"/>
307 >    <property name="destdir" value="${build.classes.dir}/java.base"/>
308  
309 <    <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck"
143 <         docletpath="${lib.dir}/doccheck.jar"
144 <            destdir="${build.doccheck.dir}">
145 <      <packageset dir="${build.filter.doccheck.dir}"/>
146 <    </javadoc>
309 >    <mkdir dir="${destdir}"/>
310  
311 <    <echo>DocCheck output is in ${build.doccheck.dir}</echo>
311 >    <javac srcdir="${src.dir}"
312 >           destdir="${destdir}"
313 >           debug="${build.debug}"
314 >           debuglevel="${build.debuglevel}"
315 >           deprecation="${build.deprecation}"
316 >           classpath=""
317 >           includeAntRuntime="false"
318 >           includeJavaRuntime="false"
319 >           encoding="ASCII"
320 >           executable="${build.main.javac}"
321 >           fork="true">
322 >
323 >      <include name="**/*.java"/>
324 >      <compilerarg value="--patch-module=java.base=${src.dir}"/>
325 >      <compilerarg value="-Xprefer:source"/>
326 >      <compilerarg value="-XDignore.symbol.file=true"/>
327 >      <compilerarg value="-Xlint:all"/>
328 >      <compilerarg value="-Xdoclint:all/protected"/>
329 >      <compilerarg value="-Xdoclint/package:java.util.*"/>
330 >      <compilerarg value="-Werror"/>
331 >      <compilerarg line="-Xmaxerrs 1000 -Xmaxwarns 1000"/>
332 >      <compilerarg line="${build.args}"/>
333 >    </javac>
334 >  </target>
335  
336 +  <target name="jar"
337 +          depends="compile"
338 +          description="Builds library jar for src/main from compiled sources">
339 +    <local name="subdir"/>
340 +    <available property="subdir" file="${build.classes.dir}/java.base" type="dir" value="/java.base"/>
341 +    <jar destfile="${product.jar}">
342 +      <fileset dir="${build.classes.dir}${subdir}"/>
343 +      <manifest>
344 +        <attribute name="Built-By" value="${user.name}"/>
345 +        <attribute name="Implementation-Vendor" value="JCP JSR-166 Expert Group."/>
346 +      </manifest>
347 +    </jar>
348    </target>
349  
350  
351    <target name="docs"
352 <          depends="filter-src"
353 <          description="Builds javadocs with custom tags to build folder">
354 <
355 <    <delete dir="${build.javadocs.dir}"/>
356 <    <mkdir dir="${build.javadocs.dir}"/>
357 <
358 <    <javadoc destdir="${build.javadocs.dir}"
359 <                link="http://java.sun.com/j2se/1.4.1/docs/api"
360 <            overview="${src.dir}/intro.html"
361 <              source="${build.docsourcelevel}">
362 <
363 <      <tag name="revised" description="Last revised:"/>
364 <      <tag name="spec"    description="Specified by:"/>
365 <      <tag name="editor"  description="Last edited by:"/>
366 <      <tag name="fixme"   description="FIX ME:"/>
367 <
368 <      <packageset dir="${build.filter.src.dir}"/>
369 <
352 >          description="Builds javadocs for src/main to dist dir">
353 >    <delete dir="${docs.dir}" quiet="true"/>
354 >    <mkdir dir="${docs.dir}"/>
355 >    <javadoc destdir="${docs.dir}"
356 >             packagenames="none"
357 >             link="${java.api.url}"
358 >             overview="${src.dir}/intro.html"
359 >             access="${build.javadoc.access}"
360 >             sourcepath="${src.dir}"
361 >             classpath=""
362 >             source="${build.main.javadoc.source}"
363 >             executable="${build.main.javadoc}">
364 >      <fileset dir="${src.dir}" defaultexcludes="yes">
365 >        <include name="java/**/*.java"/>
366 >      </fileset>
367 >      <arg line="-Xdocrootparent ${java.docroot.url}"/>
368 >      <arg line="-Xmaxerrs 1000 -Xmaxwarns 1000"/>
369 >      <arg line="-Xmaxerrs 1000 -Xmaxwarns 1"/>
370 >      <arg value="-quiet"/>
371 >      <arg value="-XDignore.symbol.file=true"/>
372 >      <arg value="-html5"/>
373 >      <arg value="-Xdoclint:all,-missing"/>
374 >      <arg value="--patch-module=java.base=${src.dir}"/>
375 >      <arg value="--frames" if:set="use-frames"/>
376 >      <arg value="--override-methods=summary"/>
377 >      <arg value="-tag"/> <arg value="${javadoc.jls.option}"/>
378 >      <arg value="-tag"/> <arg value="implSpec:a:Implementation Requirements:"/>
379 >      <arg value="-tag"/> <arg value="implNote:a:Implementation Note:"/>
380 >      <arg value="-tag"/> <arg value="apiNote:a:API Note:"/>
381      </javadoc>
173
174  </target>
175
176
177  <target name="sinjdocs"
178          depends="configure-tests"
179          description="Builds javadocs with custom tags to build folder">
180
181    <delete dir="${build.javadocs.dir}"/>
182    <mkdir dir="${build.javadocs.dir}"/>
183
184    <java classname="net.cscott.sinjdoc.Main" fork="true">
185
186      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
187
188      <classpath>
189        <pathelement location="${sinjdoc.jar}"/>
190        <path refid="test.classpath"/>
191      </classpath>
192
193      <!-- <arg value="-link"/>       <arg value="http://java.sun.com/j2se/1.4.1/docs/api"/> -->
194
195      <arg value="-d"/>          <arg value="${build.javadocs.dir}"/>
196      <arg value="-sourcepath"/> <arg value="${src.dir}"/>
197      <arg value="-overview"/>   <arg value="${src.dir}/intro.html"/>
198      <arg value="-source"/>     <arg value="1.5"/>
199      <arg value="-verbose"/>
200      <arg value="java.util"/>
201
202      <!--
203      <arg value="-help"/>
204      -->
205
206    </java>
207
208  </target>
209
210
211  <target name="strip"
212          depends="init, configure-compiler"
213          description="Strip generics from java source (not working yet)">
214
215    <mkdir dir="${build.stripped.dir}"/>
216
217    <!--
218     # javac -s doesn't reliably generate compilable code. It generates
219     # bridge methods (marked as "synthetic") that can have identical
220     # signatures to existing methods except for the return value.
221     -->
222    <javac srcdir="${src.dir}"
223          destdir="${build.stripped.dir}"
224            debug="${build.debug}"
225       debuglevel="${build.debuglevel}"
226      deprecation="${build.deprecation}"
227           source="${build.sourcelevel}"
228             fork="true">
229
230      <compilerarg    line="${gjc.args} -s"/>
231      <bootclasspath refid="compile.bootclasspath"/>
232
233    </javac>
234
382    </target>
383  
237
384    <target name="dist"
385 <          depends="init, dist-clean, dist-jar, dist-docs"
385 >          depends="dist-clean, dist-jar, dist-docs"
386            description="Puts all distributable products in single hierarchy"/>
387  
242  <target name="release"
243          depends="dist"
244          description="Puts entire CVS tree, plus distribution productions, in a jar">
245
246 <!--
247    #keep build dir? - dl
248    <delete dir="${build.dir}"/>
249 -->
250    <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>
251
252    <jar basedir="${basedir}" destfile="${release.jar}">
253      <exclude name="${release.jar}"/>
254      <exclude name="user.properties"/>
255      <exclude name="etc/notes/**"/>
256      <exclude name="lib/gjc/2.1/**"/>
257      <exclude name="**/SyntaxTest.java"/>
258    </jar>
259
260  </target>
261
388    <target name="clean"
389            description="Removes all build products">
264
390      <delete dir="${build.dir}"/>
266    <delete dir="${build.classes.dir}"/>
267    <delete dir="${build.lib.dir}"/>
268
391    </target>
392  
271
393    <target name="dist-clean"
394            description="Removes all build and distribution products">
395 <
395 >    <delete dir="${build.dir}"/>
396      <delete dir="${dist.dir}"/>
276
277  </target>
278
279
280  <target name="dist-docs"
281          depends="filter-src"
282          description="Builds javadocs without custom tags to dist folder">
283
284    <delete dir="${dist.javadocs.dir}"/>
285    <mkdir dir="${dist.javadocs.dir}"/>
286
287    <javadoc destdir="${dist.javadocs.dir}"
288                link="http://java.sun.com/j2se/1.4.1/docs/api"
289            overview="${src.dir}/intro.html"
290              source="${build.docsourcelevel}">
291
292      <packageset dir="${build.filter.src.dir}"/>
293
294    </javadoc>
295
296  </target>
297
298
299
300  <!-- Internal targets -->
301
302
303  <target name="init">
304
305    <!-- Version is kept in a separate file -->
306    <loadfile property="version" srcFile="version.properties"/>
307    <echo>Building JSR-166 version ${version}</echo>
308
309  </target>
310
311
312  <target name="init-jar">
313
314    <mkdir dir="${build.lib.dir}"/>
315
397    </target>
398  
318
319  <target name="native-jar"
320          depends="compile"
321          unless="build.emulation.true">
322
323    <jar destfile="${product.jar}">
324      <fileset dir="${build.classes.dir}"/>
325    </jar>
326
327  </target>
328
329
330  <target name="compile-emulation"
331          depends="init, configure-compiler"
332          if="build.emulation.true">
333
334    <mkdir dir="${build.emulation.dir}"/>
335
336    <javac srcdir="${emulation.src.dir}"
337          destdir="${build.emulation.dir}"
338            debug="${build.debug}"
339       debuglevel="${build.debuglevel}"
340      deprecation="${build.deprecation}"
341           source="${build.sourcelevel}"
342             fork="true">
343
344      <compilerarg    line="${gjc.args}"/>
345      <bootclasspath refid="compile.bootclasspath"/>
346
347    </javac>
348
349  </target>
350
351
352  <target name="emulation-jar"
353          depends="compile-emulation"
354          if="build.emulation.true">
355
356
357    <jar destfile="${product.jar}" duplicate="add">
358      <fileset dir="${build.classes.dir}">
359        <patternset refid="atomic.exclusion"/>
360        <patternset refid="unsafe.exclusion"/>
361      </fileset>
362      <fileset dir="${build.emulation.dir}"/>
363    </jar>
364
365  </target>
366
367
399    <target name="dist-jar"
400            depends="clean, jar">
370
401      <copy file="${product.jar}" todir="${dist.dir}"/>
372
373  </target>
374
375
376  <target name="compile-ant-filter"
377          depends="init">
378
379    <mkdir dir="${build.ant.dir}"/>
380
381    <javac srcdir="${ant.src.dir}"
382          destdir="${build.ant.dir}"
383           source="1.4"
384    />
385
386  </target>
387
388
389  <target name="filter-src"
390          depends="compile-ant-filter">
391
392    <mkdir dir="${build.filter.src.dir}"/>
393
394    <copy todir="${build.filter.src.dir}">
395      <fileset dir="${src.dir}">
396        <include name="**/*.html"/>
397      </fileset>
398    </copy>
399
400    <copy todir="${build.filter.src.dir}">
401      <fileset dir="${src.dir}">
402        <exclude name="**/*.html"/>
403        <patternset refid="unsafe.exclusion"/>
404      </fileset>
405      <filterchain>
406
407        <!--
408         # This filter gets rid of angle-bracketed type parameters
409         # so that javadoc can run on the result. The following
410         # heuristic seems to work:
411         #
412         # For all lines not starting with space(s)-asterisk-space(s),
413         #   replace <something> with a space, where there may be more
414         #   than one right angle bracket at the end, and "something"
415         #   must not contain parens or pipes. (This may need some
416         #   tweaking.)
417         -->
418
419        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
420                      classpath="${build.ant.dir}">
421          <param name="notmatching" value="^\s+\*\s.*$"/>
422          <param name="pattern"     value="&lt;[^|>()]+?>+"/>
423          <param name="replacement" value=" "/>
424        </filterreader>
425
426
427        <!--
428         # This filter uncomments lines beginning with "//@" so that
429         # javadoc can see imports that are needed to resolve links
430         # but that shouldn't be in the compiled code.
431         -->
432
433        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
434                      classpath="${build.ant.dir}">
435          <param name="matching"    value="^//@.*$"/>
436          <param name="pattern"     value="^//@"/>
437          <param name="replacement" value=""/>
438        </filterreader>
439      </filterchain>
440    </copy>
441
402    </target>
403  
404 <
405 <
406 <
447 <  <target name="filter-doccheck"
448 <          depends="filter-src">
449 <
450 <    <mkdir dir="${build.filter.doccheck.dir}"/>
451 <
452 <    <copy todir="${build.filter.doccheck.dir}">
453 <      <fileset dir="${build.filter.src.dir}">
454 <        <include name="**/*.html"/>
455 <      </fileset>
456 <    </copy>
457 <
458 <    <property name="generic.declarations"
459 <             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 {}"
460 <    />
461 <
462 <    <copy todir="${build.filter.doccheck.dir}">
463 <      <fileset dir="${build.filter.src.dir}">
464 <        <exclude name="**/*.html"/>
465 <      </fileset>
466 <      <filterchain>
467 <        <!--
468 <         # These two filters try to make the source look like
469 <         # something that doccheck can process. The first removes
470 <         # -source 1.4 assertions and the second adds in a bunch
471 <         # of single letter public nested marker interfaces so that
472 <         # the generic type parameters are recognized.
473 <         -->
474 <
475 <        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
476 <                      classpath="${build.ant.dir}">
477 <          <param name="matching"    value="^\s*assert[\s ].*$"/>
478 <          <param name="pattern"     value="assert"/>
479 <          <param name="replacement" value="//assert"/>
480 <        </filterreader>
481 <
482 <        <filterreader classname="jsr166.ant.filters.ReplaceFilter"
483 <                      classpath="${build.ant.dir}">
484 <          <param name="matching"    value="^([^*]*(class|interface|implements) .*|)\{.*$"/>
485 <          <param name="pattern"     value="$"/>
486 <          <param name="replacement" value=" ${generic.declarations}"/>
487 <        </filterreader>
488 <
489 <      </filterchain>
490 <    </copy>
491 <
492 <  </target>
493 <
494 <
495 <  <target name="compile-tests"
496 <          depends="jar">
497 <
498 <    <mkdir dir="${build.testcases.dir}"/>
499 <
500 < <!--
501 <    <echo>javac ${gjc.args}</echo>
502 <    <echo>bootclasspath=${test.compile.bootclasspath}</echo>
503 <    <echo>classpath="${test.classpath}"</echo>
504 < -->
505 <
506 <    <javac srcdir="${test.src.dir}"
507 <          destdir="${build.testcases.dir}"
508 <            debug="${build.debug}"
509 <       debuglevel="${build.debuglevel}"
510 <      deprecation="${build.deprecation}"
511 <           source="${build.sourcelevel}"
512 <             fork="true">
513 <
514 <      <compilerarg    line="${gjc.args}"/>
515 <      <bootclasspath refid="test.compile.bootclasspath"/>
516 <      <classpath     refid="test.classpath"/>
517 <
518 <    </javac>
519 <
404 >  <target name="dist-docs"
405 >          depends="clean, docs">
406 >    <mirror-dir src="${docs.dir}" dst="${dist.docs.dir}"/>
407    </target>
408  
409 <
410 <  <target name="run-tests"
411 <          depends="compile-tests">
412 <
413 <    <!-- May be overridden by user.properties -->
414 <    <property name="testcase" value="*"/>
415 <
416 <    <mkdir dir="${build.reports.dir}"/>
417 <
418 <    <junit printsummary="true"
419 <             showoutput="true"
420 <          errorProperty="junit.failed"
421 <        failureProperty="junit.failed"
422 <                    dir="${build.reports.dir}"
423 <                   fork="true">
424 <
425 <      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
426 <
427 <      <formatter type="xml"/>
428 <
429 <      <batchtest todir="${build.reports.dir}">
430 <        <fileset dir="${test.src.dir}">
431 <          <include name="**/${testcase}Test.java"/>
432 <        </fileset>
433 <      </batchtest>
434 <
435 <    </junit>
436 <
409 >  <target name="tck"
410 >          depends="jar"
411 >          description="Runs tck tests for src/main directly">
412 >    <run-tck-tests
413 >      target="${java.runtime.target}"
414 >      workdir="${build.dir}"
415 >      classes="${product.jar}">
416 >      <javac-elements>
417 >        <!-- <compilerarg value="-Werror"/> -->
418 >      </javac-elements>
419 >    </run-tck-tests>
420 >  </target>
421 >
422 >  <target name="tck-parallelism-1"
423 >          description="Runs tck with common pool parallelism 1">
424 >    <antcall target="tck">
425 >      <param name="java.util.concurrent.ForkJoinPool.common.parallelism" value="1"/>
426 >    </antcall>
427 >  </target>
428 >
429 >  <target name="tck-parallelism-0"
430 >          description="Runs tck with common pool parallelism 0">
431 >    <antcall target="tck">
432 >      <param name="java.util.concurrent.ForkJoinPool.common.parallelism" value="0"/>
433 >    </antcall>
434 >  </target>
435 >
436 >  <target name="tck-security-manager"
437 >          description="Runs tck with a security manager">
438 >    <antcall target="tck">
439 >      <param name="jsr166.useSecurityManager" value="true"/>
440 >    </antcall>
441 >  </target>
442 >
443 >  <target name="jtreg"
444 >          depends="jar"
445 >          description="Runs jtreg tests for src/main using the jtreg ant task">
446 >    <run-jtreg-tests
447 >       target="${java.runtime.target}"
448 >       workdir="${build.dir}"
449 >       classes="${product.jar}"/>
450    </target>
451  
452 +  <target name="test"
453 +          depends="tck, tck-parallelism-1, tck-parallelism-0, jtreg"
454 +          description="Runs tck and jtreg tests for src/main"/>
455  
456 <  <target name="report-tests"
457 <          depends="run-tests">
458 <
459 <    <!-- Sets junit.report.format to frames if Xalan is present,
460 <         otherwise sets it to noframes. -->
461 <    <available property="junit.report.format"
462 <                  value="frames"
463 <              classname="org.apache.xalan.lib.Redirect"
464 <    />
465 <    <property name="junit.report.format" value="noframes"/>
466 <
467 <    <junitreport todir="${build.reports.dir}">
468 <      <fileset dir="${build.reports.dir}">
469 <        <include name="TEST-*.xml"/>
470 <      </fileset>
471 <      <report styledir="${stylesheet.dir}"
472 <                format="${junit.report.format}"
473 <                 todir="${build.reports.dir}"
474 <      />
475 <    </junitreport>
476 <
477 <    <fail message="Test Cases Failed" if="junit.failed"/>
478 <
456 >  <target name="test-version-permutations"
457 >          depends="test17, test19, clean, test, docs"
458 >          description="Runs tck and jtreg tests for various build-time and runtime java versions"/>
459 >
460 >
461 >  <target name="test17">
462 >    <antcall>
463 >      <param name="java.runtime.target" value="17"/>
464 >      <param name="build.main.javac" value="${javac17}"/>
465 >      <param name="build.main.javadoc" value="${javadoc17}"/>
466 >      <param name="build.main.javadoc.source" value="17"/>
467 >      <target name="clean"/>
468 >      <target name="test"/>
469 >      <target name="docs"/>
470 >    </antcall>
471 >  </target>
472 >  <target name="test19">
473 >    <antcall>
474 >      <param name="java.runtime.target" value="19"/>
475 >      <param name="build.main.javac" value="${javac19}"/>
476 >      <param name="build.main.javadoc" value="${javadoc19}"/>
477 >      <param name="build.main.javadoc.source" value="19"/>
478 >      <target name="clean"/>
479 >      <target name="test"/>
480 >      <target name="docs"/>
481 >    </antcall>
482    </target>
483  
484  
485    <target name="configure-compiler">
486 +    <fail message="ant version too old">
487 +      <condition> <not> <antversion atleast="1.9.1"/> </not> </condition>
488 +    </fail>
489  
490 <    <property name="gjc.version"
582 <             value="2.2"/>
490 >    <property name="unchecked.option" value="-Xlint:unchecked"/>
491  
492 <    <condition property="novariance.arg" value="-novariance">
493 <      <and>
586 <        <equals arg1="${gjc.version}" arg2="2.0"/>
587 <        <or>
588 <          <not><isset property="gjc.novariance"/></not>
589 <          <istrue value="${gjc.novariance}"/>
590 <        </or>
591 <      </and>
592 <    </condition>
593 <
594 <    <property name="novariance.arg"
595 <             value=""/>
596 <
597 <    <property name="gjc.dir"
598 <             value="${lib.dir}/gjc"/>
599 <
600 <    <property name="javac.jar"
601 <          location="${gjc.dir}/${gjc.version}/javac.jar"/>
602 <
603 <    <property name="collect.jar"
604 <          location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/>
605 <
606 <
607 <    <condition property="warnunchecked.arg" value="-warnunchecked">
608 <      <istrue value="${gjc.warnunchecked}"/>
492 >    <condition property="warnunchecked.arg" value="${unchecked.option}">
493 >      <istrue value="${build.warnunchecked}"/>
494      </condition>
495  
496      <property name="warnunchecked.arg" value=""/>
497  
613    <condition property="prepare.src.dir" value="${build.dir}/prepare-src">
614      <istrue value="${build.nothreads}"/>
615    </condition>
616
617
618    <!--
619     ! Bootclasspath munging for source compilation.
620     -->
621
622    <path id="pre.bootclasspath">
623      <pathelement location="${javac.jar}"/>
624    </path>
625
626    <path id="compile.bootclasspath">
627      <pathelement location="${build.classes.dir}"/>
628      <pathelement location="${collect.jar}"/>
629      <pathelement location="${rt.jar}"/>
630    </path>
631
632    <!-- Flatten paths into platform-appropriate strings -->
633    <property name="pre.bootclasspath"     refid="pre.bootclasspath"/>
634    <property name="compile.bootclasspath" refid="compile.bootclasspath"/>
635
498  
499      <!-- Common options in javac invocations -->
500 <    <property name="gjc.args"
639 <             value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}"
640 <    />
641 <
642 <  </target>
643 <
644 <
645 <  <target name="prepare-src"
646 <          depends="configure-compiler"
647 <          if="prepare.src.dir">
648 <
649 <    <mkdir dir="${prepare.src.dir}"/>
650 <    <copy todir="${prepare.src.dir}">
651 <      <fileset dir="${src.dir}">
652 <        <exclude name="java/lang/**"/>
653 <      </fileset>
654 <    </copy>
655 <
656 <  </target>
657 <
658 <
659 <  <target name="configure-emulation">
660 <
661 <    <condition property="build.emulation.true">
662 <      <or>
663 <        <and>
664 <          <os family="windows"/>
665 <          <not>
666 <            <isset property="build.emulation"/>
667 <          </not>
668 <        </and>
669 <        <istrue value="${build.emulation}"/>
670 <      </or>
671 <    </condition>
500 >    <property name="build.args" value="${warnunchecked.arg}"/>
501  
502    </target>
503  
504  
505 <  <target name="configure-tests"
506 <       depends="configure-compiler">
505 >  <target name="compile-test-loops" depends="jar"
506 >          description="Compiles all the perf tests in src/test/loops">
507  
508 <    <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 -->
680 <    <available property="junit.available"
681 <               classname="junit.framework.Protectable"/>
508 >    <mkdir dir="${build.dir}/test/loops"/>
509  
510 <    <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests"
511 <          unless="junit.available"/>
512 <
513 <
514 <    <!--
515 <     ! Bootclasspath munging for testing, so JUnit can test our local
516 <     ! modifications to java.*.
517 <     -->
518 <
519 <    <path id="test.classpath">
693 <      <pathelement location="${product.jar}"/>
694 <      <pathelement location="${build.testcases.dir}"/>
695 <      <pathelement location="${junit.jar}"/>
696 <    </path>
697 <
698 <    <path id="test.compile.bootclasspath">
699 <      <pathelement location="${javac.jar}"/>
700 <      <pathelement location="${collect.jar}"/>
701 <      <pathelement location="${rt.jar}"/>
702 <    </path>
703 <
704 <    <path id="test.run.bootclasspath">
705 <      <pathelement location="${javac.jar}"/>
706 <      <path refid="test.classpath"/>
707 <    </path>
708 <
709 <    <!-- Flatten test classpaths into platform-appropriate strings -->
710 <    <property name="test.classpath"             refid="test.classpath"/>
711 <    <property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/>
712 <    <property name="test.run.bootclasspath"     refid="test.run.bootclasspath"/>
510 >    <javac srcdir="${basedir}/src/test/loops"
511 >           destdir="${build.dir}/test/loops"
512 >           debug="${build.debug}"
513 >           debuglevel="${build.debuglevel}"
514 >           deprecation="${build.deprecation}"
515 >           includeAntRuntime="false"
516 >           includeJavaRuntime="false"
517 >           encoding="ASCII"
518 >           executable="${build.main.javac}"
519 >           fork="true">
520  
521 +      <include name="*.java"/>
522 +      <compilerarg value="-XDignore.symbol.file=true"/>
523 +      <compilerarg value="-Xlint:all,-unchecked,-rawtypes,-serial,-deprecation"/>
524 +      <compilerarg value="--patch-module=java.base=${src.dir}"/>
525 +      <compilerarg line="${build.args}"/>
526 +    </javac>
527    </target>
528  
529  
530 +  <!-- old branches no longer maintained.  build support deleted -->
531 +  <!-- jsr166 4jdk8; (no longer maintained as of 2019-10) -->
532 +  <!-- jsr166 4jdk7 (no longer maintained) -->
533 +  <!-- jsr166x (no longer maintained) -->
534 +  <!-- jsr166y (no longer maintained) -->
535 +  <!-- extra166y (no longer maintained) -->
536 +  <!-- jsr166e (no longer maintained) -->
537 +
538 + <!-- Find buglets that can be detected by static build tools -->
539 +
540 + <!--   <target name="lint"> -->
541 + <!--     <antcall target="dists"> -->
542 + <!--       <param name="build.javadoc.access" value="protected"/> -->
543 + <!--     </antcall> -->
544 + <!--   </target> -->
545 +
546 + <!-- Generates all doclint warnings, even for private methods (rarely useful) -->
547 +  <target name="doclint-private">
548 +    <antcall target="dist">
549 +      <param name="build.javadoc.access" value="private"/>
550 +    </antcall>
551 +  </target>
552 +
553 +
554 + <!-- ==============================================================
555 +  Experimental errorprone support
556 +  https://errorprone.info
557 +  https://errorprone.info/docs/installation
558 +  https://github.com/google/error-prone/issues/1143
559 + =================================================================== -->
560 +  <path id="errorprone.processorpath.path">
561 +    <pathelement location="${lib.dir}/error_prone_core-2.3.4-with-dependencies.jar"/>
562 +    <pathelement location="${lib.dir}/dataflow-2.5.7.jar"/>
563 +    <pathelement location="${lib.dir}/javacutil-2.5.7.jar"/>
564 +    <pathelement location="${lib.dir}/jFormatString-3.0.0.jar"/>
565 +    <pathelement location="${lib.dir}/caffeine-2.8.0.jar"/>
566 +  </path>
567 +  <property name="errorprone.processorpath" refid="errorprone.processorpath.path" />
568 +  <property name="errorprone.jsr166.user.flags" value=""/>
569 +  <property name="errorprone.jsr166.flags"
570 +            value="-Xep:HashtableContains:OFF
571 +                   -Xep:PreferJavaTimeOverload:OFF
572 +                   -Xep:JdkObsolete:OFF
573 +                   -Xep:MissingOverride:OFF
574 +                   -Xep:MissingFail:OFF
575 +                   -Xep:ThreadPriorityCheck:OFF
576 +                   -Xep:MixedArrayDimensions:ERROR
577 +                   -Xep:RemoveUnusedImports:ERROR
578 +                   -Xep:EmptyIf:ERROR
579 +                   -Xep:MultipleTopLevelClasses:ERROR
580 +                   -Xep:ClassName:ERROR
581 +                   -Xep:LongLiteralLowerCaseSuffix:ERROR
582 +                   -Xep:RedundantThrows:ERROR
583 +                   -Xep:IdentityBinaryExpression:WARN
584 +                   -Xep:ConstructorInvokesOverridable:WARN
585 +                   -Xep:MethodCanBeStatic:WARN
586 +                   ${errorprone.jsr166.user.flags}"/>
587 +  <!-- -Xep:WildcardImport:ERROR -->
588 +  <property name="errorprone.jsr166.test.flags"
589 +            value="-Xep:StringSplitter:OFF
590 +                   -Xep:BoxedPrimitiveConstructor:OFF
591 +                   -Xep:UnnecessaryParentheses:OFF
592 +                   -Xep:ModifyingCollectionWithItself:OFF"/>
593 +  <!-- ant -emacs errorprone |& grep -EA1 '(warning|error):|warnings' -->
594 +  <target name="errorprone"
595 +          depends="clean, configure-compiler"
596 +          description="Run errorprone over jsr166 source code (experimental)">
597 +
598 +    <local name="destdir"/>
599 +    <property name="destdir" value="${build.classes.dir}/java.base"/>
600 +    <mkdir dir="${destdir}"/>
601  
602 <  <!-- Anthill targets -->
603 <
604 <  <target name="anthill-build"
605 <          depends="jar, test, docs, dist-docs"/>
606 <
607 <  <target name="anthill-publish">
608 <
609 <    <copy todir="${deployDir}/docs/private">
610 <      <fileset dir="${build.javadocs.dir}"/>
611 <    </copy>
612 <
613 <    <copy todir="${deployDir}/docs/public">
614 <      <fileset dir="${dist.javadocs.dir}"/>
615 <    </copy>
616 <
617 <    <copy tofile="${deployDir}/index.html"
618 <          file="${basedir}/etc/anthill-index.html"/>
619 <
620 <    <copy todir="${deployDir}/notes">
621 <      <fileset dir="${basedir}/etc/notes"/>
622 <    </copy>
623 <
624 <  </target>
625 <
602 >    <javac srcdir="${src.dir}"
603 >           destdir="${destdir}"
604 >           debug="${build.debug}"
605 >           debuglevel="${build.debuglevel}"
606 >           deprecation="${build.deprecation}"
607 >           classpath=""
608 >           includeAntRuntime="false"
609 >           includeJavaRuntime="false"
610 >           encoding="ASCII"
611 >           executable="${build.main.javac}"
612 >           fork="true">
613 >
614 >      <include name="**/*.java"/>
615 >      <!-- Needed to silence -Xep:FutureReturnValueIgnored -->
616 >      <compilerarg value="-J--illegal-access=permit"/>
617 >      <compilerarg value="-XDcompilePolicy=simple"/>
618 >      <compilerarg value="-processorpath"/>
619 >      <compilerarg pathref="errorprone.processorpath.path"/>
620 >      <compilerarg value="-Xplugin:ErrorProne
621 >                          ${errorprone.jsr166.flags}"/>
622 >      <compilerarg value="--patch-module=java.base=${src.dir}"/>
623 >      <compilerarg value="-Xprefer:source"/>
624 >      <compilerarg value="-XDignore.symbol.file=true"/>
625 >      <compilerarg value="-Xlint:all"/>
626 >      <compilerarg value="-Xdoclint:all/protected,reference/private"/>
627 >      <!--      <compilerarg line="-Xmaxerrs 3000 -Xmaxwarns 3000"/> -->
628 >      <compilerarg line="-Xmaxerrs 3000 -Xmaxwarns 1"/>
629 >      <compilerarg line="${build.args}"/>
630 >    </javac>
631  
632 <  <target name="ng" depends="test">
633 <    <java classname="SuperfluousAbstract" fork="true">
632 >    <jar destfile="${product.jar}">
633 >      <fileset dir="${destdir}"/>
634 >    </jar>
635  
636 <      <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/>
636 >    <run-tck-tests
637 >      target="${java.runtime.target}"
638 >      workdir="${build.dir}"
639 >      classes="${product.jar}">
640 >      <javac-elements>
641 >        <!-- Needed to silence -Xep:FutureReturnValueIgnored -->
642 >        <compilerarg value="-J--illegal-access=permit"/>
643 >        <compilerarg value="-XDcompilePolicy=simple"/>
644 >        <compilerarg line="-processorpath ${errorprone.processorpath}"/>
645 >        <compilerarg value="-Xplugin:ErrorProne
646 >                            ${errorprone.jsr166.flags}
647 >                            ${errorprone.jsr166.test.flags}"/>
648 >        <!--      <compilerarg line="-Xmaxerrs 3000 -Xmaxwarns 3000"/> -->
649 >        <compilerarg line="-Xmaxerrs 3000 -Xmaxwarns 1"/>
650 >      </javac-elements>
651 >    </run-tck-tests>
652 >  </target>
653 >
654 >  <!-- ant -emacs errorprone-jtreg |& grep -EA1 '(warning|error):' -->
655 >  <!-- -XDcompilePolicy=simple or byfile avoids confusing UnusedImports -->
656 >  <target name="errorprone-jtreg"
657 >          depends="jar"
658 >          description="Run errorprone over jtreg tests (experimental)">
659 >
660 >    <run-jtreg-tests
661 >       target="${java.runtime.target}"
662 >       workdir="${build.dir}"
663 >       classes="${product.jar}"
664 >       verbose="all">
665 >      <jtreg-elements>
666 >        <arg value="-javacoption:-XDcompilePolicy=simple"/>
667 >        <arg value="-javacoption:-processorpath"/>
668 >        <arg value="-javacoption:${errorprone.processorpath}"/>
669 >        <arg value="-javacoption:-Xplugin:ErrorProne
670 >                            ${errorprone.jsr166.flags}
671 >                            ${errorprone.jsr166.test.flags}
672 >                            -Xep:MultipleTopLevelClasses:WARN
673 >                            -Xep:NonAtomicVolatileUpdate:OFF"/>
674 >      </jtreg-elements>
675 >    </run-jtreg-tests>
676 >  </target>
677 >
678 >
679 > <!-- ==============================================================
680 >  Running guava tests against jsr166 code
681 > =================================================================== -->
682 >
683 > <!-- <ivy:cachepath pathid="lib.path.id" inline="true" conf="*" -->
684 > <!--   organisation="com.google.guava" module="guava-testlib" revision="21.0"/> -->
685 > <!-- <property name="guava.version" value="21.0"/> -->
686 >
687 > <!-- HOWTO debug print a path id -->
688 > <!-- <pathconvert property="guava.testlib.classpath" refid="guava.testlib.classpath" /> -->
689 > <!-- <echo message="guava.testlib.classpath=${guava.testlib.classpath}"/> -->
690 >
691 > <!-- <ivy:retrieve pathid="guava.tests.classpath" type="jar" inline="true" conf="*" pattern="${lib.dir}/[type]/[artifact].[ext]" -->
692 > <!--   organisation="com.google.guava" module="guava-tests"/> -->
693 > <!-- <get src="http://repo2.maven.org/maven2/com/google/guava/guava-tests/${guava.version}/guava-tests-${guava.version}-tests.jar" -->
694 > <!--   dest="${lib.dir}/jar/guava-tests-tests.jar" usetimestamp="true"/> -->
695 > <!--     <ivy:cachepath pathid="lib.path.id" inline="true" conf="*" type="*" -->
696 > <!--       organisation="com.google.guava" module="guava-testlib" revision="${guava.version}"/> -->
697 >
698 > <!-- <test name="com.google.common.collect.testing.TestsForQueuesInJavaUtil"/> -->
699 > <!-- <test name="com.google.common.collect.testing.TestsForListsInJavaUtil"/> -->
700 > <!-- <test name="com.google.common.collect.testing.TestsForSetsInJavaUtil"/> -->
701 > <!-- <test name="com.google.common.collect.testing.TestsForMapsInJavaUtil"/> -->
702 >
703 > <!-- <ivy:retrieve pathid="guava.testlib.classpath" -->
704 > <!--   type="*" inline="true" conf="*(private),*(public)" -->
705 > <!--   pattern="${guava.dir}/[artifact].[ext]" -->
706 > <!--   organisation="com.google.guava" module="guava-testlib"/> -->
707 >
708 > <!-- Work around bug below by downloading guava-testlib-tests.jar "by hand": -->
709 > <!-- https://issues.apache.org/jira/browse/IVY-1444 -->
710 > <!-- maven tests artifacts cannot be downloaded because they are mapped to private configurations -->
711 >
712 >  <target name="init-ivy">
713 >    <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar"
714 >         dest="${build.dir}/ivy.jar" usetimestamp="true" skipexisting="true"/>
715 >    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
716 >             classpath="${build.dir}/ivy.jar"/>
717 >  </target>
718 >
719 >  <target name="guava-tests" depends="jar, init-ivy"
720 >          description="Guava tests run against jsr166 collections">
721 >    <property name="guava.dir" value="${build.dir}/guava-testlib"/>
722 >    <mkdir dir="${guava.dir}"/>
723 >    <ivy:retrieve pathid="guava.testlib.classpath"
724 >      type="jar,bundle" inline="true" conf="default,master"
725 >      pattern="${guava.dir}/[artifact].[ext]"
726 >      organisation="com.google.guava" module="guava-testlib"/>
727 >    <property name="guava.version" value="21.0"/>
728 >    <get src="http://repo2.maven.org/maven2/com/google/guava/guava-testlib/${guava.version}/guava-testlib-${guava.version}-tests.jar"
729 >         dest="${guava.dir}/guava-testlib-tests.jar" usetimestamp="true"/>
730 >    <junit printsummary="true" showoutput="true" haltonfailure="true"
731 >           jvm="${build.main.java}" fork="true">
732 >      <jvmarg line="-ea -esa --patch-module=java.base=${product.jar}"/>
733 >      <formatter type="brief"/>
734 >      <classpath>
735 >        <pathelement location="${guava.dir}/guava-testlib-tests.jar"/>
736 >        <path refid="guava.testlib.classpath"/>
737 >      </classpath>
738  
739 <    </java>
739 >      <!-- "6" in "OpenJdk6Tests" misleadingly means "6+" -->
740 >      <test name="com.google.common.collect.testing.OpenJdk6Tests"/>
741 >    </junit>
742    </target>
743  
751
744   </project>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines