build.xml revision 1408:33abf479f202
1105197Ssam<?xml version="1.0" encoding="UTF-8"?>
2105197Ssam<!--
3139823Simp Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
4105197Ssam DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5105197Ssam
6105197Ssam This code is free software; you can redistribute it and/or modify it
7105197Ssam under the terms of the GNU General Public License version 2 only, as
8105197Ssam published by the Free Software Foundation.  Oracle designates this
9105197Ssam particular file as subject to the "Classpath" exception as provided
10105197Ssam by Oracle in the LICENSE file that accompanied this code.
11105197Ssam
12105197Ssam This code is distributed in the hope that it will be useful, but WITHOUT
13105197Ssam ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14105197Ssam FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15105197Ssam version 2 for more details (a copy is included in the LICENSE file that
16105197Ssam accompanied this code).
17105197Ssam
18105197Ssam You should have received a copy of the GNU General Public License version
19105197Ssam 2 along with this work; if not, write to the Free Software Foundation,
20105197Ssam Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21105197Ssam
22105197Ssam Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23105197Ssam or visit www.oracle.com if you need additional information or have any
24105197Ssam questions.
25105197Ssam-->
26105197Ssam
27105197Ssam<!--
28105197Ssam This is the main build file for the complete langtools repository.
29105197Ssam It is used when building JDK (in which case it is invoked from the
30105197Ssam Makefile), and it can be used when working on the tools themselves,
31105197Ssam in an IDE such as NetBeans.
32105197Ssam
33105197Ssam External dependencies are specified via properties. These can be given
34105197Ssam on the command line, or by providing a local build.properties file.
35105197Ssam (They can also be edited into make/build.properties, although that is not
36105197Ssam recommended.)  At a minimum, boot.java.home must be set to the installed
37105197Ssam location of the version of JDK used to build this repository. Additional
38105197Ssam properties may be required, depending on the targets that are built.
39105197Ssam For example, to run any of the jtreg tests you must set jtreg.home,
40105197Ssam to run findbugs on the code you must set findbugs.home, and so on.
41105197Ssam
42105197Ssam For the most part, javac can be built using the previous version of JDK.
43105197Ssam However, a small number of javac files require access to the latest JDK,
44105197Ssam which may not yet have been compiled. To compile these files, you can do
45105197Ssam one of the following:
46105197Ssam - Set boot.java.home to a recent build of the latest version of JDK.
47105197Ssam - Set import.jdk to either a recent build (containing jre/lib/rt.jar)
48105197Ssam   or to jdk source repository.  In the latter case, stub files will
49105197Ssam   automatically be generated and used for the required API, to avoid
50105197Ssam   unnecessary compilation of the source repository.
51195699Srwatson If you do neither, the relevant files will not be built.
52105197Ssam
53105197Ssam The main build happens in two phases:
54105197Ssam - First, javac and other tools as needed are built using ${boot.java.home}.
55105197Ssam   (This implies a constraint on the source code that they can be compiled
56105197Ssam   with the previous version of JDK.
57105197Ssam - Second, all required classes are compiled with the latest javac, created
58105197Ssam   in the previous step.
59105197Ssam The first phase is called the bootstrap phase. All targets, properties and
60105197Ssam tasks that are specific to that phase have "bootstrap" in their name.
61105197Ssam
62105197Ssam For more details on the JDK build, see
63105197Ssam    http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build
64105197Ssam    http://openjdk.java.net/groups/build/
65105197Ssam For more details on the stub generator, see
66105197Ssam    http://blogs.sun.com/jjg/entry/building_javac_for_jdk7
67105197Ssam
68105197Ssam Internal details ...
69105197Ssam
70105197Ssam Interim build products are created in the build/ directory.
71105197Ssam Final build products are created in the dist/ directory.
72105197Ssam When building JDK, the dist/directory will contain:
73105197Ssam - A bootstrap compiler suitable for running with ${boot.java.home}
74105197Ssam   suitable for compiling downstream parts of JDK
75105197Ssam - Source files and class files for inclusion in the JDK being built
76105197Ssam When building standalone, the dist/directory will contain:
77105197Ssam - Separate jar files for each of the separate langtools components
78105197Ssam - Simple scripts to invoke the tools by executing the corresponding
79195699Srwatson   jar files.
80253088Sae These jar files and scripts are "for developer use only".
81253088Sae
82105197Ssam This file is organized into sections as follows:
83253088Sae - global property definitions
84253088Sae - general top level targets
85253088Sae - general diagnostic/debugging targets
86253088Sae - groups of targets for each tool: javac, javadoc, doclets, javah, javap
87105197Ssam    Within each group, the following targets are provided, where applicable
88195699Srwatson      build-bootstrap-TOOL      build the bootstrap version of the tool
89195699Srwatson      build-classes-TOOL        build the classes for the tool
90253088Sae      build-TOOL                build the jar file and script for the tool
91253088Sae      jtreg-TOOL                build the tool and run the appropriate tests
92253088Sae      findbugs-TOOL             run findbugs on the tool's source oode
93105197Ssam      TOOL                      build the tool, run the tests, and run findbugs
94105197Ssam - utility definitions
95105197Ssam -->
96105197Ssam
97105197Ssam<project name="langtools" default="build" basedir="..">
98105197Ssam    <!--
99105197Ssam    **** Global property definitions.
100105197Ssam    -->
101105197Ssam
102105197Ssam    <!-- Force full debuginfo for javac if the debug.classfiles
103105197Ssam    property is set.  This must be BEFORE the include of
104105197Ssam    build.properties because it sets javac.debuglevel.  -->
105105197Ssam    <condition property="javac.debuglevel" value="source,lines,vars">
106105197Ssam        <equals arg1="${debug.classfiles}" arg2="true"/>
107105197Ssam    </condition>
108105197Ssam
109105197Ssam    <!-- The following locations can be used to override default property values. -->
110105197Ssam
111105197Ssam    <!-- Use this location for customizations specific to this instance of this workspace -->
112105197Ssam    <property file="build.properties"/>
113105197Ssam
114105197Ssam    <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
115105197Ssam    <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
116105197Ssam
117105197Ssam    <!-- Use this location for customizations common to all OpenJDK workspaces -->
118105197Ssam    <property file="${user.home}/.openjdk/build.properties"/>
119105197Ssam
120105197Ssam    <!-- Convenient shorthands for standard locations within the workspace. -->
121169425Sgnn    <property name="build.dir" location="build"/>
122169425Sgnn    <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
123105197Ssam    <property name="build.coverage.dir" location="${build.dir}/coverage"/>
124105197Ssam    <property name="build.classes.dir" location="${build.dir}/classes"/>
125105197Ssam    <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
126105197Ssam    <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
127105197Ssam    <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
128105197Ssam    <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
129105197Ssam    <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
130105197Ssam    <property name="dist.dir" location="dist"/>
131105197Ssam    <property name="dist.bin.dir" location="${dist.dir}/bin"/>
132105197Ssam    <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
133105197Ssam    <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
134120585Ssam    <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/>
135120585Ssam    <property name="dist.lib.dir" location="${dist.dir}/lib"/>
136105197Ssam    <property name="make.dir" location="make"/>
137105197Ssam    <property name="make.conf.dir" location="${make.dir}/conf"/>
138105197Ssam    <property name="make.tools.dir" location="${make.dir}/tools"/>
139105197Ssam    <property name="src.dir" location="src"/>
140105197Ssam    <property name="src.bin.dir" location="${src.dir}/share/bin"/>
141105197Ssam    <property name="src.classes.dir" location="${src.dir}/share/classes"/>
142105197Ssam    <property name="test.dir" location="test"/>
143105197Ssam
144105197Ssam    <!-- java.marker is set to a marker file to check for within a Java install dir.
145105197Ssam         The best file to check for across Solaris/Linux/Windows/MacOS is one of the
146105197Ssam         executables; regrettably, that is OS-specific. -->
147105197Ssam    <condition property="java.marker" value="bin/java">
148105197Ssam        <os family="unix"/>
149105197Ssam    </condition>
150105197Ssam    <condition property="java.marker" value="bin/java.exe">
151105197Ssam        <os family="windows"/>
152105197Ssam    </condition>
153228012Spjd
154105197Ssam    <!-- Standard property values, if not overriden by earlier settings. -->
155105197Ssam    <property file="${make.dir}/build.properties"/>
156105197Ssam
157105197Ssam    <!-- launcher.java is used in the launcher scripts provided to run
158105197Ssam        the tools' jar files.  If it has not already been set, then
159105197Ssam        default it to use ${target.java.home}, if available, otherwise
160105197Ssam        quietly default to simply use "java". -->
161105197Ssam    <condition property="launcher.java"
162105197Ssam        value="${target.java.home}/bin/java" else="java">
163105197Ssam        <isset property="target.java.home"/>
164105197Ssam    </condition>
165105197Ssam
166105197Ssam    <!-- Logic for handling access import jdk classes, if available.
167105197Ssam        import.jdk should be unset, or set to jdk home (to use rt.jar)
168105197Ssam        or to jdk repo (to use src/share/classes).
169105197Ssam        Based on the value, if any, set up default values for javac's sourcepath,
170105197Ssam        classpath and bootclasspath. Note: the default values are overridden
171120585Ssam        in the build-bootstrap-classes macro. -->
172120585Ssam
173105197Ssam    <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
174105197Ssam        filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
175105197Ssam    <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
176120585Ssam        ignoresystemclasses="true"
177120585Ssam        classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
178105197Ssam
179105197Ssam    <!-- Set the default bootclasspath option used for javac.
180105197Ssam        Note that different variants of the option are used, meaning we can't just
181120585Ssam        define the value for the option.
182120585Ssam        Note the explicit use of the standard property ${path.separator} in the following.
183105197Ssam        This is because Ant is not clever enough to handle direct use of : or ; -->
184105197Ssam    <condition property="javac.bootclasspath.opt"
185105197Ssam            value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
186105197Ssam            else="-Xbootclasspath/p:${build.classes.dir}">
187120585Ssam        <isset property="import.jdk.jar"/>
188120585Ssam    </condition>
189105197Ssam
190105197Ssam    <condition property="boot.java.provides.latest.jdk">
191105197Ssam        <available
192105197Ssam            ignoresystemclasses="true"
193105197Ssam            classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
194105197Ssam    </condition>
195105197Ssam
196105197Ssam    <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">
197105197Ssam        <isset property="boot.java.provides.latest.jdk"/>
198105197Ssam    </condition>
199105197Ssam
200105197Ssam    <condition property="exclude.files" value="" else="${require.latest.jdk.files}">
201111119Simp        <or>
202105197Ssam            <isset property="boot.java.provides.latest.jdk"/>
203105197Ssam            <isset property="import.jdk"/>
204105197Ssam        </or>
205105197Ssam    </condition>
206105197Ssam
207105197Ssam    <condition property="require.import.jdk.stubs">
208105197Ssam        <and>
209105197Ssam            <not>
210105197Ssam                <isset property="boot.java.provides.latest.jdk"/>
211105197Ssam            </not>
212105197Ssam            <isset property="import.jdk.src.dir"/>
213105197Ssam        </and>
214105197Ssam    </condition>
215105197Ssam
216105197Ssam    <!-- Set the default value of the sourcepath used for javac. -->
217105197Ssam    <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
218105197Ssam        <isset property="require.import.jdk.stubs"/>
219105197Ssam    </condition>
220105197Ssam
221157123Sgnn    <!-- Set the default value of the classpath used for javac. -->
222105197Ssam    <property name="javac.classpath" value=""/>
223105197Ssam
224105197Ssam
225105197Ssam    <!--
226105197Ssam    **** General top level targets.
227105197Ssam    -->
228181803Sbz
229105197Ssam    <!-- Standard target to build deliverables for JDK build. -->
230105197Ssam
231181803Sbz    <target name="build" depends="build-bootstrap-tools,build-all-classes">
232105197Ssam        <copy todir="${dist.dir}/bootstrap">
233105197Ssam            <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
234181803Sbz        </copy>
235105197Ssam        <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
236105197Ssam            <include name="*"/>
237120585Ssam        </chmod>
238120585Ssam        <mkdir dir="${dist.lib.dir}"/>
239105197Ssam        <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
240105197Ssam        <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
241105197Ssam    </target>
242105197Ssam
243105197Ssam    <target name="build-bootstrap-tools"
244105197Ssam        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
245105197Ssam    />
246105197Ssam
247105197Ssam    <target name="build-all-tools"
248105197Ssam        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap"
249105197Ssam    />
250105197Ssam
251105197Ssam    <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
252105197Ssam        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes}"/>
253105197Ssam    </target>
254157123Sgnn
255120585Ssam    <!-- clean -->
256120585Ssam
257120585Ssam    <target name="clean" description="Delete all generated files">
258120585Ssam        <delete dir="${build.dir}"/>
259105197Ssam        <delete dir="${dist.dir}"/>
260105197Ssam    </target>
261105197Ssam
262105197Ssam    <!-- Additional targets for running tools on the build -->
263105197Ssam
264105197Ssam    <target name="jtreg" depends="build-all-tools,-def-jtreg">
265105197Ssam        <jtreg-tool name="all" tests="${jtreg.tests}"/>
266105197Ssam    </target>
267105197Ssam
268105197Ssam    <target name="checkstyle" depends="-def-checkstyle"
269105197Ssam        description="Generates reports for code convention violations.">
270105197Ssam        <mkdir dir="${dist.checkstyle.dir}"/>
271105197Ssam        <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"
272105197Ssam              failureProperty="checkstyle.failure"
273105197Ssam              failOnViolation="false">
274105197Ssam            <formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/>
275105197Ssam            <fileset dir="src" includes="**/*.java, **/*.properties"/>
276105197Ssam        </checkstyle>
277105197Ssam        <!-- transform the output to a simple html -->
278105197Ssam        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
279105197Ssam               out="${dist.checkstyle.dir}/checkstyle_report.html"
280105197Ssam               style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>
281120585Ssam        <!-- transform the output to a very simple emacs friendly text file -->
282120585Ssam        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
283105197Ssam               out="${dist.checkstyle.dir}/checkstyle_report.tmp"
284197674Svanhu               style="${make.conf.dir}/checkstyle-emacs.xsl"/>
285197674Svanhu        <!-- beautify remove extra lines -->
286197674Svanhu        <move file="${dist.checkstyle.dir}/checkstyle_report.tmp"
287197674Svanhu             toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt">
288252028Sae            <filterchain>
289197674Svanhu                <ignoreblank/>
290197674Svanhu                <replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/>
291197674Svanhu            </filterchain>
292197674Svanhu        </move>
293105197Ssam    </target>
294105197Ssam    <!-- target can be invoked from an ide, the output of which can be used
295105197Ssam         to access and fix the errors directly.
296105197Ssam     -->
297105197Ssam    <target name="checkstyle-ide" depends="checkstyle">
298105197Ssam        <concat>
299105197Ssam            <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/>
300105197Ssam        </concat>
301105197Ssam    </target>
302105197Ssam
303105197Ssam    <target name="findbugs" depends="-def-findbugs,build-all-tools">
304105197Ssam        <property name="findbugs.reportLevel" value="medium"/>
305218794Svanhu        <mkdir dir="${dist.findbugs.dir}"/>
306218794Svanhu        <findbugs
307218794Svanhu            home="${findbugs.home}"
308218794Svanhu            projectName="JDK langtools ${full.version}"
309218794Svanhu            output="xml"
310218794Svanhu            outputFile="${dist.findbugs.dir}/findbugs.xml"
311218794Svanhu            reportLevel="${findbugs.reportLevel}"
312218794Svanhu            failOnError="false"
313218794Svanhu            errorProperty="findbugs.all.errors"
314218794Svanhu            warningsProperty="findbugs.all.warnings"
315218794Svanhu            jvm="${target.java.home}/bin/java"
316218794Svanhu            jvmargs="-Xmx512M">
317218794Svanhu            <class location="${build.classes.dir}"/>
318105197Ssam            <sourcePath>
319105197Ssam                <pathelement location="${src.classes.dir}"/>
320105197Ssam            </sourcePath>
321105197Ssam        </findbugs>
322105197Ssam        <exec executable="sh">
323105197Ssam            <arg value="${findbugs.home}/bin/convertXmlToText"/>
324105197Ssam            <arg value="-longBugCodes"/>
325105197Ssam            <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
326105197Ssam            <arg value="${dist.findbugs.dir}/findbugs.xml"/>
327105197Ssam            <redirector output="${dist.findbugs.dir}/findbugs.html"/>
328105197Ssam        </exec>
329120585Ssam    </target>
330120585Ssam
331105197Ssam    <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
332105197Ssam
333105197Ssam    <target name="instrument-classes" depends="-def-cobertura">
334252028Sae        <!-- only define the following property when we want coverage info -->
335105197Ssam        <path id="coverage.classpath">
336105197Ssam            <pathelement location="${build.coverage.dir}/classes"/>
337105197Ssam            <path refid="cobertura.classpath"/>
338105197Ssam        </path>
339105197Ssam        <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
340105197Ssam        <property name="coverage.classpath" refid="coverage.classpath"/>
341105197Ssam        <mkdir dir="${build.coverage.dir}/classes"/>
342105197Ssam        <delete file="${build.coverage.dir}/cobertura.ser"/>
343120585Ssam        <cobertura-instrument todir="${build.coverage.dir}/classes"
344105197Ssam            datafile="${build.coverage.dir}/cobertura.ser">
345252028Sae            <fileset dir="${build.classes.dir}"
346105197Ssam               includes="**/*.class" excludes="**/resources/*.class"/>
347105197Ssam        </cobertura-instrument>
348105197Ssam    </target>
349105197Ssam
350105197Ssam    <target name="coverage-report" depends="-def-cobertura">
351252028Sae        <mkdir dir="${dist.coverage.dir}"/>
352105197Ssam        <cobertura-report
353105197Ssam            srcdir="${src.classes.dir}"
354105197Ssam            destdir="${dist.coverage.dir}"
355105197Ssam            datafile="${build.coverage.dir}/cobertura.ser"/>
356105197Ssam        <cobertura-report
357105197Ssam            format="xml"
358105197Ssam            srcdir="${src.classes.dir}"
359105197Ssam            destdir="${dist.coverage.dir}"
360105197Ssam            datafile="${build.coverage.dir}/cobertura.ser"/>
361105197Ssam    </target>
362105197Ssam
363105197Ssam    <target name="diags-examples" depends="build-javac">
364105197Ssam        <!-- can override the following on the command line if desired. -->
365105197Ssam        <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
366105197Ssam        <mkdir dir="${build.dir}/diag-examples/classes"/>
367105197Ssam        <javac fork="true"
368120585Ssam            executable="${dist.bin.dir}/javac"
369120585Ssam            srcdir="test/tools/javac/diags"
370252028Sae            destdir="${build.dir}/diag-examples/classes"
371105197Ssam            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
372105197Ssam            sourcepath=""
373105197Ssam            classpath="${dist.lib.dir}/javac.jar"
374105197Ssam            includeAntRuntime="no"
375105197Ssam            debug="${javac.debug}"
376105197Ssam            debuglevel="${javac.debuglevel}">
377105197Ssam            <compilerarg line="${javac.lint.opts}"/>
378105197Ssam        </javac>
379105197Ssam        <java fork="true"
380105197Ssam            jvm="${target.java.home}/bin/java"
381105197Ssam            dir="test/tools/javac/diags"
382105197Ssam            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
383105197Ssam            classname="RunExamples">
384120585Ssam            <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
385252028Sae            <arg value="-examples"/>
386105197Ssam            <arg value="examples"/>
387105197Ssam            <arg value="-o"/>
388105197Ssam            <arg file="${diags.examples.out}"/>
389105197Ssam            <arg value="-showFiles"/>
390105197Ssam            <arg value="-title"/>
391105197Ssam            <arg value="Examples of javac diagnostics"/>
392105197Ssam        </java>
393105197Ssam    </target>
394105197Ssam
395120585Ssam    <!-- a patching facility to speed up incorporating the langtools' classfiles
396105197Ssam         into a jdk of your choice. Either target.java.home or patch.jdk can be
397105197Ssam         set on the command line; setting target.java.home has the advantage of
398105197Ssam         patching the jdk used for jtreg and other tests.
399105197Ssam    -->
400105197Ssam    <target name="patch" depends="build-all-classes">
401105197Ssam        <condition property="patch.jdk" value="${target.java.home}">
402105197Ssam            <available file="${target.java.home}" type="dir"/>
403157123Sgnn        </condition>
404105197Ssam        <fail message="patch.jdk or target.java.home is not set, please set target.java.home, or patch.jdk for an alternate jdk image to patch">
405105197Ssam            <condition>
406105197Ssam                <not>
407105197Ssam                    <isset property="patch.jdk"/>
408105197Ssam                </not>
409105197Ssam            </condition>
410105197Ssam        </fail>
411105197Ssam        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
412105197Ssam        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
413105197Ssam        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
414105197Ssam            <condition>
415105197Ssam                <not>
416105197Ssam                    <available file="${patch.tools.jar}" type="file"/>
417105197Ssam                </not>
418105197Ssam            </condition>
419117058Ssam        </fail>
420105197Ssam        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
421105197Ssam            <condition>
422105197Ssam                <not>
423105197Ssam                    <available file="${patch.rt.jar}" type="file"/>
424105197Ssam                </not>
425105197Ssam            </condition>
426105197Ssam        </fail>
427105197Ssam        <zip zipfile="${patch.tools.jar}" update="true">
428105197Ssam            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
429105197Ssam        </zip>
430105197Ssam        <zip zipfile="${patch.rt.jar}" update="true">
431220206Sfabient            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
432220206Sfabient        </zip>
433105197Ssam    </target>
434105197Ssam
435105197Ssam    <!--
436120585Ssam    **** Debugging/diagnostic targets.
437105197Ssam    -->
438105197Ssam
439105197Ssam    <!-- standard JDK target -->
440105197Ssam    <target name="sanity"
441105197Ssam        description="display settings of configuration values">
442157123Sgnn        <echo level="info">ant.home = ${ant.home}</echo>
443105197Ssam        <echo level="info">boot.java.home = ${boot.java.home}</echo>
444105197Ssam        <echo level="info">target.java.home = ${target.java.home}</echo>
445105197Ssam        <echo level="info">jtreg.home = ${jtreg.home}</echo>
446105197Ssam        <echo level="info">findbugs.home = ${findbugs.home}</echo>
447105197Ssam        <echo level="info">checkstyle.home = ${checkstyle.home}</echo>
448105197Ssam    </target>
449105197Ssam
450105197Ssam    <target name="post-sanity" depends="-def-jtreg,sanity,build"
451105197Ssam        description="perform basic validation after a standard build">
452105197Ssam        <jtreg
453105197Ssam            dir="make/test"
454105197Ssam            workDir="${build.jtreg.dir}/post-sanity/work"
455105197Ssam            reportDir="${build.jtreg.dir}/post-sanity/report"
456105197Ssam            jdk="${target.java.home}"
457105197Ssam            verbose="summary"
458105197Ssam            failonerror="false" resultproperty="jtreg.post-sanity.result">
459218794Svanhu        </jtreg>
460218794Svanhu    </target>
461105197Ssam
462105197Ssam    <!-- use vizant tool to generate graphical image of this Ant file.-->
463105197Ssam    <target name="vizant" depends="-def-vizant">
464105197Ssam        <mkdir dir="${build.dir}"/>
465105197Ssam        <echo message="Generating ${build.dir}/build.dot"/>
466105197Ssam        <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
467105197Ssam        <echo message="Generating ${build.dir}/build.png"/>
468105197Ssam        <exec executable="${dot}" >
469105197Ssam            <arg value="-Tpng"/>
470105197Ssam            <arg value="-o"/>
471105197Ssam            <arg file="${build.dir}/build.png"/>
472120585Ssam            <arg file="${build.dir}/build.dot"/>
473105197Ssam        </exec>
474105197Ssam    </target>
475120585Ssam
476105197Ssam    <target name="check-import.jdk">
477105197Ssam        <echo message="import.jdk: ${import.jdk}"/>
478105197Ssam        <echo message="import.jdk.jar: ${import.jdk.jar}"/>
479105197Ssam        <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
480105197Ssam    </target>
481220206Sfabient
482220206Sfabient    <target name="diagnostics">
483105197Ssam        <diagnostics/>
484105197Ssam    </target>
485120585Ssam
486105197Ssam
487120585Ssam    <!--
488105197Ssam    **** javac targets.
489105197Ssam    -->
490105197Ssam
491105197Ssam    <target name="build-bootstrap-javac"
492105197Ssam            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
493105197Ssam        <build-bootstrap-classes includes="${javac.includes}"/>
494105197Ssam        <build-bootstrap-jar     name="javac" includes="${javac.includes}"/>
495105197Ssam        <build-bootstrap-tool    name="javac"/>
496105197Ssam    </target>
497105197Ssam
498228009Spjd    <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
499228009Spjd        <build-classes includes="${javac.includes}"/>
500105197Ssam    </target>
501252028Sae
502120585Ssam    <target name="build-javac" depends="build-classes-javac">
503105197Ssam        <build-jar  name="javac" includes="${javac.includes}"/>
504105197Ssam        <build-tool name="javac"/>
505105197Ssam    </target>
506105197Ssam
507105197Ssam    <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
508105197Ssam        <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls.option}"/>
509252028Sae    </target>
510120585Ssam
511105197Ssam    <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
512105197Ssam        <jtreg-tool name="javac" tests="${javac.tests}"/>
513105197Ssam    </target>
514252028Sae
515105197Ssam    <target name="findbugs-javac" depends="build-javac,-def-findbugs">
516105197Ssam        <findbugs-tool name="javac"/>
517105197Ssam    </target>
518218794Svanhu
519218794Svanhu    <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
520218794Svanhu
521218794Svanhu
522218794Svanhu    <!--
523218794Svanhu    **** javadoc targets.
524218794Svanhu    -->
525218794Svanhu
526218794Svanhu    <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
527218794Svanhu        <build-bootstrap-classes includes="${javadoc.includes}"/>
528105197Ssam        <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
529105197Ssam                                 jarclasspath="javac.jar doclets.jar"/>
530105197Ssam        <build-bootstrap-tool    name="javadoc"/>
531105197Ssam    </target>
532105197Ssam
533252028Sae    <target name="build-classes-javadoc" depends="build-classes-javac">
534105197Ssam        <build-classes includes="${javadoc.includes}"/>
535105197Ssam    </target>
536218794Svanhu
537218794Svanhu    <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
538105197Ssam        <build-jar  name="javadoc" includes="${javadoc.includes}"
539105197Ssam                    jarclasspath="javac.jar doclets.jar"/>
540105197Ssam        <build-tool name="javadoc"/>
541105197Ssam    </target>
542218794Svanhu
543120585Ssam    <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
544105197Ssam        <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
545120585Ssam    </target>
546105197Ssam
547105197Ssam    <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
548252028Sae        <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
549105197Ssam    </target>
550105197Ssam
551105197Ssam    <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
552105197Ssam        <findbugs-tool name="javadoc"/>
553105197Ssam    </target>
554105197Ssam
555218794Svanhu    <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
556105197Ssam
557105197Ssam
558105197Ssam    <!--
559105197Ssam    **** doclets targets.
560105197Ssam    -->
561105197Ssam
562105197Ssam    <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
563105197Ssam        <build-bootstrap-classes includes="${doclets.includes}"/>
564105197Ssam        <build-bootstrap-jar     name="doclets" includes="${doclets.includes}"
565105197Ssam                                 jarmainclass="com.sun.tools.javadoc.Main"
566105197Ssam                                 jarclasspath="javadoc.jar"/>
567156997Scperciva    </target>
568156997Scperciva
569156997Scperciva    <target name="build-classes-doclets" depends="build-classes-javadoc">
570156997Scperciva        <build-classes includes="${doclets.includes}"/>
571156997Scperciva    </target>
572156997Scperciva
573156997Scperciva    <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
574156997Scperciva        <!-- just jar, no bin for doclets -->
575156997Scperciva        <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
576156997Scperciva    </target>
577156997Scperciva
578252028Sae    <!-- (no javadoc for doclets) -->
579156997Scperciva
580156997Scperciva    <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
581156997Scperciva        <jtreg-tool name="doclets" tests="${doclets.tests}"/>
582156997Scperciva    </target>
583156997Scperciva
584105197Ssam    <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
585105197Ssam        <findbugs-tool name="doclets"/>
586105197Ssam    </target>
587105197Ssam
588105197Ssam    <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
589105197Ssam
590105197Ssam
591105197Ssam    <!--
592105197Ssam    **** javah targets.
593252028Sae    -->
594120585Ssam
595105197Ssam    <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
596105197Ssam        <build-bootstrap-classes includes="${javah.includes}"/>
597105197Ssam        <build-bootstrap-jar     name="javah" includes="${javah.includes}"
598105197Ssam                                 jarclasspath="javadoc.jar doclets.jar javac.jar"/>
599105197Ssam        <build-bootstrap-tool    name="javah"/>
600105197Ssam    </target>
601105197Ssam
602105197Ssam    <target name="build-javah" depends="build-javac,build-classes-javah">
603105197Ssam        <build-jar  name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
604105197Ssam        <build-tool name="javah"/>
605252028Sae    </target>
606120585Ssam
607120585Ssam    <target name="build-classes-javah" depends="build-classes-javadoc">
608105197Ssam        <build-classes includes="${javah.includes}"/>
609105197Ssam    </target>
610105197Ssam
611105197Ssam    <!-- (no javadoc for javah) -->
612105197Ssam
613105197Ssam    <target name="jtreg-javah" depends="build-javah,-def-jtreg">
614105197Ssam        <jtreg-tool name="javah" tests="${javah.tests}"/>
615105197Ssam    </target>
616105197Ssam
617105197Ssam    <target name="findbugs-javah" depends="build-javah,-def-findbugs">
618252028Sae        <findbugs-tool name="javah"/>
619120585Ssam    </target>
620120585Ssam
621105197Ssam    <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
622105197Ssam
623105197Ssam
624105197Ssam    <!--
625105197Ssam    **** javap targets.
626105197Ssam    -->
627105197Ssam
628105197Ssam    <target name="build-bootstrap-javap"
629105197Ssam            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
630105197Ssam        <build-bootstrap-classes includes="${javap.includes}"/>
631105197Ssam        <build-bootstrap-jar     name="javap" includes="${javap.includes}"
632105197Ssam                                 jarmainclass="sun.tools.javap.Main"/>
633105197Ssam        <build-bootstrap-tool    name="javap"/>
634221129Sbz    </target>
635221129Sbz
636221129Sbz    <target name="build-classes-javap" depends="build-classes-javac">
637221129Sbz        <build-classes includes="${javap.includes}"/>
638221129Sbz    </target>
639221129Sbz
640221129Sbz    <target name="build-javap" depends="build-javac,build-classes-javap">
641221129Sbz        <build-jar  name="javap" includes="${javap.includes}"
642221129Sbz                    jarmainclass="com.sun.tools.javap.Main"
643221129Sbz                    jarclasspath="javac.jar"/>
644221129Sbz        <build-tool name="javap"/>
645221129Sbz    </target>
646221129Sbz
647221129Sbz    <!-- (no javadoc for javap) -->
648221129Sbz
649105197Ssam    <target name="jtreg-javap" depends="build-javap,-def-jtreg">
650105197Ssam        <jtreg-tool name="javap" tests="${javap.tests}"/>
651105197Ssam    </target>
652105197Ssam
653105197Ssam    <target name="findbugs-javap" depends="build-javap,-def-findbugs">
654105197Ssam        <findbugs-tool name="javap"/>
655105197Ssam    </target>
656105197Ssam
657105197Ssam    <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
658105197Ssam
659105197Ssam
660105197Ssam    <!--
661105197Ssam    **** Create import JDK stubs.
662105197Ssam    -->
663105197Ssam
664105197Ssam    <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
665105197Ssam        <mkdir dir="${build.genstubs.dir}"/>
666105197Ssam        <genstubs
667105197Ssam            srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
668105197Ssam            includes="${import.jdk.stub.files}"
669105197Ssam            fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"
670105197Ssam        />
671105197Ssam    </target>
672105197Ssam
673105197Ssam
674105197Ssam    <!--
675105197Ssam    **** Check targets.
676105197Ssam    **** "-check-*" targets check that a required property is set, and set to a reasonable value.
677105197Ssam    **** A user friendly message is generated if not, and the build exits.
678228014Spjd    -->
679105197Ssam
680105197Ssam    <target name="-check-boot.java.home" depends="-def-check">
681105197Ssam        <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
682105197Ssam    </target>
683105197Ssam
684105197Ssam    <target name="-check-target.java.home" depends="-def-check">
685105197Ssam        <check name="target java" property="target.java.home" marker="${java.marker}"/>
686105197Ssam    </target>
687105197Ssam
688105197Ssam    <target name="-check-cobertura.home" depends="-def-check">
689105197Ssam        <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
690105197Ssam    </target>
691120585Ssam
692105197Ssam    <target name="-check-findbugs.home" depends="-def-check">
693105197Ssam        <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
694120585Ssam    </target>
695105197Ssam
696105197Ssam    <target name="-check-checkstyle.home" depends="-def-check">
697105197Ssam        <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
698105197Ssam    </target>
699105197Ssam
700105197Ssam    <target name="-check-jtreg.home" depends="-def-check">
701105197Ssam        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
702105197Ssam    </target>
703105197Ssam
704105197Ssam    <target name="-check-vizant" depends="-def-check">
705105197Ssam        <check name="vizant" property="vizant.jar"/>
706105197Ssam        <check name="dot" property="dot"/>
707105197Ssam    </target>
708105197Ssam
709105197Ssam
710105197Ssam    <!--
711105197Ssam    **** Targets for Ant macro and task definitions.
712218794Svanhu    -->
713218794Svanhu
714218794Svanhu    <target name="-def-build-tool">
715218794Svanhu        <macrodef name="build-tool">
716218794Svanhu            <attribute name="name"/>
717218794Svanhu            <attribute name="bin.dir" default="${dist.bin.dir}"/>
718218794Svanhu            <attribute name="java" default="${launcher.java}"/>
719105197Ssam            <sequential>
720218794Svanhu                <mkdir dir="@{bin.dir}"/>
721218794Svanhu                <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
722105197Ssam                    <filterset begintoken="#" endtoken="#">
723105197Ssam                        <filter token="PROGRAM" value="@{name}"/>
724105197Ssam                        <filter token="TARGET_JAVA" value="@{java}"/>
725252028Sae                        <filter token="PS" value="${path.separator}"/>
726105197Ssam                    </filterset>
727105197Ssam                </copy>
728105197Ssam                <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
729105197Ssam            </sequential>
730105197Ssam        </macrodef>
731105197Ssam    </target>
732105197Ssam
733105197Ssam    <target name="-def-build-jar">
734105197Ssam        <macrodef name="build-jar">
735105197Ssam            <attribute name="name"/>
736105197Ssam            <attribute name="includes"/>
737105197Ssam            <attribute name="classes.dir" default="${build.classes.dir}"/>
738105197Ssam            <attribute name="lib.dir" default="${dist.lib.dir}"/>
739105197Ssam            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
740105197Ssam            <attribute name="jarclasspath" default=""/>
741120585Ssam            <sequential>
742120585Ssam                <mkdir dir="@{lib.dir}"/>
743105197Ssam                <jar destfile="@{lib.dir}/@{name}.jar"
744105197Ssam                     basedir="@{classes.dir}"
745252028Sae                     includes="@{includes}">
746105197Ssam                    <manifest>
747105197Ssam                        <attribute name="Main-Class" value="@{jarmainclass}"/>
748105197Ssam                        <attribute name="Class-Path" value="@{jarclasspath}"/>
749105197Ssam                    </manifest>
750120585Ssam                </jar>
751120585Ssam            </sequential>
752105197Ssam        </macrodef>
753105197Ssam    </target>
754252028Sae
755105197Ssam    <target name="-def-build-classes" depends="-def-pcompile">
756105197Ssam        <macrodef name="build-classes">
757105197Ssam            <attribute name="includes"/>
758105197Ssam            <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
759105197Ssam            <attribute name="classes.dir" default="${build.classes.dir}"/>
760252028Sae            <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
761105197Ssam            <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
762156756Ssam            <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
763105197Ssam            <attribute name="classpath" default="${javac.classpath}"/>
764120585Ssam            <attribute name="sourcepath" default="${javac.sourcepath}"/>
765105197Ssam            <attribute name="java.home" default="${boot.java.home}"/>
766252028Sae            <attribute name="source" default="${javac.source}"/>
767105197Ssam            <attribute name="target" default="${javac.target}"/>
768105197Ssam            <attribute name="release" default="${release}"/>
769105197Ssam            <attribute name="full.version" default="${full.version}"/>
770105197Ssam            <sequential>
771105197Ssam                <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
772105197Ssam                <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
773105197Ssam                <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
774120585Ssam                <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
775120585Ssam                <mkdir dir="@{gensrc.dir}"/>
776105197Ssam                <mkdir dir="@{classes.dir}"/>
777252028Sae                <pcompile srcdir="${src.classes.dir}"
778105197Ssam                          destdir="@{gensrc.dir}"
779105197Ssam                          includes="@{includes}"/>
780105197Ssam                <copy todir="@{gensrc.dir}">
781105197Ssam                    <fileset dir="${src.classes.dir}" includes="@{includes}"/>
782105197Ssam                    <globmapper from="*.properties-template" to="*.properties"/>
783105197Ssam                    <filterset begintoken="$(" endtoken=")">
784105197Ssam                        <filter token="JDK_VERSION" value="${jdk.version}"/>
785157613Spjd                        <filter token="RELEASE" value="@{release}"/>
786157613Spjd                        <filter token="FULL_VERSION" value="@{full.version}"/>
787157634Spjd                    </filterset>
788157613Spjd                </copy>
789181803Sbz                <pcompile srcdir="@{gensrc.dir}"
790157634Spjd                          destdir="@{gensrc.dir}"
791157613Spjd                          includes="**/*.properties"/>
792157613Spjd                <javac fork="true"
793105197Ssam                       executable="@{java.home}/bin/javac"
794105197Ssam                       srcdir="${src.classes.dir}:@{gensrc.dir}"
795105197Ssam                       destdir="@{classes.dir}"
796105197Ssam                       includes="@{includes}"
797105197Ssam                       excludes="@{excludes}"
798105197Ssam                       sourcepath="@{sourcepath}"
799105197Ssam                       classpath="@{classpath}"
800105197Ssam                       includeAntRuntime="no"
801105197Ssam                       source="@{source}"
802105197Ssam                       target="@{target}"
803105197Ssam                       debug="${javac.debug}"
804120585Ssam                       debuglevel="${javac.debuglevel}">
805105197Ssam                    <compilerarg value="-implicit:none"/>
806105197Ssam                    <compilerarg value="-Xprefer:source"/>
807105197Ssam                    <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
808105197Ssam                    <compilerarg line="@{bootclasspath.opt}"/>
809105197Ssam                    <compilerarg line="${javac.no.jdk.warnings}"/>
810105197Ssam                    <compilerarg line="${javac.version.opt}"/>
811105197Ssam                    <compilerarg line="${javac.lint.opts}"/>
812105197Ssam                </javac>
813105197Ssam                <copy todir="@{classes.dir}" includeemptydirs="false">
814105197Ssam                    <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
815105197Ssam                        <exclude name="**/*.java"/>
816105197Ssam                        <exclude name="**/*.properties"/>
817105197Ssam                        <exclude name="**/*-template"/>
818105197Ssam                        <exclude name="**/*.rej"/>
819105197Ssam                        <exclude name="**/*.orig"/>
820105197Ssam                        <exclude name="**/overview.html"/>
821105197Ssam                        <exclude name="**/package.html"/>
822105197Ssam                    </fileset>
823105197Ssam                </copy>
824105197Ssam            </sequential>
825105197Ssam        </macrodef>
826105197Ssam    </target>
827105197Ssam
828105197Ssam    <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
829105197Ssam        <presetdef name="build-bootstrap-tool">
830105197Ssam            <build-tool
831105197Ssam                bin.dir="${build.bootstrap.dir}/bin"
832105197Ssam                java="${boot.java}"/>
833105197Ssam        </presetdef>
834105197Ssam    </target>
835105197Ssam
836105197Ssam    <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
837105197Ssam        <presetdef name="build-bootstrap-jar">
838105197Ssam            <build-jar
839120585Ssam                classes.dir="${build.bootstrap.dir}/classes"
840120585Ssam                lib.dir="${build.bootstrap.dir}/lib"/>
841252028Sae        </presetdef>
842105197Ssam    </target>
843105197Ssam
844105197Ssam    <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
845105197Ssam        <presetdef name="build-bootstrap-classes">
846105197Ssam            <build-classes
847105197Ssam                source="${boot.javac.source}"
848105197Ssam                target="${boot.javac.target}"
849105197Ssam                gensrc.dir="${build.bootstrap.dir}/gensrc"
850105197Ssam                classes.dir="${build.bootstrap.dir}/classes"
851105197Ssam                javac.bootclasspath=""
852105197Ssam                bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
853105197Ssam                sourcepath=""
854105197Ssam                release="${bootstrap.release}"
855105197Ssam                full.version="${bootstrap.full.version}"
856105197Ssam                excludes="${bootstrap.exclude.files} **/package-info.java"/>
857105197Ssam        </presetdef>
858157123Sgnn    </target>
859105197Ssam
860105197Ssam    <target name="-def-pcompile">
861105197Ssam        <mkdir dir="${build.toolclasses.dir}"/>
862105197Ssam        <javac fork="true"
863105197Ssam               source="${boot.javac.source}"
864105197Ssam               target="${boot.javac.target}"
865105197Ssam               executable="${boot.java.home}/bin/javac"
866105197Ssam               srcdir="${make.tools.dir}"
867105197Ssam               includes="compileproperties/* anttasks/CompileProperties*"
868105197Ssam               destdir="${build.toolclasses.dir}/"
869120585Ssam               classpath="${ant.core.lib}"
870252028Sae               bootclasspath="${boot.java.home}/jre/lib/rt.jar"
871105197Ssam               includeantruntime="false">
872105197Ssam            <compilerarg line="${javac.lint.opts}"/>
873105197Ssam        </javac>
874105197Ssam        <taskdef name="pcompile"
875105197Ssam                 classname="anttasks.CompilePropertiesTask"
876105197Ssam                 classpath="${build.toolclasses.dir}/"/>
877220206Sfabient    </target>
878220206Sfabient
879105197Ssam    <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
880105197Ssam        <mkdir dir="${build.toolclasses.dir}"/>
881105197Ssam        <javac fork="true"
882105197Ssam               source="${boot.javac.source}"
883105197Ssam               target="${boot.javac.target}"
884105197Ssam               executable="${boot.java.home}/bin/javac"
885117058Ssam               srcdir="${make.tools.dir}"
886105197Ssam               includes="genstubs/* anttasks/GenStubs*"
887105197Ssam               destdir="${build.toolclasses.dir}/"
888105197Ssam               classpath="${ant.core.lib}"
889105197Ssam               includeantruntime="false">
890105197Ssam            <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
891105197Ssam            <compilerarg line="${javac.lint.opts}"/>
892105197Ssam        </javac>
893105197Ssam        <taskdef name="genstubs"
894105197Ssam                 classname="anttasks.GenStubsTask"
895105197Ssam                 classpath="${build.toolclasses.dir}/"/>
896105197Ssam    </target>
897105197Ssam
898105197Ssam    <target name="-def-javadoc-tool" depends="-check-target.java.home">
899157123Sgnn        <macrodef name="javadoc-tool">
900105197Ssam            <attribute name="name"/>
901105197Ssam            <attribute name="includes"/>
902105197Ssam            <attribute name="options" default=""/>
903105197Ssam            <attribute name="source" default="1.5"/> <!-- FIXME -->
904105197Ssam            <sequential>
905105197Ssam                <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
906105197Ssam                <!-- Note: even with this default value, includes
907105197Ssam                from src.classes.dir get javadoc'd; see packageset below -->
908105197Ssam                <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
909105197Ssam                <javadoc
910105197Ssam                    executable="${target.java.home}/bin/javadoc"
911105197Ssam                    destdir="${build.javadoc.dir}/@{name}"
912105197Ssam                    source="@{source}"
913105197Ssam                    windowtitle="UNOFFICIAL"
914105197Ssam                    failonerror="true"
915105197Ssam                    use="true"
916105197Ssam                    author="false"
917105197Ssam                    version="false"
918105197Ssam                    packagenames="${javadoc.packagenames}" >
919105197Ssam                    <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
920228010Spjd                    <arg line="@{options}"/>
921105197Ssam                    <bootclasspath>
922105197Ssam                        <path location="${build.classes.dir}"/>
923120585Ssam                        <path location="${target.java.home}/jre/lib/rt.jar"/>
924105197Ssam                    </bootclasspath>
925105197Ssam                    <sourcepath>
926105197Ssam                        <pathelement location="${src.classes.dir}"/>
927120585Ssam                    </sourcepath>
928220206Sfabient                    <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
929220206Sfabient                    <!-- means that {@link some.package} will not work, which is no good. -->
930220206Sfabient                    <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
931252028Sae                    <!-- which also causes duplicates in the class index for included files.) -->
932120585Ssam                    <packageset dir="${src.classes.dir}" includes="@{includes}">
933120585Ssam                        <or>
934105197Ssam                            <filename name="java/"/>
935105197Ssam                            <filename name="javax/"/>
936105197Ssam                            <filename name="com/sun/javadoc/"/>
937105197Ssam                            <filename name="com/sun/source/"/>
938105197Ssam                        </or>
939105197Ssam                    </packageset>
940105197Ssam                </javadoc>
941105197Ssam            </sequential>
942105197Ssam        </macrodef>
943105197Ssam    </target>
944105197Ssam
945105197Ssam    <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
946120585Ssam        <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
947228009Spjd            <classpath>
948105197Ssam                <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
949105197Ssam                <pathelement location="${jtreg.home}/lib/javatest.jar"/>
950252028Sae            </classpath>
951120585Ssam        </taskdef>
952105197Ssam        <macrodef name="jtreg-tool">
953105197Ssam            <attribute name="name"/>
954105197Ssam            <attribute name="tests"/>
955105197Ssam            <attribute name="jdk" default="${target.java.home}"/>
956105197Ssam            <attribute name="samevm" default="true"/>
957105197Ssam            <attribute name="verbose" default="${default.jtreg.verbose}"/>
958252028Sae            <attribute name="options" default="${other.jtreg.options}"/>
959120585Ssam            <attribute name="keywords" default="-keywords:!ignore"/>
960105197Ssam            <attribute name="jpda.jvmargs" default=""/>
961105197Ssam            <sequential>
962105197Ssam                <property name="coverage.options" value=""/>              <!-- default -->
963252028Sae                <property name="coverage.classpath" value=""/>            <!-- default -->
964105197Ssam                <property name="default.jtreg.verbose" value="summary"/>  <!-- default -->
965252028Sae                <property name="other.jtreg.options" value=""/>           <!-- default -->
966105197Ssam                <jtreg
967105197Ssam                    dir="${test.dir}"
968105197Ssam                    workDir="${build.jtreg.dir}/@{name}/work"
969105197Ssam                    reportDir="${build.jtreg.dir}/@{name}/report"
970105197Ssam                    jdk="@{jdk}"
971157634Spjd                    samevm="@{samevm}" verbose="@{verbose}"
972157613Spjd                    failonerror="false" resultproperty="jtreg.@{name}.result"
973181803Sbz                    javacoptions="-g"
974218794Svanhu                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs}">
975157613Spjd                    <arg line="@{keywords}"/>
976157613Spjd                    <arg line="@{options}"/>
977157613Spjd                    <arg line="@{tests}"/>
978157613Spjd                </jtreg>
979157613Spjd                <!-- the next two properties are for convenience, when only
980157613Spjd                     a single instance of jtreg will be invoked. -->
981157613Spjd                <condition property="jtreg.passed">
982157613Spjd                    <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
983218794Svanhu                </condition>
984218794Svanhu                <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
985218794Svanhu            </sequential>
986218794Svanhu        </macrodef>
987218794Svanhu        <property name="jtreg.defined" value="true"/>
988218794Svanhu    </target>
989218794Svanhu
990218794Svanhu    <target name="-def-cobertura" depends="-check-cobertura.home">
991218794Svanhu        <path id="cobertura.classpath">
992218794Svanhu            <fileset dir="${cobertura.home}">
993218794Svanhu                <include name="cobertura.jar"/>
994218794Svanhu                <include name="lib/**/*.jar"/>
995218794Svanhu            </fileset>
996218794Svanhu        </path>
997157613Spjd        <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
998157613Spjd    </target>
999157634Spjd
1000157613Spjd    <target name="-def-checkstyle" unless="checkstyle.defined"
1001105197Ssam        depends="-check-checkstyle.home">
1002228010Spjd        <taskdef resource="checkstyletask.properties">
1003105197Ssam            <classpath>
1004120585Ssam                <pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>
1005228010Spjd            </classpath>
1006105197Ssam        </taskdef>
1007105197Ssam        <property name="checkstyle.defined" value="true"/>
1008105197Ssam    </target>
1009120585Ssam
1010105197Ssam    <target name="-def-findbugs" unless="findbugs.defined"
1011105197Ssam        depends="-check-findbugs.home,-check-target.java.home">
1012105197Ssam        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
1013105197Ssam            <classpath>
1014105197Ssam                <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
1015105197Ssam            </classpath>
1016105197Ssam        </taskdef>
1017105197Ssam        <macrodef name="findbugs-tool">
1018105197Ssam            <attribute name="name"/>
1019105197Ssam            <attribute name="output" default="emacs"/>
1020105197Ssam            <attribute name="outputFile" default=""/>
1021105197Ssam            <attribute name="reportLevel" default="high"/>
1022105197Ssam            <sequential>
1023105197Ssam                <findbugs
1024105197Ssam                    home="${findbugs.home}"
1025105197Ssam                    output="@{output}"
1026105197Ssam                    outputFile="@{outputFile}"
1027195699Srwatson                    reportLevel="@{reportLevel}"
1028105197Ssam                    failOnError="false"
1029125099Ssam                    errorProperty="findbugs.@{name}.errors"
1030                    warningsProperty="findbugs.@{name}.warnings"
1031                    jvm="${target.java.home}/bin/java"
1032                    jvmargs="-Xmx512M" >
1033                    <class location="${dist.dir}/lib/@{name}.jar"/>
1034                    <auxClasspath>
1035                        <pathelement location="${build.classes.dir}"/>
1036                    </auxClasspath>
1037                    <sourcePath>
1038                        <pathelement location="${src.classes.dir}"/>
1039                    </sourcePath>
1040                </findbugs>
1041            </sequential>
1042        </macrodef>
1043        <property name="findbugs.defined" value="true"/>
1044    </target>
1045
1046    <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
1047        <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
1048        <property name="vizant.defined" value="true"/>
1049    </target>
1050
1051    <target name="-def-check">
1052        <macrodef name="check">
1053            <attribute name="name"/>
1054            <attribute name="property"/>
1055            <attribute name="marker" default=""/>
1056            <sequential>
1057                <fail message="Cannot locate @{name}: please set @{property} to its location">
1058                    <condition>
1059                        <not>
1060                            <isset property="@{property}"/>
1061                        </not>
1062                    </condition>
1063                </fail>
1064                <fail message="@{name} is not installed in ${@{property}}">
1065                    <condition>
1066                        <and>
1067                            <not>
1068                                <equals arg1="@{marker}" arg2=""/>
1069                            </not>
1070                            <not>
1071                                <available file="${@{property}}/@{marker}"/>
1072                            </not>
1073                        </and>
1074                    </condition>
1075                </fail>
1076            </sequential>
1077        </macrodef>
1078    </target>
1079
1080</project>
1081
1082