build.xml revision 2133:b0c086cd4520
122347Spst<?xml version="1.0" encoding="UTF-8"?>
222347Spst<!--
322347Spst Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
422347Spst DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
522347Spst
622347Spst This code is free software; you can redistribute it and/or modify it
722347Spst under the terms of the GNU General Public License version 2 only, as
822347Spst published by the Free Software Foundation.  Oracle designates this
922347Spst particular file as subject to the "Classpath" exception as provided
1022347Spst by Oracle in the LICENSE file that accompanied this code.
1122347Spst
1222347Spst This code is distributed in the hope that it will be useful, but WITHOUT
1322347Spst ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1422347Spst FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1522347Spst version 2 for more details (a copy is included in the LICENSE file that
1622347Spst accompanied this code).
1722347Spst
1822347Spst You should have received a copy of the GNU General Public License version
1922347Spst 2 along with this work; if not, write to the Free Software Foundation,
2022347Spst Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2122347Spst
2222347Spst Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2322347Spst or visit www.oracle.com if you need additional information or have any
2422347Spst questions.
2522347Spst-->
2622347Spst
2722347Spst<!--
2822347Spst This is the main build file for the complete langtools repository.
2922347Spst It is used when building JDK (in which case it is invoked from the
3022347Spst Makefile), and it can be used when working on the tools themselves,
3122347Spst in an IDE such as NetBeans.
3222347Spst
3322347Spst External dependencies are specified via properties. These can be given
3422347Spst on the command line, or by providing a local build.properties file.
3522347Spst (They can also be edited into make/build.properties, although that is not
3622347Spst recommended.)  At a minimum, boot.java.home must be set to the installed
3722347Spst location of the version of JDK used to build this repository. Additional
3822347Spst properties may be required, depending on the targets that are built.
3922347Spst For example, to run any of the jtreg tests you must set jtreg.home,
4022347Spst to run findbugs on the code you must set findbugs.home, and so on.
4122347Spst
4222347Spst For the most part, javac can be built using the previous version of JDK.
4322347Spst However, a small number of javac files require access to the latest JDK,
4422347Spst which may not yet have been compiled. To compile these files, you can do
4522347Spst one of the following:
4622347Spst - Set boot.java.home to a recent build of the latest version of JDK.
4722347Spst - Set import.jdk to either a recent build (containing jre/lib/rt.jar)
4822347Spst   or to jdk source repository.  In the latter case, stub files will
4922347Spst   automatically be generated and used for the required API, to avoid
5022347Spst   unnecessary compilation of the source repository.
5122347Spst If you do neither, the relevant files will not be built.
5222347Spst
5322347Spst The main build happens in two phases:
5422347Spst - First, javac and other tools as needed are built using ${boot.java.home}.
5522347Spst   (This implies a constraint on the source code that they can be compiled
5622347Spst   with the previous version of JDK.
5722347Spst - Second, all required classes are compiled with the latest javac, created
5822347Spst   in the previous step.
5922347Spst The first phase is called the bootstrap phase. All targets, properties and
6022347Spst tasks that are specific to that phase have "bootstrap" in their name.
6122347Spst
6222347Spst For more details on the JDK build, see
6322347Spst    http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build
6422347Spst    http://openjdk.java.net/groups/build/
6522347Spst For more details on the stub generator, see
6622347Spst    http://blogs.sun.com/jjg/entry/building_javac_for_jdk7
6722347Spst
6822347Spst Internal details ...
6922347Spst
7022347Spst Interim build products are created in the build/ directory.
7122347Spst Final build products are created in the dist/ directory.
7222347Spst When building JDK, the dist/directory will contain:
7322347Spst - A bootstrap compiler suitable for running with ${boot.java.home}
7422347Spst   suitable for compiling downstream parts of JDK
7522347Spst - Source files and class files for inclusion in the JDK being built
7622347Spst When building standalone, the dist/directory will contain:
7722347Spst - Separate jar files for each of the separate langtools components
7822347Spst - Simple scripts to invoke the tools by executing the corresponding
7922347Spst   jar files.
8022347Spst These jar files and scripts are "for developer use only".
8122347Spst
8222347Spst This file is organized into sections as follows:
8322347Spst - global property definitions
8422347Spst - general top level targets
8522347Spst - general diagnostic/debugging targets
8622347Spst - groups of targets for each tool: javac, javadoc, doclets, javah, javap
8722347Spst    Within each group, the following targets are provided, where applicable
8822347Spst      build-bootstrap-TOOL      build the bootstrap version of the tool
8922347Spst      build-classes-TOOL        build the classes for the tool
9022347Spst      build-TOOL                build the jar file and script for the tool
9122347Spst      jtreg-TOOL                build the tool and run the appropriate tests
9222347Spst      findbugs-TOOL             run findbugs on the tool's source code
9322347Spst      TOOL                      build the tool, run the tests, and run findbugs
9422347Spst - utility definitions
9522347Spst -->
9622347Spst
9722347Spst<project name="langtools" default="build" basedir="..">
9822347Spst    <!--
9922347Spst    **** Global property definitions.
10022347Spst    -->
10122347Spst
10222347Spst    <!-- Force full debuginfo for javac if the debug.classfiles
10322347Spst    property is set.  This must be BEFORE the include of
10422347Spst    build.properties because it sets javac.debuglevel.  -->
10522347Spst    <condition property="javac.debuglevel" value="source,lines,vars">
10622347Spst        <equals arg1="${debug.classfiles}" arg2="true"/>
10722347Spst    </condition>
10822347Spst
10922347Spst    <!-- The following locations can be used to override default property values. -->
11022347Spst
11122347Spst    <!-- Use this location for customizations specific to this instance of this workspace -->
11222347Spst    <property file="build.properties"/>
11322347Spst
11422347Spst    <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
11522347Spst    <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
11622347Spst
11722347Spst    <!-- Use this location for customizations common to all OpenJDK workspaces -->
11822347Spst    <property file="${user.home}/.openjdk/build.properties"/>
11922347Spst
12022347Spst    <!-- Convenient shorthands for standard locations within the workspace. -->
12122347Spst    <property name="build.dir" location="build"/>
12222347Spst    <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
12322347Spst    <property name="build.coverage.dir" location="${build.dir}/coverage"/>
12422347Spst    <property name="build.classes.dir" location="${build.dir}/classes"/>
12522347Spst    <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
12622347Spst    <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
12722347Spst    <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
12822347Spst    <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
12922347Spst    <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
13022347Spst    <property name="dist.dir" location="dist"/>
13122347Spst    <property name="dist.bin.dir" location="${dist.dir}/bin"/>
13222347Spst    <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
13322347Spst    <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
13422347Spst    <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/>
13522347Spst    <property name="dist.lib.dir" location="${dist.dir}/lib"/>
13622347Spst    <property name="make.dir" location="make"/>
13722347Spst    <property name="make.conf.dir" location="${make.dir}/conf"/>
13822347Spst    <property name="make.tools.dir" location="${make.dir}/tools"/>
13922347Spst    <property name="src.dir" location="src"/>
14022347Spst    <property name="src.bin.dir" location="${src.dir}/share/bin"/>
14122347Spst    <property name="src.classes.dir" location="${src.dir}/share/classes"/>
14222347Spst    <property name="test.dir" location="test"/>
14322347Spst
14422347Spst    <!-- java.marker is set to a marker file to check for within a Java install dir.
14522347Spst         The best file to check for across Solaris/Linux/Windows/MacOS is one of the
14622347Spst         executables; regrettably, that is OS-specific. -->
14722347Spst    <condition property="java.marker" value="bin/java">
14822347Spst        <os family="unix"/>
14922347Spst    </condition>
15022347Spst    <condition property="java.marker" value="bin/java.exe">
15122347Spst        <os family="windows"/>
15222347Spst    </condition>
15322347Spst
15422347Spst    <!-- Standard property values, if not overriden by earlier settings. -->
15522347Spst    <property file="${make.dir}/build.properties"/>
15622347Spst
15722347Spst    <!-- launcher.java is used in the launcher scripts provided to run
15822347Spst        the tools' jar files.  If it has not already been set, then
15922347Spst        default it to use ${target.java.home}, if available, otherwise
16022347Spst        quietly default to simply use "java". -->
16122347Spst    <condition property="launcher.java"
16222347Spst        value="${target.java.home}/bin/java" else="java">
16322347Spst        <isset property="target.java.home"/>
16422347Spst    </condition>
16522347Spst
16622347Spst    <!-- Logic for handling access import jdk classes, if available.
16722347Spst        import.jdk should be unset, or set to jdk home (to use rt.jar)
16822347Spst        or to jdk repo (to use src/share/classes).
16922347Spst        Based on the value, if any, set up default values for javac's sourcepath,
17022347Spst        classpath and bootclasspath. Note: the default values are overridden
17122347Spst        in the build-bootstrap-classes macro. -->
17222347Spst
17322347Spst    <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
17422347Spst        filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
17522347Spst    <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
17622347Spst        ignoresystemclasses="true"
17722347Spst        classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
17822347Spst
17922347Spst    <!-- Set the default bootclasspath option used for javac.
18022347Spst        Note that different variants of the option are used, meaning we can't just
18122347Spst        define the value for the option.
18222347Spst        Note the explicit use of the standard property ${path.separator} in the following.
18322347Spst        This is because Ant is not clever enough to handle direct use of : or ; -->
18422347Spst    <condition property="javac.bootclasspath.opt"
18522347Spst            value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
18622347Spst            else="-Xbootclasspath/p:${build.classes.dir}">
18722347Spst        <isset property="import.jdk.jar"/>
18822347Spst    </condition>
18922347Spst
19022347Spst    <condition property="boot.java.provides.latest.jdk">
19122347Spst        <available
19222347Spst            ignoresystemclasses="true"
19322347Spst            classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
19422347Spst    </condition>
19522347Spst
19622347Spst    <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">
19722347Spst        <isset property="boot.java.provides.latest.jdk"/>
19822347Spst    </condition>
19922347Spst
20022347Spst    <condition property="exclude.files" value="" else="${require.latest.jdk.files}">
20122347Spst        <or>
20222347Spst            <isset property="boot.java.provides.latest.jdk"/>
20322347Spst            <isset property="import.jdk"/>
20422347Spst        </or>
20522347Spst    </condition>
20622347Spst
20722347Spst    <condition property="require.import.jdk.stubs">
20822347Spst        <and>
20922347Spst            <not>
21022347Spst                <isset property="boot.java.provides.latest.jdk"/>
21122347Spst            </not>
21222347Spst            <isset property="import.jdk.src.dir"/>
21322347Spst        </and>
21422347Spst    </condition>
21522347Spst
21622347Spst    <!-- Set the default value of the sourcepath used for javac. -->
21722347Spst    <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
21822347Spst        <isset property="require.import.jdk.stubs"/>
21922347Spst    </condition>
22022347Spst
22122347Spst    <!-- Set the default value of the classpath used for javac. -->
22222347Spst    <property name="javac.classpath" value=""/>
22322347Spst
22422347Spst
22522347Spst    <!--
22622347Spst    **** General top level targets.
22722347Spst    -->
22822347Spst
22922347Spst    <!-- Standard target to build deliverables for JDK build. -->
23022347Spst
23122347Spst    <target name="build" depends="build-bootstrap-tools,build-all-classes">
23222347Spst        <copy todir="${dist.dir}/bootstrap">
23322347Spst            <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
23422347Spst        </copy>
23522347Spst        <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
23622347Spst            <include name="*"/>
23722347Spst        </chmod>
23822347Spst        <mkdir dir="${dist.lib.dir}"/>
23922347Spst        <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
24022347Spst        <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
24122347Spst    </target>
24222347Spst
24322347Spst    <target name="build-bootstrap-tools"
24422347Spst        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah,build-bootstrap-sjavac"
24522347Spst    />
24622347Spst
24722347Spst    <target name="build-all-tools"
24822347Spst        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-sjavac"
24922347Spst    />
25022347Spst
25122347Spst    <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
25222347Spst        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
25322347Spst    </target>
25422347Spst
25522347Spst    <!-- clean -->
25622347Spst
25722347Spst    <target name="clean" description="Delete all generated files">
25822347Spst        <delete dir="${build.dir}"/>
25922347Spst        <delete dir="${dist.dir}"/>
26022347Spst    </target>
26122347Spst
26222347Spst    <!-- Additional targets for running tools on the build -->
26322347Spst
26422347Spst    <target name="jtreg" depends="build-all-tools,-def-jtreg">
26522347Spst        <jtreg-tool name="all" tests="${jtreg.tests}"/>
26622347Spst    </target>
26722347Spst
26822347Spst    <target name="checkstyle" depends="-def-checkstyle"
26922347Spst        description="Generates reports for code convention violations.">
27022347Spst        <mkdir dir="${dist.checkstyle.dir}"/>
27122347Spst        <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"
27222347Spst              failureProperty="checkstyle.failure"
27322347Spst              failOnViolation="false">
27422347Spst            <formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/>
27522347Spst            <fileset dir="src" includes="**/*.java, **/*.properties"/>
27622347Spst        </checkstyle>
27722347Spst        <!-- transform the output to a simple html -->
27822347Spst        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
27922347Spst               out="${dist.checkstyle.dir}/checkstyle_report.html"
28022347Spst               style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>
28122347Spst        <!-- transform the output to a very simple emacs friendly text file -->
28222347Spst        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
28322347Spst               out="${dist.checkstyle.dir}/checkstyle_report.tmp"
28422347Spst               style="${make.conf.dir}/checkstyle-emacs.xsl"/>
28522347Spst        <!-- beautify remove extra lines -->
28622347Spst        <move file="${dist.checkstyle.dir}/checkstyle_report.tmp"
28722347Spst             toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt">
28822347Spst            <filterchain>
28922347Spst                <ignoreblank/>
29022347Spst                <replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/>
29122347Spst            </filterchain>
29222347Spst        </move>
29322347Spst    </target>
29422347Spst    <!-- target can be invoked from an ide, the output of which can be used
29522347Spst         to access and fix the errors directly.
29622347Spst     -->
29722347Spst    <target name="checkstyle-ide" depends="checkstyle">
29822347Spst        <concat>
29922347Spst            <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/>
30022347Spst        </concat>
30122347Spst    </target>
30222347Spst
30322347Spst    <target name="findbugs" depends="-def-findbugs,build-all-tools">
30422347Spst        <property name="findbugs.reportLevel" value="medium"/>
30522347Spst        <mkdir dir="${dist.findbugs.dir}"/>
30622347Spst        <findbugs
30722347Spst            home="${findbugs.home}"
30822347Spst            projectName="JDK langtools ${full.version}"
30922347Spst            output="xml"
31022347Spst            outputFile="${dist.findbugs.dir}/findbugs.xml"
31122347Spst            reportLevel="${findbugs.reportLevel}"
31222347Spst            failOnError="false"
31322347Spst            errorProperty="findbugs.all.errors"
31422347Spst            warningsProperty="findbugs.all.warnings"
31522347Spst            jvm="${target.java.home}/bin/java"
31622347Spst            jvmargs="-Xmx512M">
31722347Spst            <class location="${build.classes.dir}"/>
31822347Spst            <sourcePath>
31922347Spst                <pathelement location="${src.classes.dir}"/>
32022347Spst            </sourcePath>
32122347Spst        </findbugs>
32222347Spst        <exec executable="sh">
32322347Spst            <arg value="${findbugs.home}/bin/convertXmlToText"/>
32422347Spst            <arg value="-longBugCodes"/>
32522347Spst            <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
32622347Spst            <arg value="${dist.findbugs.dir}/findbugs.xml"/>
32722347Spst            <redirector output="${dist.findbugs.dir}/findbugs.html"/>
32822347Spst        </exec>
32922347Spst    </target>
33022347Spst
33122347Spst    <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
33222347Spst
33322347Spst    <target name="instrument-classes" depends="-def-cobertura">
33422347Spst        <!-- only define the following property when we want coverage info -->
33522347Spst        <path id="coverage.classpath">
33622347Spst            <pathelement location="${build.coverage.dir}/classes"/>
33722347Spst            <path refid="cobertura.classpath"/>
33822347Spst        </path>
33922347Spst        <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
34022347Spst        <property name="coverage.classpath" refid="coverage.classpath"/>
34122347Spst        <mkdir dir="${build.coverage.dir}/classes"/>
34222347Spst        <delete file="${build.coverage.dir}/cobertura.ser"/>
34322347Spst        <cobertura-instrument todir="${build.coverage.dir}/classes"
34422347Spst            datafile="${build.coverage.dir}/cobertura.ser">
34522347Spst            <fileset dir="${build.classes.dir}"
34622347Spst               includes="**/*.class" excludes="**/resources/*.class"/>
34722347Spst        </cobertura-instrument>
34822347Spst    </target>
34922347Spst
35022347Spst    <target name="coverage-report" depends="-def-cobertura">
35122347Spst        <mkdir dir="${dist.coverage.dir}"/>
35222347Spst        <cobertura-report
35322347Spst            srcdir="${src.classes.dir}"
35422347Spst            destdir="${dist.coverage.dir}"
35522347Spst            datafile="${build.coverage.dir}/cobertura.ser"/>
35622347Spst        <cobertura-report
35722347Spst            format="xml"
35822347Spst            srcdir="${src.classes.dir}"
35922347Spst            destdir="${dist.coverage.dir}"
36022347Spst            datafile="${build.coverage.dir}/cobertura.ser"/>
36122347Spst    </target>
36222347Spst
36322347Spst    <target name="diags-examples" depends="build-javac,build-javap">
36422347Spst        <!-- can override the following on the command line if desired. -->
36522347Spst        <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
36622347Spst        <mkdir dir="${build.dir}/diag-examples/classes"/>
36722347Spst        <javac fork="true"
36822347Spst            executable="${dist.bin.dir}/javac"
36922347Spst            srcdir="test/tools/javac/diags"
37022347Spst            destdir="${build.dir}/diag-examples/classes"
37122347Spst            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
37222347Spst            sourcepath=""
37322347Spst            classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
37422347Spst            includeAntRuntime="no"
37522347Spst            debug="${javac.debug}"
37622347Spst            debuglevel="${javac.debuglevel}">
37722347Spst            <compilerarg line="${javac.lint.opts}"/>
37822347Spst        </javac>
37922347Spst        <java fork="true"
38022347Spst            jvm="${target.java.home}/bin/java"
38122347Spst            dir="test/tools/javac/diags"
38222347Spst            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
38322347Spst            classname="RunExamples">
38422347Spst            <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
38522347Spst            <arg value="-examples"/>
38622347Spst            <arg value="examples"/>
38722347Spst            <arg value="-o"/>
38822347Spst            <arg file="${diags.examples.out}"/>
38922347Spst            <arg value="-showFiles"/>
39022347Spst            <arg value="-title"/>
39122347Spst            <arg value="Examples of javac diagnostics"/>
39222347Spst        </java>
39322347Spst    </target>
39422347Spst
39522347Spst    <!-- a patching facility to speed up incorporating the langtools' classfiles
39622347Spst         into a jdk of your choice. Either target.java.home or patch.jdk can be
39722347Spst         set on the command line; setting target.java.home has the advantage of
39822347Spst         patching the jdk used for jtreg and other tests.
39922347Spst    -->
40022347Spst    <target name="patch" depends="build-all-classes">
40122347Spst        <condition property="patch.jdk" value="${target.java.home}">
40222347Spst            <available file="${target.java.home}" type="dir"/>
40322347Spst        </condition>
40422347Spst        <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">
40522347Spst            <condition>
40622347Spst                <not>
40722347Spst                    <isset property="patch.jdk"/>
40822347Spst                </not>
40922347Spst            </condition>
41022347Spst        </fail>
41122347Spst        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
41222347Spst        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
41322347Spst        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
41422347Spst            <condition>
41522347Spst                <not>
41622347Spst                    <available file="${patch.tools.jar}" type="file"/>
41722347Spst                </not>
41822347Spst            </condition>
41922347Spst        </fail>
42022347Spst        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
42122347Spst            <condition>
42222347Spst                <not>
42322347Spst                    <available file="${patch.rt.jar}" type="file"/>
42422347Spst                </not>
42522347Spst            </condition>
42622347Spst        </fail>
42722347Spst        <zip zipfile="${patch.tools.jar}" update="true">
42822347Spst            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
42922347Spst        </zip>
43022347Spst        <zip zipfile="${patch.rt.jar}" update="true">
43122347Spst            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
43222347Spst        </zip>
43322347Spst    </target>
43422347Spst
43522347Spst    <target name="doclint-api" depends="build-all-classes">
43622347Spst        <delete dir="${build.dir}/doclint/classes"/>
43722347Spst        <mkdir dir="${build.dir}/doclint/classes"/>
43822347Spst        <javac fork="true"
43922347Spst               executable="${boot.javac}"
44022347Spst               srcdir="${src.classes.dir}:${build.gensrc.dir}"
44122347Spst               destdir="${build.dir}/doclint/classes"
44222347Spst               includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**"
44322347Spst               excludes=""
44422347Spst               sourcepath="${javac.sourcepath}"
44522347Spst               classpath="${javac.classpath}"
44622347Spst               includeAntRuntime="no"
44722347Spst               source="${javac.source}"
44822347Spst               target="${javac.target}"
44922347Spst               debug="${javac.debug}"
45022347Spst               debuglevel="${javac.debuglevel}">
45122347Spst            <compilerarg value="-implicit:none"/>
45222347Spst            <compilerarg value="-Xprefer:source"/>
45322347Spst            <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
45422347Spst            <compilerarg line="${javac.no.jdk.warnings}"/>
45522347Spst            <compilerarg line="${javac.version.opt}"/>
45622347Spst            <compilerarg line="-Xdoclint:all/protected,-missing"/>
45722347Spst        </javac>
45822347Spst    </target>
45922347Spst
46022347Spst    <!--
46122347Spst    **** Debugging/diagnostic targets.
46222347Spst    -->
46322347Spst
46422347Spst    <!-- standard JDK target -->
46522347Spst    <target name="sanity"
46622347Spst        description="display settings of configuration values">
46722347Spst        <echo level="info">ant.home = ${ant.home}</echo>
46822347Spst        <echo level="info">boot.java.home = ${boot.java.home}</echo>
46922347Spst        <echo level="info">target.java.home = ${target.java.home}</echo>
47022347Spst        <echo level="info">jtreg.home = ${jtreg.home}</echo>
47122347Spst        <echo level="info">findbugs.home = ${findbugs.home}</echo>
47222347Spst        <echo level="info">checkstyle.home = ${checkstyle.home}</echo>
47322347Spst    </target>
47422347Spst
47522347Spst    <target name="post-sanity" depends="-def-jtreg,sanity,build"
47622347Spst        description="perform basic validation after a standard build">
47722347Spst        <jtreg
47822347Spst            dir="make/test"
47922347Spst            workDir="${build.jtreg.dir}/post-sanity/work"
48022347Spst            reportDir="${build.jtreg.dir}/post-sanity/report"
48122347Spst            jdk="${target.java.home}"
48222347Spst            verbose="summary"
48322347Spst            failonerror="false" resultproperty="jtreg.post-sanity.result">
48422347Spst        </jtreg>
48522347Spst    </target>
48622347Spst
48722347Spst    <!-- use vizant tool to generate graphical image of this Ant file.-->
48822347Spst    <target name="vizant" depends="-def-vizant">
48922347Spst        <mkdir dir="${build.dir}"/>
49022347Spst        <echo message="Generating ${build.dir}/build.dot"/>
49122347Spst        <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
49222347Spst        <echo message="Generating ${build.dir}/build.png"/>
49322347Spst        <exec executable="${dot}" >
49422347Spst            <arg value="-Tpng"/>
49522347Spst            <arg value="-o"/>
49622347Spst            <arg file="${build.dir}/build.png"/>
49722347Spst            <arg file="${build.dir}/build.dot"/>
49822347Spst        </exec>
49922347Spst    </target>
50022347Spst
50122347Spst    <target name="check-import.jdk">
50222347Spst        <echo message="import.jdk: ${import.jdk}"/>
50322347Spst        <echo message="import.jdk.jar: ${import.jdk.jar}"/>
50422347Spst        <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
50522347Spst    </target>
50622347Spst
50722347Spst    <target name="diagnostics">
50822347Spst        <diagnostics/>
50922347Spst    </target>
51022347Spst
51122347Spst
51222347Spst    <!--
51322347Spst    **** javac targets.
51422347Spst    -->
51522347Spst
51622347Spst    <target name="build-bootstrap-javac"
51722347Spst            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
51822347Spst        <build-bootstrap-classes includes="${javac.includes}"/>
51922347Spst        <build-bootstrap-jar     name="javac" includes="${javac.includes}"/>
52022347Spst        <build-bootstrap-tool    name="javac"/>
52122347Spst    </target>
52222347Spst
52322347Spst    <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
52422347Spst        <build-classes includes="${javac.includes}"/>
52522347Spst    </target>
52622347Spst
52722347Spst    <target name="build-javac" depends="build-classes-javac">
52822347Spst        <build-jar  name="javac" includes="${javac.includes}"/>
52922347Spst        <build-tool name="javac"/>
53022347Spst    </target>
53122347Spst
53222347Spst    <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
53322347Spst        <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls.option}"/>
53422347Spst    </target>
53522347Spst
53622347Spst    <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
53722347Spst        <jtreg-tool name="javac" tests="${javac.tests}"/>
53822347Spst    </target>
53922347Spst
54022347Spst    <target name="findbugs-javac" depends="build-javac,-def-findbugs">
54122347Spst        <findbugs-tool name="javac"/>
54222347Spst    </target>
54322347Spst
54422347Spst    <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
54522347Spst
54622347Spst
54722347Spst    <!--
54822347Spst    **** javadoc targets.
54922347Spst    -->
55022347Spst
55122347Spst    <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
55222347Spst        <build-bootstrap-classes includes="${javadoc.includes}"/>
55322347Spst        <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
55422347Spst                                 jarclasspath="javac.jar doclets.jar"/>
55522347Spst        <build-bootstrap-tool    name="javadoc"/>
55622347Spst    </target>
55722347Spst
55822347Spst    <target name="build-classes-javadoc" depends="build-classes-javac">
55922347Spst        <build-classes includes="${javadoc.includes}"/>
56022347Spst    </target>
56122347Spst
56222347Spst    <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
56322347Spst        <build-jar  name="javadoc" includes="${javadoc.includes}"
56422347Spst                    jarclasspath="javac.jar doclets.jar"/>
56522347Spst        <build-tool name="javadoc"/>
56622347Spst    </target>
56722347Spst
56822347Spst    <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
56922347Spst        <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
57022347Spst    </target>
57122347Spst
57222347Spst    <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
57322347Spst        <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
57422347Spst    </target>
57522347Spst
57622347Spst    <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
57722347Spst        <findbugs-tool name="javadoc"/>
57822347Spst    </target>
57922347Spst
58022347Spst    <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
58122347Spst
58222347Spst
58322347Spst    <!--
58422347Spst    **** doclets targets.
58522347Spst    -->
58622347Spst
58722347Spst    <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
58822347Spst        <build-bootstrap-classes includes="${doclets.includes}"/>
58922347Spst        <build-bootstrap-jar     name="doclets" includes="${doclets.includes}"
59022347Spst                                 jarmainclass="com.sun.tools.javadoc.Main"
59122347Spst                                 jarclasspath="javadoc.jar"/>
59222347Spst    </target>
59322347Spst
59422347Spst    <target name="build-classes-doclets" depends="build-classes-javadoc">
59522347Spst        <build-classes includes="${doclets.includes}"/>
59622347Spst    </target>
59722347Spst
59822347Spst    <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
59922347Spst        <!-- just jar, no bin for doclets -->
60022347Spst        <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
60122347Spst    </target>
60222347Spst
60322347Spst    <!-- (no javadoc for doclets) -->
60422347Spst
60522347Spst    <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
60622347Spst        <jtreg-tool name="doclets" tests="${doclets.tests}"/>
60722347Spst    </target>
60822347Spst
60922347Spst    <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
61022347Spst        <findbugs-tool name="doclets"/>
61122347Spst    </target>
61222347Spst
61322347Spst    <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
61422347Spst
61522347Spst
61622347Spst    <!--
61722347Spst    **** javah targets.
61822347Spst    -->
61922347Spst
62022347Spst    <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
62122347Spst        <build-bootstrap-classes includes="${javah.includes}"/>
62222347Spst        <build-bootstrap-jar     name="javah" includes="${javah.includes}"
62322347Spst                                 jarclasspath="javadoc.jar doclets.jar javac.jar"/>
62422347Spst        <build-bootstrap-tool    name="javah"/>
62522347Spst    </target>
62622347Spst
62722347Spst    <target name="build-javah" depends="build-javac,build-classes-javah">
62822347Spst        <build-jar  name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
62922347Spst        <build-tool name="javah"/>
63022347Spst    </target>
63122347Spst
63222347Spst    <target name="build-classes-javah" depends="build-classes-javadoc">
63322347Spst        <build-classes includes="${javah.includes}"/>
63422347Spst    </target>
63522347Spst
63622347Spst    <!-- (no javadoc for javah) -->
63722347Spst
63822347Spst    <target name="jtreg-javah" depends="build-javah,-def-jtreg">
63922347Spst        <jtreg-tool name="javah" tests="${javah.tests}"/>
64022347Spst    </target>
64122347Spst
64222347Spst    <target name="findbugs-javah" depends="build-javah,-def-findbugs">
64322347Spst        <findbugs-tool name="javah"/>
64422347Spst    </target>
64522347Spst
64622347Spst    <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
64722347Spst
64822347Spst
64922347Spst    <!--
65022347Spst    **** javap targets.
65122347Spst    -->
65222347Spst
65322347Spst    <target name="build-bootstrap-javap"
65422347Spst            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
65522347Spst        <build-bootstrap-classes includes="${javap.includes}"/>
65622347Spst        <build-bootstrap-jar     name="javap" includes="${javap.includes}"
65722347Spst                                 jarmainclass="sun.tools.javap.Main"/>
65822347Spst        <build-bootstrap-tool    name="javap"/>
65922347Spst    </target>
66022347Spst
66122347Spst    <target name="build-classes-javap" depends="build-classes-javac">
66222347Spst        <build-classes includes="${javap.includes}"/>
66322347Spst    </target>
66422347Spst
66522347Spst    <target name="build-javap" depends="build-javac,build-classes-javap">
66622347Spst        <build-jar  name="javap" includes="${javap.includes}"
66722347Spst                    jarmainclass="com.sun.tools.javap.Main"
66822347Spst                    jarclasspath="javac.jar"/>
66922347Spst        <build-tool name="javap"/>
67022347Spst    </target>
67122347Spst
67222347Spst    <!-- (no javadoc for javap) -->
67322347Spst
67422347Spst    <target name="jtreg-javap" depends="build-javap,-def-jtreg">
67522347Spst        <jtreg-tool name="javap" tests="${javap.tests}"/>
67622347Spst    </target>
67722347Spst
67822347Spst    <target name="findbugs-javap" depends="build-javap,-def-findbugs">
67922347Spst        <findbugs-tool name="javap"/>
68022347Spst    </target>
68122347Spst
68222347Spst    <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
68322347Spst
68422347Spst    <!--
68522347Spst    **** sjavac targets.
68622347Spst    -->
68722347Spst
68822347Spst    <target name="build-bootstrap-sjavac"
68922347Spst            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
69022347Spst        <build-bootstrap-classes includes="${sjavac.includes}"/>
69122347Spst        <build-bootstrap-jar     name="sjavac" includes="${sjavac.includes}"
69222347Spst                                 jarmainclass="com.sun.tools.sjavac.Main"/>
69322347Spst        <build-bootstrap-tool    name="sjavac"/>
69422347Spst    </target>
69522347Spst
69622347Spst    <target name="build-classes-sjavac" depends="build-classes-javac">
69722347Spst        <build-classes includes="${sjavac.includes}"/>
69822347Spst    </target>
69922347Spst
70022347Spst    <target name="build-sjavac" depends="build-classes-sjavac">
70122347Spst        <build-jar  name="sjavac" includes="${sjavac.includes}"
70222347Spst                    jarmainclass="com.sun.tools.sjavac.Main"
70322347Spst                    jarclasspath="sjavac.jar"/>
70422347Spst        <build-tool name="sjavac"/>
70522347Spst    </target>
70622347Spst
70722347Spst    <!-- (no javadoc for javap) -->
70822347Spst
70922347Spst    <target name="jtreg-sjavac" depends="build-sjavac,-def-jtreg">
71022347Spst        <jtreg-tool name="sjavac" tests="${sjavac.tests}"/>
71122347Spst    </target>
71222347Spst
71322347Spst    <target name="findbugs-sjavac" depends="build-sjavac,-def-findbugs">
71422347Spst        <findbugs-tool name="sjavac"/>
71522347Spst    </target>
71622347Spst
71722347Spst    <target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/>
71822347Spst
71922347Spst    <!--
72022347Spst    **** crules targets.
72122347Spst    -->
72222347Spst
72322347Spst    <target name="build-crules" depends="-def-compilecrules,-def-build-jar-with-services">
72422347Spst        <compilecrules/>
72522347Spst        <build-jar-with-services
72622347Spst                    name="crules"
72722347Spst                    includes="crules/* crules/resources/*"
72822347Spst                    classes.dir="${build.toolclasses.dir}"
72922347Spst                    lib.dir="${build.toolclasses.dir}"
73022347Spst                    jarmainclass=""
73122347Spst                    jarclasspath="crules.jar"
73222347Spst                    service.type="com.sun.source.util.Plugin"
73322347Spst                    service.provider="crules.MutableFieldsAnalyzer"/>
73422347Spst        <build-tool name="crules"/>
73522347Spst    </target>
73622347Spst
73722347Spst    <target name="check-coding-rules" depends="build-bootstrap-javac,-create-import-jdk-stubs,build-crules">
73822347Spst        <build-classes includes="${javac.includes}"
73922347Spst            plugin.options="-J-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar -Xplugin:mutable_fields_analyzer" />
74022347Spst    </target>
74122347Spst
74222347Spst    <!--
74322347Spst    **** Create import JDK stubs.
74422347Spst    -->
74522347Spst
74622347Spst    <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
74722347Spst        <mkdir dir="${build.genstubs.dir}"/>
74822347Spst        <genstubs
74922347Spst            srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
75022347Spst            includes="${import.jdk.stub.files}"
75122347Spst            fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"
75222347Spst        />
75322347Spst    </target>
75422347Spst
75522347Spst
75622347Spst    <!--
75722347Spst    **** Check targets.
75822347Spst    **** "-check-*" targets check that a required property is set, and set to a reasonable value.
75922347Spst    **** A user friendly message is generated if not, and the build exits.
76022347Spst    -->
76122347Spst
76222347Spst    <target name="-check-boot.java.home" depends="-def-check">
76322347Spst        <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
76422347Spst    </target>
76522347Spst
76622347Spst    <target name="-check-target.java.home" depends="-def-check">
76722347Spst        <check name="target java" property="target.java.home" marker="${java.marker}"/>
76822347Spst    </target>
76922347Spst
77022347Spst    <target name="-check-cobertura.home" depends="-def-check">
77122347Spst        <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
77222347Spst    </target>
77322347Spst
77422347Spst    <target name="-check-findbugs.home" depends="-def-check">
77522347Spst        <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
77622347Spst    </target>
77722347Spst
77822347Spst    <target name="-check-checkstyle.home" depends="-def-check">
77922347Spst        <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
78022347Spst    </target>
78122347Spst
78222347Spst    <target name="-check-jtreg.home" depends="-def-check">
78322347Spst        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
78422347Spst    </target>
78522347Spst
78622347Spst    <target name="-check-vizant" depends="-def-check">
78722347Spst        <check name="vizant" property="vizant.jar"/>
78822347Spst        <check name="dot" property="dot"/>
78922347Spst    </target>
79022347Spst
79122347Spst
79222347Spst    <!--
79322347Spst    **** Targets for Ant macro and task definitions.
79422347Spst    -->
79522347Spst
79622347Spst    <target name="-def-build-tool">
79722347Spst        <macrodef name="build-tool">
79822347Spst            <attribute name="name"/>
79922347Spst            <attribute name="bin.dir" default="${dist.bin.dir}"/>
80022347Spst            <attribute name="java" default="${launcher.java}"/>
80122347Spst            <sequential>
80222347Spst                <mkdir dir="@{bin.dir}"/>
80322347Spst                <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
80422347Spst                    <filterset begintoken="#" endtoken="#">
80522347Spst                        <filter token="PROGRAM" value="@{name}"/>
80622347Spst                        <filter token="TARGET_JAVA" value="@{java}"/>
80722347Spst                        <filter token="PS" value="${path.separator}"/>
80822347Spst                    </filterset>
80922347Spst                </copy>
81022347Spst                <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
81122347Spst            </sequential>
81222347Spst        </macrodef>
81322347Spst    </target>
81422347Spst
81522347Spst    <target name="-def-build-jar">
81622347Spst        <macrodef name="build-jar">
81722347Spst            <attribute name="name"/>
81822347Spst            <attribute name="includes"/>
81922347Spst            <attribute name="classes.dir" default="${build.classes.dir}"/>
82022347Spst            <attribute name="lib.dir" default="${dist.lib.dir}"/>
82122347Spst            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
82222347Spst            <attribute name="jarclasspath" default=""/>
82322347Spst            <sequential>
82422347Spst                <mkdir dir="@{lib.dir}"/>
82522347Spst                <jar destfile="@{lib.dir}/@{name}.jar"
82622347Spst                     basedir="@{classes.dir}"
82722347Spst                     includes="@{includes}">
82822347Spst                    <manifest>
82922347Spst                        <attribute name="Main-Class" value="@{jarmainclass}"/>
83022347Spst                        <attribute name="Class-Path" value="@{jarclasspath}"/>
83122347Spst                    </manifest>
83222347Spst                </jar>
83322347Spst            </sequential>
83422347Spst        </macrodef>
83522347Spst    </target>
83622347Spst
83722347Spst    <target name="-def-build-jar-with-services">
83822347Spst        <macrodef name="build-jar-with-services">
83922347Spst            <attribute name="name"/>
84022347Spst            <attribute name="includes"/>
84122347Spst            <attribute name="classes.dir" default="${build.classes.dir}"/>
84222347Spst            <attribute name="lib.dir" default="${dist.lib.dir}"/>
84322347Spst            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
84422347Spst            <attribute name="jarclasspath" default=""/>
84522347Spst            <attribute name="service.type" default=""/>
84622347Spst            <attribute name="service.provider" default=""/>
84722347Spst            <sequential>
84822347Spst                <mkdir dir="${build.toolclasses.dir}"/>
84922347Spst                <jar destfile="@{lib.dir}/@{name}.jar"
85022347Spst                     basedir="@{classes.dir}"
85122347Spst                     includes="@{includes}">
85222347Spst                    <service type="@{service.type}" provider="@{service.provider}"/>
85322347Spst                    <manifest>
85422347Spst                        <attribute name="Main-Class" value="@{jarmainclass}"/>
85522347Spst                        <attribute name="Class-Path" value="@{jarclasspath}"/>
85622347Spst                    </manifest>
85722347Spst                </jar>
85822347Spst            </sequential>
85922347Spst        </macrodef>
86022347Spst    </target>
86122347Spst
86222347Spst    <target name="-def-build-classes" depends="-def-pcompile">
86322347Spst        <macrodef name="build-classes">
86422347Spst            <attribute name="includes"/>
86522347Spst            <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
86622347Spst            <attribute name="classes.dir" default="${build.classes.dir}"/>
86722347Spst            <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
86822347Spst            <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
86922347Spst            <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
87022347Spst            <attribute name="classpath" default="${javac.classpath}"/>
87122347Spst            <attribute name="sourcepath" default="${javac.sourcepath}"/>
87222347Spst            <attribute name="java.home" default="${boot.java.home}"/>
87322347Spst            <attribute name="source" default="${javac.source}"/>
87422347Spst            <attribute name="target" default="${javac.target}"/>
87522347Spst            <attribute name="release" default="${release}"/>
87622347Spst            <attribute name="full.version" default="${full.version}"/>
87722347Spst            <attribute name="plugin.options" default=""/>
87822347Spst            <sequential>
87922347Spst                <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
88022347Spst                <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
88122347Spst                <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
88222347Spst                <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
88322347Spst                <mkdir dir="@{gensrc.dir}"/>
88422347Spst                <mkdir dir="@{classes.dir}"/>
88522347Spst                <pcompile srcdir="${src.classes.dir}"
88622347Spst                          destdir="@{gensrc.dir}"
88722347Spst                          includes="@{includes}"/>
88822347Spst                <copy todir="@{gensrc.dir}">
88922347Spst                    <fileset dir="${src.classes.dir}" includes="@{includes}"/>
89022347Spst                    <globmapper from="*.properties-template" to="*.properties"/>
89122347Spst                    <filterset begintoken="$(" endtoken=")">
89222347Spst                        <filter token="JDK_VERSION" value="${jdk.version}"/>
89322347Spst                        <filter token="RELEASE" value="@{release}"/>
89422347Spst                        <filter token="FULL_VERSION" value="@{full.version}"/>
89522347Spst                    </filterset>
89622347Spst                </copy>
89722347Spst                <pcompile srcdir="@{gensrc.dir}"
89822347Spst                          destdir="@{gensrc.dir}"
89922347Spst                          includes="**/*.properties"/>
90022347Spst                <javac fork="true"
90122347Spst                       executable="@{java.home}/bin/javac"
90222347Spst                       srcdir="${src.classes.dir}:@{gensrc.dir}"
90322347Spst                       destdir="@{classes.dir}"
90422347Spst                       includes="@{includes}"
90522347Spst                       excludes="@{excludes}"
90622347Spst                       sourcepath="@{sourcepath}"
90722347Spst                       classpath="@{classpath}"
90822347Spst                       includeAntRuntime="no"
90922347Spst                       source="@{source}"
91022347Spst                       target="@{target}"
91122347Spst                       debug="${javac.debug}"
91222347Spst                       debuglevel="${javac.debuglevel}">
91322347Spst                    <compilerarg value="-implicit:none"/>
91422347Spst                    <compilerarg value="-Xprefer:source"/>
91522347Spst                    <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
91622347Spst                    <compilerarg line="@{bootclasspath.opt}"/>
91722347Spst                    <compilerarg line="${javac.no.jdk.warnings}"/>
91822347Spst                    <compilerarg line="${javac.version.opt}"/>
91922347Spst                    <compilerarg line="${javac.lint.opts}"/>
92022347Spst                    <compilerarg line="@{plugin.options}"/>
92122347Spst                </javac>
92222347Spst                <copy todir="@{classes.dir}" includeemptydirs="false">
92322347Spst                    <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
92422347Spst                        <exclude name="**/*.java"/>
92522347Spst                        <exclude name="**/*.properties"/>
92622347Spst                        <exclude name="**/*-template"/>
92722347Spst                        <exclude name="**/*.rej"/>
92822347Spst                        <exclude name="**/*.orig"/>
92922347Spst                        <exclude name="**/overview.html"/>
93022347Spst                        <exclude name="**/package.html"/>
93122347Spst                    </fileset>
93222347Spst                </copy>
93322347Spst            </sequential>
93422347Spst        </macrodef>
93522347Spst    </target>
93622347Spst
93722347Spst    <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
93822347Spst        <presetdef name="build-bootstrap-tool">
93922347Spst            <build-tool
94022347Spst                bin.dir="${build.bootstrap.dir}/bin"
94122347Spst                java="${boot.java}"/>
94222347Spst        </presetdef>
94322347Spst    </target>
94422347Spst
94522347Spst    <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
94622347Spst        <presetdef name="build-bootstrap-jar">
94722347Spst            <build-jar
94822347Spst                classes.dir="${build.bootstrap.dir}/classes"
94922347Spst                lib.dir="${build.bootstrap.dir}/lib"/>
95022347Spst        </presetdef>
95122347Spst    </target>
95222347Spst
95322347Spst    <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
95422347Spst        <presetdef name="build-bootstrap-classes">
95522347Spst            <build-classes
95622347Spst                source="${boot.javac.source}"
95722347Spst                target="${boot.javac.target}"
95822347Spst                gensrc.dir="${build.bootstrap.dir}/gensrc"
95922347Spst                classes.dir="${build.bootstrap.dir}/classes"
96022347Spst                javac.bootclasspath=""
96122347Spst                bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
96222347Spst                sourcepath=""
96322347Spst                release="${bootstrap.release}"
96422347Spst                full.version="${bootstrap.full.version}"
96522347Spst                excludes="${bootstrap.exclude.files} **/package-info.java"/>
96622347Spst        </presetdef>
96722347Spst    </target>
96822347Spst
96922347Spst    <target name="-def-pcompile">
97022347Spst        <mkdir dir="${build.toolclasses.dir}"/>
97122347Spst        <javac fork="true"
97222347Spst               source="${boot.javac.source}"
97322347Spst               target="${boot.javac.target}"
97422347Spst               executable="${boot.java.home}/bin/javac"
97522347Spst               srcdir="${make.tools.dir}"
97622347Spst               includes="compileproperties/* anttasks/CompileProperties*"
97722347Spst               destdir="${build.toolclasses.dir}/"
97822347Spst               classpath="${ant.core.lib}"
97922347Spst               bootclasspath="${boot.java.home}/jre/lib/rt.jar"
98022347Spst               includeantruntime="false">
98122347Spst            <compilerarg line="${javac.lint.opts}"/>
98222347Spst        </javac>
98322347Spst        <taskdef name="pcompile"
98422347Spst                 classname="anttasks.CompilePropertiesTask"
98522347Spst                 classpath="${build.toolclasses.dir}/"/>
98622347Spst    </target>
98722347Spst
98822347Spst    <target name="-def-compilecrules">
98922347Spst        <macrodef name="compilecrules">
99022347Spst            <sequential>
99122347Spst                <mkdir dir="${build.toolclasses.dir}"/>
99222347Spst                <javac fork="true"
99322347Spst                       source="${boot.javac.source}"
99422347Spst                       target="${boot.javac.target}"
99522347Spst                       executable="${boot.java.home}/bin/javac"
99622347Spst                       srcdir="${make.tools.dir}"
99722347Spst                       includes="crules/*"
99822347Spst                       destdir="${build.toolclasses.dir}/"
99922347Spst                       classpath="${ant.core.lib}"
100022347Spst                       bootclasspath="${boot.java.home}/jre/lib/rt.jar"
100122347Spst                       includeantruntime="false">
100222347Spst                    <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
100322347Spst                    <compilerarg line="${javac.lint.opts}"/>
100422347Spst                </javac>
100522347Spst                <copy todir="${build.toolclasses.dir}/" includeemptydirs="false">
100622347Spst                    <fileset dir="${make.tools.dir}">
100722347Spst                        <include name="**/*.properties"/>
100822347Spst                    </fileset>
100922347Spst                </copy>
101022347Spst            </sequential>
101122347Spst        </macrodef>
101222347Spst    </target>
101322347Spst
101422347Spst    <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
101522347Spst        <mkdir dir="${build.toolclasses.dir}"/>
101622347Spst        <javac fork="true"
101722347Spst               source="${boot.javac.source}"
101822347Spst               target="${boot.javac.target}"
101922347Spst               executable="${boot.java.home}/bin/javac"
102022347Spst               srcdir="${make.tools.dir}"
102122347Spst               includes="genstubs/* anttasks/GenStubs*"
102222347Spst               destdir="${build.toolclasses.dir}/"
102322347Spst               classpath="${ant.core.lib}"
102422347Spst               includeantruntime="false">
102522347Spst            <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
102622347Spst            <compilerarg line="${javac.lint.opts}"/>
102722347Spst        </javac>
102822347Spst        <taskdef name="genstubs"
102922347Spst                 classname="anttasks.GenStubsTask"
103022347Spst                 classpath="${build.toolclasses.dir}/"/>
103122347Spst    </target>
103222347Spst
103322347Spst    <target name="-def-javadoc-tool" depends="-check-target.java.home">
103422347Spst        <macrodef name="javadoc-tool">
103522347Spst            <attribute name="name"/>
103622347Spst            <attribute name="includes"/>
103722347Spst            <attribute name="options" default=""/>
103822347Spst            <attribute name="source" default="1.5"/> <!-- FIXME -->
103922347Spst            <sequential>
104022347Spst                <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
104122347Spst                <!-- Note: even with this default value, includes
104222347Spst                from src.classes.dir get javadoc'd; see packageset below -->
104322347Spst                <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
104422347Spst                <javadoc
104522347Spst                    executable="${target.java.home}/bin/javadoc"
104622347Spst                    destdir="${build.javadoc.dir}/@{name}"
104722347Spst                    source="@{source}"
104822347Spst                    windowtitle="UNOFFICIAL"
104922347Spst                    failonerror="true"
105022347Spst                    use="true"
105122347Spst                    author="false"
105222347Spst                    version="false"
105322347Spst                    packagenames="${javadoc.packagenames}" >
105422347Spst                    <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
105522347Spst                    <arg line="@{options}"/>
105622347Spst                    <bootclasspath>
105722347Spst                        <path location="${build.classes.dir}"/>
105822347Spst                        <path location="${target.java.home}/jre/lib/rt.jar"/>
105922347Spst                    </bootclasspath>
106022347Spst                    <sourcepath>
106122347Spst                        <pathelement location="${src.classes.dir}"/>
106222347Spst                    </sourcepath>
106322347Spst                    <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
106422347Spst                    <!-- means that {@link some.package} will not work, which is no good. -->
106522347Spst                    <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
106622347Spst                    <!-- which also causes duplicates in the class index for included files.) -->
106722347Spst                    <packageset dir="${src.classes.dir}" includes="@{includes}">
106822347Spst                        <or>
106922347Spst                            <filename name="java/"/>
107022347Spst                            <filename name="javax/"/>
107122347Spst                            <filename name="com/sun/javadoc/"/>
107222347Spst                            <filename name="com/sun/source/"/>
107322347Spst                        </or>
107422347Spst                    </packageset>
107522347Spst                </javadoc>
107622347Spst            </sequential>
107722347Spst        </macrodef>
107822347Spst    </target>
107922347Spst
108022347Spst    <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
108122347Spst        <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
108222347Spst            <classpath>
108322347Spst                <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
108422347Spst                <pathelement location="${jtreg.home}/lib/javatest.jar"/>
108522347Spst            </classpath>
108622347Spst        </taskdef>
108722347Spst        <macrodef name="jtreg-tool">
108822347Spst            <attribute name="name"/>
108922347Spst            <attribute name="tests"/>
109022347Spst            <attribute name="jdk" default="${target.java.home}"/>
109122347Spst            <attribute name="samevm" default="true"/>
109222347Spst            <attribute name="verbose" default="${default.jtreg.verbose}"/>
109322347Spst            <attribute name="options" default="${other.jtreg.options}"/>
109422347Spst            <attribute name="keywords" default="-keywords:!ignore"/>
109522347Spst            <attribute name="jpda.jvmargs" default=""/>
109622347Spst            <sequential>
109722347Spst                <property name="coverage.options" value=""/>              <!-- default -->
109822347Spst                <property name="coverage.classpath" value=""/>            <!-- default -->
109922347Spst                <property name="default.jtreg.verbose" value="summary"/>  <!-- default -->
110022347Spst                <property name="other.jtreg.options" value=""/>           <!-- default -->
110122347Spst                <jtreg
110222347Spst                    dir="${test.dir}"
110322347Spst                    workDir="${build.jtreg.dir}/@{name}/work"
110422347Spst                    reportDir="${build.jtreg.dir}/@{name}/report"
110522347Spst                    jdk="@{jdk}"
110622347Spst                    samevm="@{samevm}" verbose="@{verbose}"
110722347Spst                    failonerror="false" resultproperty="jtreg.@{name}.result"
110822347Spst                    javacoptions="-g"
110922347Spst                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs}">
111022347Spst                    <arg line="@{keywords}"/>
111122347Spst                    <arg line="@{options}"/>
111222347Spst                    <arg line="@{tests}"/>
111322347Spst                </jtreg>
111422347Spst                <!-- the next two properties are for convenience, when only
111522347Spst                     a single instance of jtreg will be invoked. -->
111622347Spst                <condition property="jtreg.passed">
111722347Spst                    <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
111822347Spst                </condition>
111922347Spst                <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
112022347Spst            </sequential>
112122347Spst        </macrodef>
112222347Spst        <property name="jtreg.defined" value="true"/>
112322347Spst    </target>
112422347Spst
112522347Spst    <target name="-def-cobertura" depends="-check-cobertura.home">
112622347Spst        <path id="cobertura.classpath">
112722347Spst            <fileset dir="${cobertura.home}">
112822347Spst                <include name="cobertura.jar"/>
112922347Spst                <include name="lib/**/*.jar"/>
113022347Spst            </fileset>
113122347Spst        </path>
113222347Spst        <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
113322347Spst    </target>
113422347Spst
113522347Spst    <target name="-def-checkstyle" unless="checkstyle.defined"
113622347Spst        depends="-check-checkstyle.home">
113722347Spst        <taskdef resource="checkstyletask.properties">
113822347Spst            <classpath>
113922347Spst                <pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>
114022347Spst            </classpath>
114122347Spst        </taskdef>
114222347Spst        <property name="checkstyle.defined" value="true"/>
114322347Spst    </target>
114422347Spst
114522347Spst    <target name="-def-findbugs" unless="findbugs.defined"
114622347Spst        depends="-check-findbugs.home,-check-target.java.home">
114722347Spst        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
114822347Spst            <classpath>
114922347Spst                <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
115022347Spst            </classpath>
115122347Spst        </taskdef>
115222347Spst        <macrodef name="findbugs-tool">
115322347Spst            <attribute name="name"/>
115422347Spst            <attribute name="output" default="emacs"/>
115522347Spst            <attribute name="outputFile" default=""/>
115622347Spst            <attribute name="reportLevel" default="high"/>
115722347Spst            <sequential>
115822347Spst                <findbugs
115922347Spst                    home="${findbugs.home}"
116022347Spst                    output="@{output}"
116122347Spst                    outputFile="@{outputFile}"
116222347Spst                    reportLevel="@{reportLevel}"
116322347Spst                    failOnError="false"
116422347Spst                    errorProperty="findbugs.@{name}.errors"
116522347Spst                    warningsProperty="findbugs.@{name}.warnings"
116622347Spst                    jvm="${target.java.home}/bin/java"
116722347Spst                    jvmargs="-Xmx512M" >
116822347Spst                    <class location="${dist.dir}/lib/@{name}.jar"/>
116922347Spst                    <auxClasspath>
117022347Spst                        <pathelement location="${build.classes.dir}"/>
117122347Spst                    </auxClasspath>
117222347Spst                    <sourcePath>
117322347Spst                        <pathelement location="${src.classes.dir}"/>
117422347Spst                    </sourcePath>
117522347Spst                </findbugs>
117622347Spst            </sequential>
117722347Spst        </macrodef>
117822347Spst        <property name="findbugs.defined" value="true"/>
117922347Spst    </target>
118022347Spst
118122347Spst    <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
118222347Spst        <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
118322347Spst        <property name="vizant.defined" value="true"/>
118422347Spst    </target>
118522347Spst
118622347Spst    <target name="-def-check">
118722347Spst        <macrodef name="check">
118822347Spst            <attribute name="name"/>
118922347Spst            <attribute name="property"/>
119022347Spst            <attribute name="marker" default=""/>
119122347Spst            <sequential>
119222347Spst                <fail message="Cannot locate @{name}: please set @{property} to its location">
119322347Spst                    <condition>
119422347Spst                        <not>
119522347Spst                            <isset property="@{property}"/>
119622347Spst                        </not>
119722347Spst                    </condition>
119822347Spst                </fail>
119922347Spst                <fail message="@{name} is not installed in ${@{property}}">
120022347Spst                    <condition>
120122347Spst                        <and>
120222347Spst                            <not>
120322347Spst                                <equals arg1="@{marker}" arg2=""/>
120422347Spst                            </not>
120522347Spst                            <not>
120622347Spst                                <available file="${@{property}}/@{marker}"/>
120722347Spst                            </not>
120822347Spst                        </and>
120922347Spst                    </condition>
121022347Spst                </fail>
121122347Spst            </sequential>
121222347Spst        </macrodef>
121322347Spst    </target>
121422347Spst
121522347Spst</project>
121622347Spst
121722347Spst