build.xml revision 1161
0N/A<?
xml version="1.0" encoding="UTF-8"?>
841N/A Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A This code is free software; you can redistribute it and/or modify it 0N/A under the terms of the GNU General Public License version 2 only, as 553N/A published by the Free Software Foundation. Oracle designates this 0N/A particular file as subject to the "Classpath" exception as provided 553N/A by Oracle in the LICENSE file that accompanied this code. 0N/A This code is distributed in the hope that it will be useful, but WITHOUT 0N/A ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A version 2 for more details (a copy is included in the LICENSE file that 0N/A accompanied this code). 0N/A You should have received a copy of the GNU General Public License version 0N/A 2 along with this work; if not, write to the Free Software Foundation, 0N/A Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 578N/A This is the main build file for the complete langtools repository. 578N/A It is used when building JDK (in which case it is invoked from the 578N/A Makefile), and it can be used when working on the tools themselves, 578N/A in an IDE such as NetBeans. 578N/A External dependencies are specified via properties. These can be given 578N/A location of the version of JDK used to build this repository. Additional 578N/A properties may be required, depending on the targets that are built. 578N/A For the most part, javac can be built using the previous version of JDK. 578N/A However, a small number of javac files require access to the latest JDK, 578N/A which may not yet have been compiled. To compile these files, you can do 578N/A or to jdk source repository. In the latter case, stub files will 578N/A automatically be generated and used for the required API, to avoid 578N/A unnecessary compilation of the source repository. 578N/A If you do neither, the relevant files will not be built. 578N/A The main build happens in two phases: 578N/A (This implies a constraint on the source code that they can be compiled 578N/A with the previous version of JDK. 578N/A - Second, all required classes are compiled with the latest javac, created 578N/A The first phase is called the bootstrap phase. All targets, properties and 578N/A tasks that are specific to that phase have "bootstrap" in their name. 578N/A For more details on the JDK build, see 578N/A For more details on the stub generator, see 578N/A Interim build products are created in the build/ directory. 578N/A Final build products are created in the dist/ directory. 578N/A suitable for compiling downstream parts of JDK 578N/A - Source files and class files for inclusion in the JDK being built 578N/A - Separate jar files for each of the separate langtools components 578N/A - Simple scripts to invoke the tools by executing the corresponding 578N/A These jar files and scripts are "for developer use only". 578N/A This file is organized into sections as follows: 578N/A - global property definitions 578N/A - general top level targets 578N/A - groups of targets for each tool: javac, javadoc, doclets, javah, javap, apt 578N/A Within each group, the following targets are provided, where applicable 578N/A build-bootstrap-TOOL build the bootstrap version of the tool 578N/A build-classes-TOOL build the classes for the tool 578N/A build-TOOL build the jar file and script for the tool 578N/A jtreg-TOOL build the tool and run the appropriate tests 578N/A findbugs-TOOL run findbugs on the tool's source oode 578N/A TOOL build the tool, run the tests, and run findbugs 0N/A<
project name="langtools" default="build" basedir="..">
578N/A **** Global property definitions. 272N/A property is set. This must be BEFORE the include of 0N/A <!-- The following locations can be used to override default property values. --> 0N/A <!-- Use this location for customizations specific to this instance of this workspace --> 0N/A <!-- Use this location for customizations common to all OpenJDK langtools workspaces --> 0N/A <!-- Use this location for customizations common to all OpenJDK workspaces --> 370N/A <!-- Convenient shorthands for standard locations within the workspace. --> 0N/A <!-- java.marker is set to a marker file to check for within a Java install dir. 0N/A executables; regrettably, that is OS-specific. --> 0N/A <!-- Standard property values, if not overriden by earlier settings. --> 370N/A the tools' jar files. If it has not already been set, then 370N/A quietly default to simply use "java". --> 440N/A <!-- Logic for handling access import jdk classes, if available. 440N/A Based on the value, if any, set up default values for javac's sourcepath, 449N/A classpath and bootclasspath. Note: the default values are overridden 440N/A in the build-bootstrap-classes macro. --> 440N/A ignoresystemclasses="true" 578N/A <!-- Set the default bootclasspath option used for javac. 578N/A Note that different variants of the option are used, meaning we can't just 578N/A define the value for the option. 578N/A This is because Ant is not clever enough to handle direct use of : or ; --> 578N/A ignoresystemclasses="true" 578N/A <!-- Set the default value of the sourcepath used for javac. --> 578N/A <!-- Set the default value of the classpath used for javac. --> 578N/A **** General top level targets. 0N/A <!-- Standard target to build deliverables for JDK build. --> 0N/A <
target name="build" depends="build-bootstrap-tools,build-all-classes">
440N/A <
target name="build-bootstrap-tools" 440N/A depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah" 440N/A <
target name="build-all-tools" 440N/A depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt" 440N/A <
target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
0N/A <
target name="clean" description="Delete all generated files">
0N/A <!-- Additional targets for running tools on the build --> 370N/A <
target name="jtreg" depends="build-all-tools,-def-jtreg">
0N/A <
target name="findbugs" depends="-def-findbugs,build-all-tools">
0N/A <
exec executable="sh">
0N/A <
arg value="-longBugCodes"/>
0N/A <
target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
0N/A <
target name="instrument-classes" depends="-def-cobertura">
0N/A <!-- only define the following property when we want coverage info --> 0N/A includes="**/*.class" excludes="**/resources/*.class"/>
0N/A </
cobertura-
instrument>
0N/A <
target name="coverage-report" depends="-def-cobertura">
609N/A <
target name="diags-examples" depends="build-javac">
609N/A <!-- can override the following on the command line if desired. --> 609N/A classname="RunExamples">
609N/A <
arg value="-examples"/>
609N/A <
arg value="examples"/>
609N/A <
arg value="-showFiles"/>
609N/A <
arg value="Examples of javac diagnostics"/>
824N/A <!-- a patching facility to speed up incorporating the langtools' classfiles 824N/A patching the jdk used for jtreg and other tests. 824N/A <
target name="patch" depends="build-all-classes">
578N/A <!-- standard JDK target --> 578N/A description="display settings of configuration values">
578N/A <
target name="post-sanity" depends="-def-jtreg,sanity,build" 578N/A description="perform basic validation after a standard build">
578N/A <!-- use vizant tool to generate graphical image of this Ant file.--> 578N/A <
target name="vizant" depends="-def-vizant">
578N/A <
exec executable="${dot}" >
578N/A <
target name="diagnostics">
435N/A <
target name="build-bootstrap-javac" 435N/A depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
435N/A <
build-
bootstrap-
tool name="javac"/>
440N/A <
target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
435N/A <
target name="build-javac" depends="build-classes-javac">
435N/A <
build-
tool name="javac"/>
0N/A <
target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
435N/A <
target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
0N/A <
target name="findbugs-javac" depends="build-javac,-def-findbugs">
0N/A <
findbugs-
tool name="javac"/>
0N/A <
target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
0N/A <
target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
435N/A <
build-
bootstrap-
tool name="javadoc"/>
0N/A <
target name="build-classes-javadoc" depends="build-classes-javac">
435N/A <
target name="build-javadoc" depends="build-javac,build-classes-javadoc">
435N/A <
build-
tool name="javadoc"/>
0N/A <
target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
0N/A <
target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
0N/A <
target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
0N/A <
findbugs-
tool name="javadoc"/>
0N/A <
target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
0N/A <
target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
0N/A <
target name="build-classes-doclets" depends="build-classes-javadoc">
435N/A <
target name="build-doclets" depends="build-javadoc,build-classes-doclets">
0N/A <!-- just jar, no bin for doclets --> 0N/A <!-- (no javadoc for doclets) --> 0N/A <
target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
0N/A <
target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
0N/A <
findbugs-
tool name="doclets"/>
0N/A <
target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
0N/A <
target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
435N/A <
build-
bootstrap-
tool name="javah"/>
435N/A <
target name="build-javah" depends="build-javac,build-classes-javah">
435N/A <
build-
tool name="javah"/>
0N/A <
target name="build-classes-javah" depends="build-classes-javadoc">
0N/A <!-- (no javadoc for javah) --> 0N/A <
target name="jtreg-javah" depends="build-javah,-def-jtreg">
0N/A <
target name="findbugs-javah" depends="build-javah,-def-findbugs">
0N/A <
findbugs-
tool name="javah"/>
0N/A <
target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
435N/A <
target name="build-bootstrap-javap" 435N/A depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
435N/A <
build-
bootstrap-
tool name="javap"/>
45N/A <
target name="build-classes-javap" depends="build-classes-javac">
435N/A <
target name="build-javap" depends="build-javac,build-classes-javap">
435N/A <
build-
tool name="javap"/>
0N/A <!-- (no javadoc for javap) --> 0N/A <
target name="jtreg-javap" depends="build-javap,-def-jtreg">
0N/A <
target name="findbugs-javap" depends="build-javap,-def-findbugs">
0N/A <
findbugs-
tool name="javap"/>
0N/A <
target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
0N/A <
target name="build-bootstrap-apt" depends="build-bootstrap-javac">
435N/A <
build-
bootstrap-
tool name="apt"/>
435N/A <
target name="build-apt" depends="build-javac,build-classes-apt">
435N/A <
build-
tool name="apt"/>
0N/A <
target name="build-classes-apt" depends="build-classes-javac">
0N/A <
target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
0N/A <
target name="jtreg-apt" depends="build-apt,-def-jtreg">
0N/A <
target name="findbugs-apt" depends="build-apt,-def-findbugs">
0N/A <
findbugs-
tool name="apt"/>
0N/A <
target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
578N/A **** Create import JDK stubs. 578N/A **** "-check-*" targets check that a required property is set, and set to a reasonable value. 578N/A **** A user friendly message is generated if not, and the build exits. 577N/A <
target name="-check-vizant" depends="-def-check">
577N/A <
check name="dot" property="dot"/>
578N/A **** Targets for Ant macro and task definitions. 435N/A <
target name="-def-build-tool">
0N/A <
macrodef name="build-tool">
0N/A <
attribute name="name"/>
0N/A <
filterset begintoken="#" endtoken="#">
370N/A <
filter token="PROGRAM" value="@{name}"/>
370N/A <
filter token="TARGET_JAVA" value="@{java}"/>
435N/A <
target name="-def-build-jar">
0N/A <
macrodef name="build-jar">
0N/A <
attribute name="name"/>
0N/A <
attribute name="includes"/>
0N/A <
attribute name="jarclasspath" default=""/>
0N/A includes="@{includes}">
0N/A <
attribute name="Main-Class" value="@{jarmainclass}"/>
0N/A <
attribute name="Class-Path" value="@{jarclasspath}"/>
0N/A <
target name="-def-build-classes" depends="-def-pcompile">
0N/A <
macrodef name="build-classes">
0N/A <
attribute name="includes"/>
0N/A <
attribute name="release" default="${release}"/>
440N/A <
echo level="verbose" message="build-classes: excludes=@{excludes}"/>
440N/A <
echo level="verbose" message="build-classes: classpath=@{classpath}"/>
440N/A <
echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
0N/A includes="@{includes}"/>
0N/A <
globmapper from="*.properties-template" to="*.properties"/>
0N/A <
filterset begintoken="$(" endtoken=")">
0N/A <
filter token="RELEASE" value="@{release}"/>
0N/A includes="**/*.properties"/>
0N/A includes="@{includes}" 0N/A excludes="@{excludes}" 440N/A sourcepath="@{sourcepath}" 440N/A classpath="@{classpath}" 0N/A includeAntRuntime="no" 440N/A <
compilerarg value="-implicit:none"/>
440N/A <
compilerarg value="-Xprefer:source"/>
0N/A <
exclude name="**/*.java"/>
0N/A <
exclude name="**/*.properties"/>
0N/A <
exclude name="**/*-template"/>
944N/A <
exclude name="**/*.rej"/>
944N/A <
exclude name="**/*.orig"/>
0N/A <
presetdef name="build-bootstrap-tool">
0N/A <
target name="-def-build-bootstrap-jar" depends="-def-build-jar">
0N/A <
presetdef name="build-bootstrap-jar">
435N/A <
target name="-def-build-bootstrap-classes" depends="-def-build-classes">
435N/A <
presetdef name="build-bootstrap-classes">
0N/A <
target name="-def-pcompile">
679N/A includeantruntime="false"/>
0N/A <
taskdef name="pcompile" 370N/A classname="CompilePropertiesTask" 872N/A includeantruntime="false">
440N/A <
taskdef name="genstubs" 440N/A classname="GenStubs$$Ant" 0N/A <
macrodef name="javadoc-tool">
0N/A <
attribute name="name"/>
0N/A <
attribute name="includes"/>
0N/A <
attribute name="options" default=""/>
0N/A <
attribute name="source" default="1.5"/>
<!-- FIXME --> 0N/A <
property name="javadoc.options" value=""/>
<!-- default, can be overridden per user or per project --> 0N/A <!-- Note: even with this default value, includes 370N/A windowtitle="UNOFFICIAL" 0N/A <
header><
![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></
header>
0N/A <
arg line="@{options}"/>
0N/A <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> --> 0N/A <!-- (It correctly skips excluded single classes, but not if packageset is also included, --> 0N/A <!-- which also causes duplicates in the class index for included files.) --> 0N/A <
filename name="java/"/>
0N/A <
filename name="javax/"/>
0N/A <
macrodef name="jtreg-tool">
0N/A <
attribute name="name"/>
0N/A <
attribute name="tests"/>
370N/A <
attribute name="samevm" default="true"/>
0N/A <
attribute name="keywords" default="-keywords:!ignore"/>
0N/A samevm="@{samevm}" verbose="@{verbose}" 0N/A failonerror="false" resultproperty="jtreg.@{name}.result" 0N/A <
arg line="@{keywords}"/>
0N/A <
arg line="@{options}"/>
0N/A <
arg line="@{tests}"/>
370N/A <!-- the next two properties are for convenience, when only 0N/A a single instance of jtreg will be invoked. --> 200N/A <
equals arg1="${jtreg.@{name}.result}" arg2="0"/>
0N/A <
include name="lib/**/*.jar"/>
0N/A <
macrodef name="findbugs-tool">
0N/A <
attribute name="name"/>
0N/A <
attribute name="output" default="emacs"/>
0N/A <
attribute name="outputFile" default=""/>
0N/A <
attribute name="reportLevel" default="high"/>
0N/A outputFile="@{outputFile}" 0N/A reportLevel="@{reportLevel}" 0N/A errorProperty="findbugs.@{name}.errors" 0N/A warningsProperty="findbugs.@{name}.warnings" 0N/A jvmargs="-Xmx512M" >
0N/A <
target name="-def-check">
0N/A <
macrodef name="check">
0N/A <
attribute name="name"/>
0N/A <
attribute name="property"/>
577N/A <
attribute name="marker" default=""/>
0N/A <
fail message="Cannot locate @{name}: please set @{property} to its location">
0N/A <
isset property="@{property}"/>
0N/A <
fail message="@{name} is not installed in ${@{property}}">
578N/A <
equals arg1="@{marker}" arg2=""/>
577N/A <
available file="${@{property}}/@{marker}"/>