jdk-24/langtools/make/build.xml

979 lines
42 KiB
XML
Raw Normal View History

2007-12-01 00:00:00 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
2007-12-01 00:00:00 +00:00
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
2007-12-01 00:00:00 +00:00
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
2007-12-01 00:00:00 +00:00
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
2007-12-01 00:00:00 +00:00
-->
<!--
This is the main build file for the complete langtools repository.
It is used when building JDK (in which case it is invoked from the
Makefile), and it can be used when working on the tools themselves,
in an IDE such as NetBeans.
External dependencies are specified via properties. These can be given
on the command line, or by providing a local build.properties file.
(They can also be edited into make/build.properties, although that is not
recommended.) At a minimum, boot.java.home must be set to the installed
location of the version of JDK used to build this repository. Additional
properties may be required, depending on the targets that are built.
For example, to run any of the jtreg tests you must set jtreg.home,
to run findbugs on the code you must set findbugs.home, and so on.
For the most part, javac can be built using the previous version of JDK.
However, a small number of javac files require access to the latest JDK,
which may not yet have been compiled. To compile these files, you can do
one of the following:
- Set boot.java.home to a recent build of the latest version of JDK.
- Set import.jdk to either a recent build (containing jre/lib/rt.jar)
or to jdk source repository. In the latter case, stub files will
automatically be generated and used for the required API, to avoid
unnecessary compilation of the source repository.
If you do neither, the relevant files will not be built.
The main build happens in two phases:
- First, javac and other tools as needed are built using ${boot.java.home}.
(This implies a constraint on the source code that they can be compiled
with the previous version of JDK.
- Second, all required classes are compiled with the latest javac, created
in the previous step.
The first phase is called the bootstrap phase. All targets, properties and
tasks that are specific to that phase have "bootstrap" in their name.
For more details on the JDK build, see
http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build
http://openjdk.java.net/groups/build/
For more details on the stub generator, see
http://blogs.sun.com/jjg/entry/building_javac_for_jdk7
Internal details ...
Interim build products are created in the build/ directory.
Final build products are created in the dist/ directory.
When building JDK, the dist/directory will contain:
- A bootstrap compiler suitable for running with ${boot.java.home}
suitable for compiling downstream parts of JDK
- Source files and class files for inclusion in the JDK being built
When building standalone, the dist/directory will contain:
- Separate jar files for each of the separate langtools components
- Simple scripts to invoke the tools by executing the corresponding
jar files.
These jar files and scripts are "for developer use only".
This file is organized into sections as follows:
- global property definitions
- general top level targets
- general diagnostic/debugging targets
- groups of targets for each tool: javac, javadoc, doclets, javah, javap, apt
Within each group, the following targets are provided, where applicable
build-bootstrap-TOOL build the bootstrap version of the tool
build-classes-TOOL build the classes for the tool
build-TOOL build the jar file and script for the tool
jtreg-TOOL build the tool and run the appropriate tests
findbugs-TOOL run findbugs on the tool's source oode
TOOL build the tool, run the tests, and run findbugs
- utility definitions
2007-12-01 00:00:00 +00:00
-->
<project name="langtools" default="build" basedir="..">
<!--
**** Global property definitions.
-->
<!-- Force full debuginfo for javac if the debug.classfiles
property is set. This must be BEFORE the include of
build.properties because it sets javac.debuglevel. -->
<condition property="javac.debuglevel" value="source,lines,vars">
<equals arg1="${debug.classfiles}" arg2="true"/>
</condition>
2007-12-01 00:00:00 +00:00
<!-- The following locations can be used to override default property values. -->
<!-- Use this location for customizations specific to this instance of this workspace -->
<property file="build.properties"/>
<!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
<property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
<!-- Use this location for customizations common to all OpenJDK workspaces -->
<property file="${user.home}/.openjdk/build.properties"/>
<!-- Convenient shorthands for standard locations within the workspace. -->
2007-12-01 00:00:00 +00:00
<property name="build.dir" location="build"/>
<property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
<property name="build.coverage.dir" location="${build.dir}/coverage"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
<property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
2007-12-01 00:00:00 +00:00
<property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
<property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
<property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
<property name="dist.dir" location="dist"/>
<property name="dist.bin.dir" location="${dist.dir}/bin"/>
<property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
<property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
<property name="dist.lib.dir" location="${dist.dir}/lib"/>
<property name="make.dir" location="make"/>
<property name="make.tools.dir" location="${make.dir}/tools"/>
<property name="src.dir" location="src"/>
<property name="src.bin.dir" location="${src.dir}/share/bin"/>
<property name="src.classes.dir" location="${src.dir}/share/classes"/>
<property name="test.dir" location="test"/>
<!-- java.marker is set to a marker file to check for within a Java install dir.
The best file to check for across Solaris/Linux/Windows/MacOS is one of the
executables; regrettably, that is OS-specific. -->
<condition property="java.marker" value="bin/java">
<os family="unix"/>
2007-12-01 00:00:00 +00:00
</condition>
<condition property="java.marker" value="bin/java.exe">
<os family="windows"/>
2007-12-01 00:00:00 +00:00
</condition>
2007-12-01 00:00:00 +00:00
<!-- Standard property values, if not overriden by earlier settings. -->
<property file="${make.dir}/build.properties"/>
<!-- launcher.java is used in the launcher scripts provided to run
the tools' jar files. If it has not already been set, then
default it to use ${target.java.home}, if available, otherwise
quietly default to simply use "java". -->
<condition property="launcher.java"
value="${target.java.home}/bin/java" else="java">
<isset property="target.java.home"/>
</condition>
<!-- Logic for handling access import jdk classes, if available.
import.jdk should be unset, or set to jdk home (to use rt.jar)
or to jdk repo (to use src/share/classes).
Based on the value, if any, set up default values for javac's sourcepath,
classpath and bootclasspath. Note: the default values are overridden
in the build-bootstrap-classes macro. -->
<available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
<available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
ignoresystemclasses="true"
classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
<!-- Set the default bootclasspath option used for javac.
Note that different variants of the option are used, meaning we can't just
define the value for the option.
Note the explicit use of the standard property ${path.separator} in the following.
This is because Ant is not clever enough to handle direct use of : or ; -->
<condition property="javac.bootclasspath.opt"
value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
else="-Xbootclasspath/p:${build.classes.dir}">
<isset property="import.jdk.jar"/>
</condition>
<condition property="boot.java.provides.latest.jdk">
<available
ignoresystemclasses="true"
classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
</condition>
<condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">
<isset property="boot.java.provides.latest.jdk"/>
</condition>
<condition property="exclude.files" value="" else="${require.latest.jdk.files}">
<or>
<isset property="boot.java.provides.latest.jdk"/>
<isset property="import.jdk"/>
</or>
</condition>
<condition property="require.import.jdk.stubs">
<and>
<not>
<isset property="boot.java.provides.latest.jdk"/>
</not>
<isset property="import.jdk.src.dir"/>
</and>
</condition>
<!-- Set the default value of the sourcepath used for javac. -->
<condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
<isset property="require.import.jdk.stubs"/>
</condition>
<!-- Set the default value of the classpath used for javac. -->
<property name="javac.classpath" value=""/>
<!--
**** General top level targets.
-->
2007-12-01 00:00:00 +00:00
<!-- Standard target to build deliverables for JDK build. -->
<target name="build" depends="build-bootstrap-tools,build-all-classes">
<copy todir="${dist.dir}/bootstrap">
<fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
</copy>
<chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
<include name="*"/>
</chmod>
<mkdir dir="${dist.lib.dir}"/>
<jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
<zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
</target>
<target name="build-bootstrap-tools"
depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
/>
<target name="build-all-tools"
depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"
/>
<target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
<build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${apt.includes}"/>
</target>
2007-12-01 00:00:00 +00:00
<!-- clean -->
<target name="clean" description="Delete all generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- Additional targets for running tools on the build -->
<target name="jtreg" depends="build-all-tools,-def-jtreg">
<jtreg-tool name="all" tests="${jtreg.tests}"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs" depends="-def-findbugs,build-all-tools">
<property name="findbugs.reportLevel" value="medium"/>
<mkdir dir="${dist.findbugs.dir}"/>
<findbugs
home="${findbugs.home}"
projectName="JDK langtools ${full.version}"
output="xml"
outputFile="${dist.findbugs.dir}/findbugs.xml"
reportLevel="${findbugs.reportLevel}"
failOnError="false"
errorProperty="findbugs.all.errors"
warningsProperty="findbugs.all.warnings"
jvmargs="-Xmx512M">
<class location="${build.classes.dir}"/>
<sourcePath>
<pathelement location="${src.classes.dir}"/>
</sourcePath>
</findbugs>
<exec executable="sh">
<arg value="${findbugs.home}/bin/convertXmlToText"/>
<arg value="-longBugCodes"/>
<arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
<arg value="${dist.findbugs.dir}/findbugs.xml"/>
<redirector output="${dist.findbugs.dir}/findbugs.html"/>
</exec>
2007-12-01 00:00:00 +00:00
</target>
<target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
<target name="instrument-classes" depends="-def-cobertura">
<!-- only define the following property when we want coverage info -->
<path id="coverage.classpath">
<pathelement location="${build.coverage.dir}/classes"/>
<path refid="cobertura.classpath"/>
</path>
<property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
<property name="coverage.classpath" refid="coverage.classpath"/>
<mkdir dir="${build.coverage.dir}/classes"/>
<delete file="${build.coverage.dir}/cobertura.ser"/>
<cobertura-instrument todir="${build.coverage.dir}/classes"
datafile="${build.coverage.dir}/cobertura.ser">
<fileset dir="${build.classes.dir}"
2007-12-01 00:00:00 +00:00
includes="**/*.class" excludes="**/resources/*.class"/>
</cobertura-instrument>
</target>
2007-12-01 00:00:00 +00:00
<target name="coverage-report" depends="-def-cobertura">
<mkdir dir="${dist.coverage.dir}"/>
<cobertura-report
2007-12-01 00:00:00 +00:00
srcdir="${src.classes.dir}"
destdir="${dist.coverage.dir}"
datafile="${build.coverage.dir}/cobertura.ser"/>
<cobertura-report
format="xml"
srcdir="${src.classes.dir}"
2007-12-01 00:00:00 +00:00
destdir="${dist.coverage.dir}"
datafile="${build.coverage.dir}/cobertura.ser"/>
</target>
<!--
**** Debugging/diagnostic targets.
-->
<!-- standard JDK target -->
<target name="sanity"
description="display settings of configuration values">
<echo level="info">ant.home = ${ant.home}</echo>
<echo level="info">boot.java.home = ${boot.java.home}</echo>
<echo level="info">target.java.home = ${target.java.home}</echo>
<echo level="info">jtreg.home = ${jtreg.home}</echo>
<echo level="info">findbugs.home = ${findbugs.home}</echo>
</target>
<target name="post-sanity" depends="-def-jtreg,sanity,build"
description="perform basic validation after a standard build">
<jtreg
dir="make/test"
workDir="${build.jtreg.dir}/post-sanity/work"
reportDir="${build.jtreg.dir}/post-sanity/report"
jdk="${target.java.home}"
verbose="summary"
failonerror="false" resultproperty="jtreg.post-sanity.result">
</jtreg>
</target>
<!-- use vizant tool to generate graphical image of this Ant file.-->
<target name="vizant" depends="-def-vizant">
<mkdir dir="${build.dir}"/>
<echo message="Generating ${build.dir}/build.dot"/>
<vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
<echo message="Generating ${build.dir}/build.png"/>
<exec executable="${dot}" >
<arg value="-Tpng"/>
<arg value="-o"/>
<arg file="${build.dir}/build.png"/>
<arg file="${build.dir}/build.dot"/>
</exec>
</target>
<target name="check-import.jdk">
<echo message="import.jdk: ${import.jdk}"/>
<echo message="import.jdk.jar: ${import.jdk.jar}"/>
<echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
</target>
<target name="diagnostics">
<diagnostics/>
</target>
<!--
**** javac targets.
-->
2007-12-01 00:00:00 +00:00
<target name="build-bootstrap-javac"
depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
<build-bootstrap-classes includes="${javac.includes}"/>
<build-bootstrap-jar name="javac" includes="${javac.includes}"/>
<build-bootstrap-tool name="javac"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
<build-classes includes="${javac.includes}"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-javac" depends="build-classes-javac">
<build-jar name="javac" includes="${javac.includes}"/>
<build-tool name="javac"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
<javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls3.option}"/>
</target>
<target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
<jtreg-tool name="javac" tests="${javac.tests}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs-javac" depends="build-javac,-def-findbugs">
<findbugs-tool name="javac"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
<!--
**** javadoc targets.
-->
2007-12-01 00:00:00 +00:00
<target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
<build-bootstrap-classes includes="${javadoc.includes}"/>
<build-bootstrap-jar name="javadoc" includes="${javadoc.includes}"
jarclasspath="javac.jar doclets.jar"/>
<build-bootstrap-tool name="javadoc"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="build-classes-javadoc" depends="build-classes-javac">
<build-classes includes="${javadoc.includes}"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-javadoc" depends="build-javac,build-classes-javadoc">
<build-jar name="javadoc" includes="${javadoc.includes}"
2007-12-01 00:00:00 +00:00
jarclasspath="javac.jar doclets.jar"/>
<build-tool name="javadoc"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
<javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
<jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
<findbugs-tool name="javadoc"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
<!--
**** doclets targets.
-->
2007-12-01 00:00:00 +00:00
<target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
<build-bootstrap-classes includes="${doclets.includes}"/>
<build-bootstrap-jar name="doclets" includes="${doclets.includes}"
jarmainclass="com.sun.tools.javadoc.Main"
jarclasspath="javadoc.jar"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="build-classes-doclets" depends="build-classes-javadoc">
<build-classes includes="${doclets.includes}"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-doclets" depends="build-javadoc,build-classes-doclets">
2007-12-01 00:00:00 +00:00
<!-- just jar, no bin for doclets -->
<build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
2007-12-01 00:00:00 +00:00
</target>
<!-- (no javadoc for doclets) -->
2007-12-01 00:00:00 +00:00
<target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
<jtreg-tool name="doclets" tests="${doclets.tests}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
<findbugs-tool name="doclets"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
<!--
**** javah targets.
-->
2007-12-01 00:00:00 +00:00
<target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
<build-bootstrap-classes includes="${javah.includes}"/>
<build-bootstrap-jar name="javah" includes="${javah.includes}"
jarclasspath="javadoc.jar doclets.jar javac.jar"/>
<build-bootstrap-tool name="javah"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-javah" depends="build-javac,build-classes-javah">
<build-jar name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
<build-tool name="javah"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="build-classes-javah" depends="build-classes-javadoc">
<build-classes includes="${javah.includes}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<!-- (no javadoc for javah) -->
<target name="jtreg-javah" depends="build-javah,-def-jtreg">
<jtreg-tool name="javah" tests="${javah.tests}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs-javah" depends="build-javah,-def-findbugs">
<findbugs-tool name="javah"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
<!--
**** javap targets.
-->
2007-12-01 00:00:00 +00:00
<target name="build-bootstrap-javap"
depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
<build-bootstrap-classes includes="${javap.includes}"/>
<build-bootstrap-jar name="javap" includes="${javap.includes}"
jarmainclass="sun.tools.javap.Main"/>
<build-bootstrap-tool name="javap"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-classes-javap" depends="build-classes-javac">
<build-classes includes="${javap.includes}"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-javap" depends="build-javac,build-classes-javap">
<build-jar name="javap" includes="${javap.includes}"
jarmainclass="com.sun.tools.javap.Main"
jarclasspath="javac.jar"/>
<build-tool name="javap"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<!-- (no javadoc for javap) -->
<target name="jtreg-javap" depends="build-javap,-def-jtreg">
<jtreg-tool name="javap" tests="${javap.tests}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs-javap" depends="build-javap,-def-findbugs">
<findbugs-tool name="javap"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
<!--
**** apt targets.
-->
2007-12-01 00:00:00 +00:00
<target name="build-bootstrap-apt" depends="build-bootstrap-javac">
<build-bootstrap-classes includes="${apt.includes}"/>
<build-bootstrap-jar name="apt" includes="${apt.includes}"
jarclasspath="javac.jar"/>
<build-bootstrap-tool name="apt"/>
2007-12-01 00:00:00 +00:00
</target>
<target name="build-apt" depends="build-javac,build-classes-apt">
<build-jar name="apt" includes="${apt.includes}" jarclasspath="javac.jar"/>
<build-tool name="apt"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="build-classes-apt" depends="build-classes-javac">
<build-classes includes="${apt.includes}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
<javadoc-tool name="apt" includes="${apt.includes}"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="jtreg-apt" depends="build-apt,-def-jtreg">
<jtreg-tool name="apt" tests="${apt.tests}"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="findbugs-apt" depends="build-apt,-def-findbugs">
<findbugs-tool name="apt"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
<!--
**** Create import JDK stubs.
-->
<target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
<mkdir dir="${build.genstubs.dir}"/>
<genstubs
srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
includes="${import.jdk.stub.files}"
fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"
/>
</target>
<!--
**** Check targets.
**** "-check-*" targets check that a required property is set, and set to a reasonable value.
**** A user friendly message is generated if not, and the build exits.
-->
2007-12-01 00:00:00 +00:00
<target name="-check-boot.java.home" depends="-def-check">
<check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="-check-target.java.home" depends="-def-check">
<check name="target java" property="target.java.home" marker="${java.marker}"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="-check-cobertura.home" depends="-def-check">
<check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="-check-findbugs.home" depends="-def-check">
<check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="-check-jtreg.home" depends="-def-check">
<check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
</target>
<target name="-check-vizant" depends="-def-check">
<check name="vizant" property="vizant.jar"/>
<check name="dot" property="dot"/>
</target>
<!--
**** Targets for Ant macro and task definitions.
-->
2007-12-01 00:00:00 +00:00
<target name="-def-build-tool">
2007-12-01 00:00:00 +00:00
<macrodef name="build-tool">
<attribute name="name"/>
<attribute name="bin.dir" default="${dist.bin.dir}"/>
<attribute name="java" default="${launcher.java}"/>
2007-12-01 00:00:00 +00:00
<sequential>
<mkdir dir="@{bin.dir}"/>
<copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
<filterset begintoken="#" endtoken="#">
<filter token="PROGRAM" value="@{name}"/>
<filter token="TARGET_JAVA" value="@{java}"/>
2007-12-01 00:00:00 +00:00
</filterset>
</copy>
<chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
</sequential>
</macrodef>
</target>
<target name="-def-build-jar">
2007-12-01 00:00:00 +00:00
<macrodef name="build-jar">
<attribute name="name"/>
<attribute name="includes"/>
<attribute name="classes.dir" default="${build.classes.dir}"/>
<attribute name="lib.dir" default="${dist.lib.dir}"/>
<attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
<attribute name="jarclasspath" default=""/>
<sequential>
<mkdir dir="@{lib.dir}"/>
<jar destfile="@{lib.dir}/@{name}.jar"
basedir="@{classes.dir}"
includes="@{includes}">
<manifest>
2007-12-01 00:00:00 +00:00
<attribute name="Main-Class" value="@{jarmainclass}"/>
<attribute name="Class-Path" value="@{jarclasspath}"/>
</manifest>
</jar>
</sequential>
</macrodef>
</target>
<target name="-def-build-classes" depends="-def-pcompile">
<macrodef name="build-classes">
<attribute name="includes"/>
<attribute name="excludes" default="${exclude.files} **/package-info.java"/>
2007-12-01 00:00:00 +00:00
<attribute name="classes.dir" default="${build.classes.dir}"/>
<attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
<attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
<attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
<attribute name="classpath" default="${javac.classpath}"/>
<attribute name="sourcepath" default="${javac.sourcepath}"/>
<attribute name="java.home" default="${boot.java.home}"/>
<attribute name="source" default="${javac.source}"/>
<attribute name="target" default="${javac.target}"/>
2007-12-01 00:00:00 +00:00
<attribute name="release" default="${release}"/>
<attribute name="full.version" default="${full.version}"/>
<sequential>
<echo level="verbose" message="build-classes: excludes=@{excludes}"/>
<echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
<echo level="verbose" message="build-classes: classpath=@{classpath}"/>
<echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
2007-12-01 00:00:00 +00:00
<mkdir dir="@{gensrc.dir}"/>
<mkdir dir="@{classes.dir}"/>
<pcompile srcdir="${src.classes.dir}"
destdir="@{gensrc.dir}"
includes="@{includes}"/>
<copy todir="@{gensrc.dir}">
<fileset dir="${src.classes.dir}" includes="@{includes}"/>
2007-12-01 00:00:00 +00:00
<globmapper from="*.properties-template" to="*.properties"/>
<filterset begintoken="$(" endtoken=")">
<filter token="JDK_VERSION" value="${jdk.version}"/>
<filter token="RELEASE" value="@{release}"/>
<filter token="FULL_VERSION" value="@{full.version}"/>
</filterset>
</copy>
<pcompile srcdir="@{gensrc.dir}"
destdir="@{gensrc.dir}"
includes="**/*.properties"/>
<javac fork="true"
executable="@{java.home}/bin/javac"
srcdir="${src.classes.dir}:@{gensrc.dir}"
2007-12-01 00:00:00 +00:00
destdir="@{classes.dir}"
includes="@{includes}"
excludes="@{excludes}"
sourcepath="@{sourcepath}"
classpath="@{classpath}"
2007-12-01 00:00:00 +00:00
includeAntRuntime="no"
source="@{source}"
target="@{target}"
debug="${javac.debug}"
2007-12-01 00:00:00 +00:00
debuglevel="${javac.debuglevel}">
<compilerarg value="-implicit:none"/>
<compilerarg value="-Xprefer:source"/>
<compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
<compilerarg line="@{bootclasspath.opt}"/>
2007-12-01 00:00:00 +00:00
<compilerarg line="${javac.no.jdk.warnings}"/>
<compilerarg line="${javac.version.opt}"/>
<compilerarg line="${javac.lint.opts}"/>
</javac>
<copy todir="@{classes.dir}" includeemptydirs="false">
<fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
2007-12-01 00:00:00 +00:00
<exclude name="**/*.java"/>
<exclude name="**/*.properties"/>
<exclude name="**/*-template"/>
<exclude name="**/package.html"/>
</fileset>
</copy>
</sequential>
</macrodef>
</target>
2007-12-01 00:00:00 +00:00
<target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
<presetdef name="build-bootstrap-tool">
<build-tool
bin.dir="${build.bootstrap.dir}/bin"
java="${boot.java}"/>
2007-12-01 00:00:00 +00:00
</presetdef>
</target>
2007-12-01 00:00:00 +00:00
<target name="-def-build-bootstrap-jar" depends="-def-build-jar">
<presetdef name="build-bootstrap-jar">
<build-jar
classes.dir="${build.bootstrap.dir}/classes"
lib.dir="${build.bootstrap.dir}/lib"/>
</presetdef>
</target>
<target name="-def-build-bootstrap-classes" depends="-def-build-classes">
<presetdef name="build-bootstrap-classes">
<build-classes
source="${boot.javac.source}"
target="${boot.javac.target}"
2007-12-01 00:00:00 +00:00
gensrc.dir="${build.bootstrap.dir}/gensrc"
classes.dir="${build.bootstrap.dir}/classes"
javac.bootclasspath=""
bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
sourcepath=""
2007-12-01 00:00:00 +00:00
release="${bootstrap.release}"
full.version="${bootstrap.full.version}"
excludes="${bootstrap.exclude.files} **/package-info.java"/>
2007-12-01 00:00:00 +00:00
</presetdef>
</target>
2007-12-01 00:00:00 +00:00
<target name="-def-pcompile">
<mkdir dir="${build.toolclasses.dir}"/>
<javac fork="true"
source="${boot.javac.source}"
target="${boot.javac.target}"
executable="${boot.java.home}/bin/javac"
srcdir="${make.tools.dir}/CompileProperties"
2007-12-01 00:00:00 +00:00
destdir="${build.toolclasses.dir}/"
classpath="${ant.home}/lib/ant.jar"/>
<taskdef name="pcompile"
classname="CompilePropertiesTask"
2007-12-01 00:00:00 +00:00
classpath="${build.toolclasses.dir}/"/>
</target>
<target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
<mkdir dir="${build.toolclasses.dir}"/>
<javac fork="true"
source="${boot.javac.source}"
target="${boot.javac.target}"
executable="${boot.java.home}/bin/javac"
srcdir="${make.tools.dir}/GenStubs"
destdir="${build.toolclasses.dir}/"
classpath="${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"/>
<taskdef name="genstubs"
classname="GenStubs$$Ant"
classpath="${build.toolclasses.dir}/"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="-def-javadoc-tool" depends="-check-target.java.home">
<macrodef name="javadoc-tool">
<attribute name="name"/>
<attribute name="includes"/>
<attribute name="options" default=""/>
<attribute name="source" default="1.5"/> <!-- FIXME -->
<sequential>
<property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
<!-- Note: even with this default value, includes
from src.classes.dir get javadoc'd; see packageset below -->
2007-12-01 00:00:00 +00:00
<property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
<javadoc
2007-12-01 00:00:00 +00:00
executable="${target.java.home}/bin/javadoc"
destdir="${build.javadoc.dir}/@{name}"
2007-12-01 00:00:00 +00:00
source="@{source}"
windowtitle="UNOFFICIAL"
failonerror="true"
2007-12-01 00:00:00 +00:00
use="true"
author="false"
2007-12-01 00:00:00 +00:00
version="false"
packagenames="${javadoc.packagenames}" >
<header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
<arg line="@{options}"/>
<bootclasspath>
<path location="${build.classes.dir}"/>
<path location="${target.java.home}/jre/lib/rt.jar"/>
</bootclasspath>
<sourcepath>
<pathelement location="${src.classes.dir}"/>
</sourcepath>
<!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
<!-- means that {@link some.package} will not work, which is no good. -->
<!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
<!-- which also causes duplicates in the class index for included files.) -->
<packageset dir="${src.classes.dir}" includes="@{includes}">
<or>
<filename name="java/"/>
<filename name="javax/"/>
<filename name="com/sun/javadoc/"/>
<filename name="com/sun/mirror/"/>
<filename name="com/sun/source/"/>
</or>
</packageset>
</javadoc>
</sequential>
</macrodef>
</target>
<target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
2007-12-01 00:00:00 +00:00
<taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
<classpath>
<pathelement location="${jtreg.home}/lib/jtreg.jar"/>
<pathelement location="${jtreg.home}/lib/javatest.jar"/>
</classpath>
</taskdef>
<macrodef name="jtreg-tool">
<attribute name="name"/>
<attribute name="tests"/>
<attribute name="jdk" default="${target.java.home}"/>
<attribute name="samevm" default="true"/>
<attribute name="verbose" default="${default.jtreg.verbose}"/>
<attribute name="options" default="${other.jtreg.options}"/>
2007-12-01 00:00:00 +00:00
<attribute name="keywords" default="-keywords:!ignore"/>
<attribute name="jpda.jvmargs" default=""/>
<sequential>
<property name="coverage.options" value=""/> <!-- default -->
<property name="coverage.classpath" value=""/> <!-- default -->
<property name="default.jtreg.verbose" value="summary"/> <!-- default -->
<property name="other.jtreg.options" value=""/> <!-- default -->
<jtreg
2007-12-01 00:00:00 +00:00
dir="${test.dir}"
workDir="${build.jtreg.dir}/@{name}/work"
2007-12-01 00:00:00 +00:00
reportDir="${build.jtreg.dir}/@{name}/report"
jdk="@{jdk}"
samevm="@{samevm}" verbose="@{verbose}"
failonerror="false" resultproperty="jtreg.@{name}.result"
javacoptions="-g"
vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}:${build.classes.dir} @{jpda.jvmargs}">
<arg line="@{keywords}"/>
<arg line="@{options}"/>
<arg line="@{tests}"/>
</jtreg>
<!-- the next two properties are for convenience, when only
2007-12-01 00:00:00 +00:00
a single instance of jtreg will be invoked. -->
<condition property="jtreg.passed">
<equals arg1="${jtreg.@{name}.result}" arg2="0"/>
2007-12-01 00:00:00 +00:00
</condition>
<property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
</sequential>
</macrodef>
<property name="jtreg.defined" value="true"/>
</target>
<target name="-def-cobertura" depends="-check-cobertura.home">
<path id="cobertura.classpath">
<fileset dir="${cobertura.home}">
<include name="cobertura.jar"/>
<include name="lib/**/*.jar"/>
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
2007-12-01 00:00:00 +00:00
</target>
2007-12-01 00:00:00 +00:00
<target name="-def-findbugs" unless="findbugs.defined" depends="-check-findbugs.home">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath>
<pathelement location="${findbugs.home}/lib/findbugs.jar"/>
</classpath>
</taskdef>
<macrodef name="findbugs-tool">
<attribute name="name"/>
<attribute name="output" default="emacs"/>
<attribute name="outputFile" default=""/>
<attribute name="reportLevel" default="high"/>
<sequential>
<findbugs
2007-12-01 00:00:00 +00:00
home="${findbugs.home}"
output="@{output}"
outputFile="@{outputFile}"
reportLevel="@{reportLevel}"
failOnError="false"
errorProperty="findbugs.@{name}.errors"
warningsProperty="findbugs.@{name}.warnings"
jvmargs="-Xmx512M" >
<class location="${dist.dir}/lib/@{name}.jar"/>
<auxClasspath>
<pathelement location="${build.classes.dir}"/>
</auxClasspath>
<sourcePath>
<pathelement location="${src.classes.dir}"/>
</sourcePath>
</findbugs>
</sequential>
</macrodef>
<property name="findbugs.defined" value="true"/>
</target>
<target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
<taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
<property name="vizant.defined" value="true"/>
</target>
2007-12-01 00:00:00 +00:00
<target name="-def-check">
<macrodef name="check">
<attribute name="name"/>
<attribute name="property"/>
<attribute name="marker" default=""/>
2007-12-01 00:00:00 +00:00
<sequential>
<fail message="Cannot locate @{name}: please set @{property} to its location">
<condition>
<not>
<isset property="@{property}"/>
</not>
</condition>
</fail>
<fail message="@{name} is not installed in ${@{property}}">
<condition>
<and>
<not>
<equals arg1="@{marker}" arg2=""/>
</not>
<not>
<available file="${@{property}}/@{marker}"/>
</not>
</and>
2007-12-01 00:00:00 +00:00
</condition>
</fail>
</sequential>
</macrodef>
</target>
</project>