Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/make/build.xml
32278 views
<?xml version="1.0" encoding="UTF-8"?>1<!--2Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.3DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.45This code is free software; you can redistribute it and/or modify it6under the terms of the GNU General Public License version 2 only, as7published by the Free Software Foundation. Oracle designates this8particular file as subject to the "Classpath" exception as provided9by Oracle in the LICENSE file that accompanied this code.1011This code is distributed in the hope that it will be useful, but WITHOUT12ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14version 2 for more details (a copy is included in the LICENSE file that15accompanied this code).1617You should have received a copy of the GNU General Public License version182 along with this work; if not, write to the Free Software Foundation,19Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.2021Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA22or visit www.oracle.com if you need additional information or have any23questions.24-->2526<!--27This is the main build file for the complete langtools repository.28It is used when building JDK (in which case it is invoked from the29Makefile), and it can be used when working on the tools themselves,30in an IDE such as NetBeans.3132External dependencies are specified via properties. These can be given33on the command line, or by providing a local build.properties file.34(They can also be edited into make/build.properties, although that is not35recommended.) At a minimum, boot.java.home must be set to the installed36location of the version of JDK used to build this repository. Additional37properties may be required, depending on the targets that are built.38For example, to run any of the jtreg tests you must set jtreg.home,39to run findbugs on the code you must set findbugs.home, and so on.4041For the most part, javac can be built using the previous version of JDK.42However, a small number of javac files require access to the latest JDK,43which may not yet have been compiled. To compile these files, you can do44one of the following:45- Set boot.java.home to a recent build of the latest version of JDK.46- Set import.jdk to either a recent build (containing jre/lib/rt.jar)47or to jdk source repository. In the latter case, stub files will48automatically be generated and used for the required API, to avoid49unnecessary compilation of the source repository.50If you do neither, the relevant files will not be built.5152The main build happens in two phases:53- First, javac and other tools as needed are built using ${boot.java.home}.54(This implies a constraint on the source code that they can be compiled55with the previous version of JDK.56- Second, all required classes are compiled with the latest javac, created57in the previous step.58The first phase is called the bootstrap phase. All targets, properties and59tasks that are specific to that phase have "bootstrap" in their name.6061For more details on the JDK build, see62http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build63http://openjdk.java.net/groups/build/64For more details on the stub generator, see65http://blogs.sun.com/jjg/entry/building_javac_for_jdk76667Internal details ...6869Interim build products are created in the build/ directory.70Final build products are created in the dist/ directory.71When building JDK, the dist/directory will contain:72- A bootstrap compiler suitable for running with ${boot.java.home}73suitable for compiling downstream parts of JDK74- Source files and class files for inclusion in the JDK being built75When building standalone, the dist/directory will contain:76- Separate jar files for each of the separate langtools components77- Simple scripts to invoke the tools by executing the corresponding78jar files.79These jar files and scripts are "for developer use only".8081This file is organized into sections as follows:82- global property definitions83- general top level targets84- general diagnostic/debugging targets85- groups of targets for each tool: javac, javadoc, doclets, javah, javap86Within each group, the following targets are provided, where applicable87build-bootstrap-TOOL build the bootstrap version of the tool88build-classes-TOOL build the classes for the tool89build-TOOL build the jar file and script for the tool90jtreg-TOOL build the tool and run the appropriate tests91findbugs-TOOL run findbugs on the tool's source code92TOOL build the tool, run the tests, and run findbugs93- utility definitions94-->9596<project name="langtools" default="build" basedir="..">97<!--98**** Global property definitions.99-->100101<!-- Force full debuginfo for javac if the debug.classfiles102property is set. This must be BEFORE the include of103build.properties because it sets javac.debuglevel. -->104<condition property="javac.debuglevel" value="source,lines,vars">105<equals arg1="${debug.classfiles}" arg2="true"/>106</condition>107108<!-- The following locations can be used to override default property values. -->109110<!-- Use this location for customizations specific to this instance of this workspace -->111<property file="build.properties"/>112113<!-- Use this location for customizations common to all OpenJDK langtools workspaces -->114<property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>115116<!-- Use this location for customizations common to all OpenJDK workspaces -->117<property file="${user.home}/.openjdk/build.properties"/>118119<!-- Convenient shorthands for standard locations within the workspace. -->120<property name="build.dir" location="build"/>121<property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>122<property name="build.coverage.dir" location="${build.dir}/coverage"/>123<property name="build.classes.dir" location="${build.dir}/classes"/>124<property name="build.gensrc.dir" location="${build.dir}/gensrc"/>125<property name="build.genstubs.dir" location="${build.dir}/genstubs"/>126<property name="build.javadoc.dir" location="${build.dir}/javadoc"/>127<property name="build.jtreg.dir" location="${build.dir}/jtreg"/>128<property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>129<property name="dist.dir" location="dist"/>130<property name="dist.bin.dir" location="${dist.dir}/bin"/>131<property name="dist.coverage.dir" location="${dist.dir}/coverage"/>132<property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>133<property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/>134<property name="dist.lib.dir" location="${dist.dir}/lib"/>135<property name="make.dir" location="make"/>136<property name="make.conf.dir" location="${make.dir}/conf"/>137<property name="make.tools.dir" location="${make.dir}/tools"/>138<property name="src.dir" location="src"/>139<property name="src.bin.dir" location="${src.dir}/share/bin"/>140<property name="src.classes.dir" location="${src.dir}/share/classes"/>141<property name="test.dir" location="test"/>142143<!-- java.marker is set to a marker file to check for within a Java install dir.144The best file to check for across Solaris/Linux/Windows/MacOS is one of the145executables; regrettably, that is OS-specific. -->146<condition property="java.marker" value="bin/java">147<os family="unix"/>148</condition>149<condition property="java.marker" value="bin/java.exe">150<os family="windows"/>151</condition>152153<!-- Standard property values, if not overriden by earlier settings. -->154<property file="${make.dir}/build.properties"/>155156<!-- launcher.java is used in the launcher scripts provided to run157the tools' jar files. If it has not already been set, then158default it to use ${target.java.home}, if available, otherwise159quietly default to simply use "java". -->160<condition property="launcher.java"161value="${target.java.home}/bin/java" else="java">162<isset property="target.java.home"/>163</condition>164165<!-- Logic for handling access import jdk classes, if available.166import.jdk should be unset, or set to jdk home (to use rt.jar)167or to jdk repo (to use src/share/classes).168Based on the value, if any, set up default values for javac's sourcepath,169classpath and bootclasspath. Note: the default values are overridden170in the build-bootstrap-classes macro. -->171172<available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"173filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>174<available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"175ignoresystemclasses="true"176classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>177178<!-- Set the default bootclasspath option used for javac.179Note that different variants of the option are used, meaning we can't just180define the value for the option.181Note the explicit use of the standard property ${path.separator} in the following.182This is because Ant is not clever enough to handle direct use of : or ; -->183<condition property="javac.bootclasspath.opt"184value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"185else="-Xbootclasspath/p:${build.classes.dir}">186<isset property="import.jdk.jar"/>187</condition>188189<condition property="boot.java.provides.latest.jdk">190<available191ignoresystemclasses="true"192classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>193</condition>194195<condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">196<isset property="boot.java.provides.latest.jdk"/>197</condition>198199<condition property="exclude.files" value="" else="${require.latest.jdk.files}">200<or>201<isset property="boot.java.provides.latest.jdk"/>202<isset property="import.jdk"/>203</or>204</condition>205206<condition property="require.import.jdk.stubs">207<and>208<not>209<isset property="boot.java.provides.latest.jdk"/>210</not>211<isset property="import.jdk.src.dir"/>212</and>213</condition>214215<!-- Set the default value of the sourcepath used for javac. -->216<condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">217<isset property="require.import.jdk.stubs"/>218</condition>219220<!-- Set the default value of the classpath used for javac. -->221<property name="javac.classpath" value=""/>222223224<!--225**** General top level targets.226-->227228<!-- Standard target to build deliverables for JDK build. -->229230<target name="build" depends="build-bootstrap-tools,build-all-classes">231<copy todir="${dist.dir}/bootstrap">232<fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>233</copy>234<chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">235<include name="*"/>236</chmod>237<mkdir dir="${dist.lib.dir}"/>238<jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>239<zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>240</target>241242<target name="build-bootstrap-tools"243depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah,build-bootstrap-sjavac"244/>245246<target name="build-all-tools"247depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-sjavac"248/>249250<target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">251<build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>252</target>253254<!-- clean -->255256<target name="clean" description="Delete all generated files">257<delete dir="${build.dir}"/>258<delete dir="${dist.dir}"/>259</target>260261<!-- Additional targets for running tools on the build -->262263<target name="jtreg" depends="build-all-tools,-def-jtreg">264<jtreg-tool name="all" tests="${jtreg.tests}"/>265</target>266267<target name="checkstyle" depends="-def-checkstyle"268description="Generates reports for code convention violations.">269<mkdir dir="${dist.checkstyle.dir}"/>270<checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"271failureProperty="checkstyle.failure"272failOnViolation="false">273<formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/>274<fileset dir="src" includes="**/*.java, **/*.properties"/>275</checkstyle>276<!-- transform the output to a simple html -->277<xslt in="${dist.checkstyle.dir}/checkstyle_report.xml"278out="${dist.checkstyle.dir}/checkstyle_report.html"279style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>280<!-- transform the output to a very simple emacs friendly text file -->281<xslt in="${dist.checkstyle.dir}/checkstyle_report.xml"282out="${dist.checkstyle.dir}/checkstyle_report.tmp"283style="${make.conf.dir}/checkstyle-emacs.xsl"/>284<!-- beautify remove extra lines -->285<move file="${dist.checkstyle.dir}/checkstyle_report.tmp"286toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt">287<filterchain>288<ignoreblank/>289<replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/>290</filterchain>291</move>292</target>293<!-- target can be invoked from an ide, the output of which can be used294to access and fix the errors directly.295-->296<target name="checkstyle-ide" depends="checkstyle">297<concat>298<fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/>299</concat>300</target>301302<target name="findbugs" depends="-def-findbugs,build-all-tools">303<property name="findbugs.reportLevel" value="medium"/>304<mkdir dir="${dist.findbugs.dir}"/>305<findbugs306home="${findbugs.home}"307projectName="JDK langtools ${full.version}"308output="xml"309outputFile="${dist.findbugs.dir}/findbugs.xml"310reportLevel="${findbugs.reportLevel}"311failOnError="false"312errorProperty="findbugs.all.errors"313warningsProperty="findbugs.all.warnings"314jvm="${target.java.home}/bin/java"315jvmargs="-Xmx512M">316<class location="${build.classes.dir}"/>317<sourcePath>318<pathelement location="${src.classes.dir}"/>319</sourcePath>320</findbugs>321<exec executable="sh">322<arg value="${findbugs.home}/bin/convertXmlToText"/>323<arg value="-longBugCodes"/>324<arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>325<arg value="${dist.findbugs.dir}/findbugs.xml"/>326<redirector output="${dist.findbugs.dir}/findbugs.html"/>327</exec>328</target>329330<target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>331332<target name="instrument-classes" depends="-def-cobertura">333<!-- only define the following property when we want coverage info -->334<path id="coverage.classpath">335<pathelement location="${build.coverage.dir}/classes"/>336<path refid="cobertura.classpath"/>337</path>338<property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>339<property name="coverage.classpath" refid="coverage.classpath"/>340<mkdir dir="${build.coverage.dir}/classes"/>341<delete file="${build.coverage.dir}/cobertura.ser"/>342<cobertura-instrument todir="${build.coverage.dir}/classes"343datafile="${build.coverage.dir}/cobertura.ser">344<fileset dir="${build.classes.dir}"345includes="**/*.class" excludes="**/resources/*.class"/>346</cobertura-instrument>347</target>348349<target name="coverage-report" depends="-def-cobertura">350<mkdir dir="${dist.coverage.dir}"/>351<cobertura-report352srcdir="${src.classes.dir}"353destdir="${dist.coverage.dir}"354datafile="${build.coverage.dir}/cobertura.ser"/>355<cobertura-report356format="xml"357srcdir="${src.classes.dir}"358destdir="${dist.coverage.dir}"359datafile="${build.coverage.dir}/cobertura.ser"/>360</target>361362<target name="diags-examples" depends="build-javac,build-javap">363<!-- can override the following on the command line if desired. -->364<property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>365<mkdir dir="${build.dir}/diag-examples/classes"/>366<javac fork="true"367executable="${dist.bin.dir}/javac"368srcdir="test/tools/javac/diags"369destdir="${build.dir}/diag-examples/classes"370includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"371sourcepath=""372classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"373includeAntRuntime="no"374debug="${javac.debug}"375debuglevel="${javac.debuglevel}">376<compilerarg line="${javac.lint.opts}"/>377</javac>378<java fork="true"379jvm="${target.java.home}/bin/java"380dir="test/tools/javac/diags"381classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"382classname="RunExamples">383<jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>384<arg value="-examples"/>385<arg value="examples"/>386<arg value="-o"/>387<arg file="${diags.examples.out}"/>388<arg value="-showFiles"/>389<arg value="-title"/>390<arg value="Examples of javac diagnostics"/>391</java>392</target>393394<!-- a patching facility to speed up incorporating the langtools' classfiles395into a jdk of your choice. Either target.java.home or patch.jdk can be396set on the command line; setting target.java.home has the advantage of397patching the jdk used for jtreg and other tests.398-->399<target name="patch" depends="build-all-classes">400<condition property="patch.jdk" value="${target.java.home}">401<available file="${target.java.home}" type="dir"/>402</condition>403<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">404<condition>405<not>406<isset property="patch.jdk"/>407</not>408</condition>409</fail>410<property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>411<property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>412<fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">413<condition>414<not>415<available file="${patch.tools.jar}" type="file"/>416</not>417</condition>418</fail>419<fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">420<condition>421<not>422<available file="${patch.rt.jar}" type="file"/>423</not>424</condition>425</fail>426<zip zipfile="${patch.tools.jar}" update="true">427<zipfileset dir="${build.classes.dir}" includes="com/**"/>428</zip>429<zip zipfile="${patch.rt.jar}" update="true">430<zipfileset dir="${build.classes.dir}" includes="javax/**"/>431</zip>432</target>433434<target name="doclint-api" depends="build-all-classes">435<delete dir="${build.dir}/doclint/classes"/>436<mkdir dir="${build.dir}/doclint/classes"/>437<javac fork="true"438executable="${boot.javac}"439srcdir="${src.classes.dir}:${build.gensrc.dir}"440destdir="${build.dir}/doclint/classes"441includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**"442excludes=""443sourcepath="${javac.sourcepath}"444classpath="${javac.classpath}"445includeAntRuntime="no"446source="${javac.source}"447target="${javac.target}"448debug="${javac.debug}"449debuglevel="${javac.debuglevel}">450<compilerarg value="-implicit:none"/>451<compilerarg value="-Xprefer:source"/>452<compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>453<compilerarg line="${javac.no.jdk.warnings}"/>454<compilerarg line="${javac.version.opt}"/>455<compilerarg line="-Xdoclint:all/protected,-missing"/>456</javac>457</target>458459<!--460**** Debugging/diagnostic targets.461-->462463<!-- standard JDK target -->464<target name="sanity"465description="display settings of configuration values">466<echo level="info">ant.home = ${ant.home}</echo>467<echo level="info">boot.java.home = ${boot.java.home}</echo>468<echo level="info">target.java.home = ${target.java.home}</echo>469<echo level="info">jtreg.home = ${jtreg.home}</echo>470<echo level="info">findbugs.home = ${findbugs.home}</echo>471<echo level="info">checkstyle.home = ${checkstyle.home}</echo>472</target>473474<target name="post-sanity" depends="-def-jtreg,sanity,build"475description="perform basic validation after a standard build">476<jtreg477dir="make/test"478workDir="${build.jtreg.dir}/post-sanity/work"479reportDir="${build.jtreg.dir}/post-sanity/report"480jdk="${target.java.home}"481verbose="summary"482failonerror="false" resultproperty="jtreg.post-sanity.result">483</jtreg>484</target>485486<!-- use vizant tool to generate graphical image of this Ant file.-->487<target name="vizant" depends="-def-vizant">488<mkdir dir="${build.dir}"/>489<echo message="Generating ${build.dir}/build.dot"/>490<vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>491<echo message="Generating ${build.dir}/build.png"/>492<exec executable="${dot}" >493<arg value="-Tpng"/>494<arg value="-o"/>495<arg file="${build.dir}/build.png"/>496<arg file="${build.dir}/build.dot"/>497</exec>498</target>499500<target name="check-import.jdk">501<echo message="import.jdk: ${import.jdk}"/>502<echo message="import.jdk.jar: ${import.jdk.jar}"/>503<echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>504</target>505506<target name="diagnostics">507<diagnostics/>508</target>509510511<!--512**** javac targets.513-->514515<target name="build-bootstrap-javac"516depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">517<build-bootstrap-classes includes="${javac.includes}"/>518<build-bootstrap-jar name="javac" includes="${javac.includes}"/>519<build-bootstrap-tool name="javac"/>520</target>521522<target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">523<build-classes includes="${javac.includes}"/>524</target>525526<target name="build-javac" depends="build-classes-javac">527<build-jar name="javac" includes="${javac.includes}"/>528<build-tool name="javac"/>529</target>530531<target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">532<javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls.option}"/>533</target>534535<target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">536<jtreg-tool name="javac" tests="${javac.tests}"/>537</target>538539<target name="findbugs-javac" depends="build-javac,-def-findbugs">540<findbugs-tool name="javac"/>541</target>542543<target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>544545546<!--547**** javadoc targets.548-->549550<target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">551<build-bootstrap-classes includes="${javadoc.includes}"/>552<build-bootstrap-jar name="javadoc" includes="${javadoc.includes}"553jarclasspath="javac.jar doclets.jar"/>554<build-bootstrap-tool name="javadoc"/>555</target>556557<target name="build-classes-javadoc" depends="build-classes-javac">558<build-classes includes="${javadoc.includes}"/>559</target>560561<target name="build-javadoc" depends="build-javac,build-classes-javadoc">562<build-jar name="javadoc" includes="${javadoc.includes}"563jarclasspath="javac.jar doclets.jar"/>564<build-tool name="javadoc"/>565</target>566567<target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">568<javadoc-tool name="javadoc" includes="${javadoc.includes}"/>569</target>570571<target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">572<jtreg-tool name="javadoc" tests="${javadoc.tests}"/>573</target>574575<target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">576<findbugs-tool name="javadoc"/>577</target>578579<target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>580581582<!--583**** doclets targets.584-->585586<target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">587<build-bootstrap-classes includes="${doclets.includes}"/>588<build-bootstrap-jar name="doclets" includes="${doclets.includes}"589jarmainclass="com.sun.tools.javadoc.Main"590jarclasspath="javadoc.jar"/>591</target>592593<target name="build-classes-doclets" depends="build-classes-javadoc">594<build-classes includes="${doclets.includes}"/>595</target>596597<target name="build-doclets" depends="build-javadoc,build-classes-doclets">598<!-- just jar, no bin for doclets -->599<build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>600</target>601602<!-- (no javadoc for doclets) -->603604<target name="jtreg-doclets" depends="build-doclets,-def-jtreg">605<jtreg-tool name="doclets" tests="${doclets.tests}"/>606</target>607608<target name="findbugs-doclets" depends="build-doclets,-def-findbugs">609<findbugs-tool name="doclets"/>610</target>611612<target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>613614615<!--616**** javah targets.617-->618619<target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">620<build-bootstrap-classes includes="${javah.includes}"/>621<build-bootstrap-jar name="javah" includes="${javah.includes}"622jarclasspath="javadoc.jar doclets.jar javac.jar"/>623<build-bootstrap-tool name="javah"/>624</target>625626<target name="build-javah" depends="build-javac,build-classes-javah">627<build-jar name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>628<build-tool name="javah"/>629</target>630631<target name="build-classes-javah" depends="build-classes-javadoc">632<build-classes includes="${javah.includes}"/>633</target>634635<!-- (no javadoc for javah) -->636637<target name="jtreg-javah" depends="build-javah,-def-jtreg">638<jtreg-tool name="javah" tests="${javah.tests}"/>639</target>640641<target name="findbugs-javah" depends="build-javah,-def-findbugs">642<findbugs-tool name="javah"/>643</target>644645<target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>646647648<!--649**** javap targets.650-->651652<target name="build-bootstrap-javap"653depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">654<build-bootstrap-classes includes="${javap.includes}"/>655<build-bootstrap-jar name="javap" includes="${javap.includes}"656jarmainclass="sun.tools.javap.Main"/>657<build-bootstrap-tool name="javap"/>658</target>659660<target name="build-classes-javap" depends="build-classes-javac">661<build-classes includes="${javap.includes}"/>662</target>663664<target name="build-javap" depends="build-javac,build-classes-javap">665<build-jar name="javap" includes="${javap.includes}"666jarmainclass="com.sun.tools.javap.Main"667jarclasspath="javac.jar"/>668<build-tool name="javap"/>669</target>670671<!-- (no javadoc for javap) -->672673<target name="jtreg-javap" depends="build-javap,-def-jtreg">674<jtreg-tool name="javap" tests="${javap.tests}"/>675</target>676677<target name="findbugs-javap" depends="build-javap,-def-findbugs">678<findbugs-tool name="javap"/>679</target>680681<target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>682683<!--684**** sjavac targets.685-->686687<target name="build-bootstrap-sjavac"688depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">689<build-bootstrap-classes includes="${sjavac.includes}"/>690<build-bootstrap-jar name="sjavac" includes="${sjavac.includes}"691jarmainclass="com.sun.tools.sjavac.Main"/>692<build-bootstrap-tool name="sjavac"/>693</target>694695<target name="build-classes-sjavac" depends="build-classes-javac">696<build-classes includes="${sjavac.includes}"/>697</target>698699<target name="build-sjavac" depends="build-classes-sjavac">700<build-jar name="sjavac" includes="${sjavac.includes}"701jarmainclass="com.sun.tools.sjavac.Main"702jarclasspath="sjavac.jar"/>703<build-tool name="sjavac"/>704</target>705706<!-- (no javadoc for javap) -->707708<target name="jtreg-sjavac" depends="build-sjavac,-def-jtreg">709<jtreg-tool name="sjavac" tests="${sjavac.tests}"/>710</target>711712<target name="findbugs-sjavac" depends="build-sjavac,-def-findbugs">713<findbugs-tool name="sjavac"/>714</target>715716<target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/>717718<!--719**** crules targets.720-->721722<target name="build-crules" depends="-def-compilecrules,-def-build-jar-with-services">723<compilecrules/>724<build-jar-with-services725name="crules"726includes="crules/* crules/resources/*"727classes.dir="${build.toolclasses.dir}"728lib.dir="${build.toolclasses.dir}"729jarmainclass=""730jarclasspath="crules.jar"731service.type="com.sun.source.util.Plugin"732service.provider="crules.MutableFieldsAnalyzer"/>733<build-tool name="crules"/>734</target>735736<target name="check-coding-rules" depends="build-bootstrap-javac,-create-import-jdk-stubs,build-crules">737<build-classes includes="${javac.includes}"738plugin.options="-J-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar -Xplugin:mutable_fields_analyzer" />739</target>740741<!--742**** Create import JDK stubs.743-->744745<target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">746<mkdir dir="${build.genstubs.dir}"/>747<genstubs748srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"749includes="${import.jdk.stub.files}"750fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"751/>752</target>753754755<!--756**** Check targets.757**** "-check-*" targets check that a required property is set, and set to a reasonable value.758**** A user friendly message is generated if not, and the build exits.759-->760761<target name="-check-boot.java.home" depends="-def-check">762<check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>763</target>764765<target name="-check-target.java.home" depends="-def-check">766<check name="target java" property="target.java.home" marker="${java.marker}"/>767</target>768769<target name="-check-cobertura.home" depends="-def-check">770<check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>771</target>772773<target name="-check-findbugs.home" depends="-def-check">774<check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>775</target>776777<target name="-check-checkstyle.home" depends="-def-check">778<check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>779</target>780781<target name="-check-jtreg.home" depends="-def-check">782<check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>783</target>784785<target name="-check-vizant" depends="-def-check">786<check name="vizant" property="vizant.jar"/>787<check name="dot" property="dot"/>788</target>789790791<!--792**** Targets for Ant macro and task definitions.793-->794795<target name="-def-build-tool">796<macrodef name="build-tool">797<attribute name="name"/>798<attribute name="bin.dir" default="${dist.bin.dir}"/>799<attribute name="java" default="${launcher.java}"/>800<sequential>801<mkdir dir="@{bin.dir}"/>802<copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">803<filterset begintoken="#" endtoken="#">804<filter token="PROGRAM" value="@{name}"/>805<filter token="TARGET_JAVA" value="@{java}"/>806<filter token="PS" value="${path.separator}"/>807</filterset>808</copy>809<chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>810</sequential>811</macrodef>812</target>813814<target name="-def-build-jar">815<macrodef name="build-jar">816<attribute name="name"/>817<attribute name="includes"/>818<attribute name="classes.dir" default="${build.classes.dir}"/>819<attribute name="lib.dir" default="${dist.lib.dir}"/>820<attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>821<attribute name="jarclasspath" default=""/>822<sequential>823<mkdir dir="@{lib.dir}"/>824<jar destfile="@{lib.dir}/@{name}.jar"825basedir="@{classes.dir}"826includes="@{includes}">827<manifest>828<attribute name="Main-Class" value="@{jarmainclass}"/>829<attribute name="Class-Path" value="@{jarclasspath}"/>830</manifest>831</jar>832</sequential>833</macrodef>834</target>835836<target name="-def-build-jar-with-services">837<macrodef name="build-jar-with-services">838<attribute name="name"/>839<attribute name="includes"/>840<attribute name="classes.dir" default="${build.classes.dir}"/>841<attribute name="lib.dir" default="${dist.lib.dir}"/>842<attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>843<attribute name="jarclasspath" default=""/>844<attribute name="service.type" default=""/>845<attribute name="service.provider" default=""/>846<sequential>847<mkdir dir="${build.toolclasses.dir}"/>848<jar destfile="@{lib.dir}/@{name}.jar"849basedir="@{classes.dir}"850includes="@{includes}">851<service type="@{service.type}" provider="@{service.provider}"/>852<manifest>853<attribute name="Main-Class" value="@{jarmainclass}"/>854<attribute name="Class-Path" value="@{jarclasspath}"/>855</manifest>856</jar>857</sequential>858</macrodef>859</target>860861<target name="-def-build-classes" depends="-def-pcompile">862<macrodef name="build-classes">863<attribute name="includes"/>864<attribute name="excludes" default="${exclude.files} **/package-info.java"/>865<attribute name="classes.dir" default="${build.classes.dir}"/>866<attribute name="gensrc.dir" default="${build.gensrc.dir}"/>867<attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>868<attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>869<attribute name="classpath" default="${javac.classpath}"/>870<attribute name="sourcepath" default="${javac.sourcepath}"/>871<attribute name="java.home" default="${boot.java.home}"/>872<attribute name="source" default="${javac.source}"/>873<attribute name="target" default="${javac.target}"/>874<attribute name="release" default="${release}"/>875<attribute name="full.version" default="${full.version}"/>876<attribute name="plugin.options" default=""/>877<sequential>878<echo level="verbose" message="build-classes: excludes=@{excludes}"/>879<echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>880<echo level="verbose" message="build-classes: classpath=@{classpath}"/>881<echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>882<mkdir dir="@{gensrc.dir}"/>883<mkdir dir="@{classes.dir}"/>884<pcompile srcdir="${src.classes.dir}"885destdir="@{gensrc.dir}"886includes="@{includes}"/>887<copy todir="@{gensrc.dir}">888<fileset dir="${src.classes.dir}" includes="@{includes}"/>889<globmapper from="*.properties-template" to="*.properties"/>890<filterset begintoken="$(" endtoken=")">891<filter token="JDK_VERSION" value="${jdk.version}"/>892<filter token="RELEASE" value="@{release}"/>893<filter token="FULL_VERSION" value="@{full.version}"/>894</filterset>895</copy>896<pcompile srcdir="@{gensrc.dir}"897destdir="@{gensrc.dir}"898includes="**/*.properties"/>899<javac fork="true"900executable="@{java.home}/bin/javac"901srcdir="${src.classes.dir}:@{gensrc.dir}"902destdir="@{classes.dir}"903includes="@{includes}"904excludes="@{excludes}"905sourcepath="@{sourcepath}"906classpath="@{classpath}"907includeAntRuntime="no"908source="@{source}"909target="@{target}"910debug="${javac.debug}"911debuglevel="${javac.debuglevel}">912<compilerarg value="-implicit:none"/>913<compilerarg value="-Xprefer:source"/>914<compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>915<compilerarg line="@{bootclasspath.opt}"/>916<compilerarg line="${javac.no.jdk.warnings}"/>917<compilerarg line="${javac.version.opt}"/>918<compilerarg line="${javac.lint.opts}"/>919<compilerarg line="@{plugin.options}"/>920</javac>921<copy todir="@{classes.dir}" includeemptydirs="false">922<fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">923<exclude name="**/*.java"/>924<exclude name="**/*.properties"/>925<exclude name="**/*-template"/>926<exclude name="**/*.rej"/>927<exclude name="**/*.orig"/>928<exclude name="**/overview.html"/>929<exclude name="**/package.html"/>930</fileset>931</copy>932</sequential>933</macrodef>934</target>935936<target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">937<presetdef name="build-bootstrap-tool">938<build-tool939bin.dir="${build.bootstrap.dir}/bin"940java="${boot.java}"/>941</presetdef>942</target>943944<target name="-def-build-bootstrap-jar" depends="-def-build-jar">945<presetdef name="build-bootstrap-jar">946<build-jar947classes.dir="${build.bootstrap.dir}/classes"948lib.dir="${build.bootstrap.dir}/lib"/>949</presetdef>950</target>951952<target name="-def-build-bootstrap-classes" depends="-def-build-classes">953<presetdef name="build-bootstrap-classes">954<build-classes955source="${boot.javac.source}"956target="${boot.javac.target}"957gensrc.dir="${build.bootstrap.dir}/gensrc"958classes.dir="${build.bootstrap.dir}/classes"959javac.bootclasspath=""960bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"961sourcepath=""962release="${bootstrap.release}"963full.version="${bootstrap.full.version}"964excludes="${bootstrap.exclude.files} **/package-info.java"/>965</presetdef>966</target>967968<target name="-def-pcompile">969<mkdir dir="${build.toolclasses.dir}"/>970<javac fork="true"971source="${boot.javac.source}"972target="${boot.javac.target}"973executable="${boot.java.home}/bin/javac"974srcdir="${make.tools.dir}"975includes="compileproperties/* anttasks/CompileProperties*"976destdir="${build.toolclasses.dir}/"977classpath="${ant.core.lib}"978bootclasspath="${boot.java.home}/jre/lib/rt.jar"979includeantruntime="false">980<compilerarg line="${javac.lint.opts}"/>981</javac>982<taskdef name="pcompile"983classname="anttasks.CompilePropertiesTask"984classpath="${build.toolclasses.dir}/"/>985</target>986987<target name="-def-compilecrules">988<macrodef name="compilecrules">989<sequential>990<mkdir dir="${build.toolclasses.dir}"/>991<javac fork="true"992source="${boot.javac.source}"993target="${boot.javac.target}"994executable="${boot.java.home}/bin/javac"995srcdir="${make.tools.dir}"996includes="crules/*"997destdir="${build.toolclasses.dir}/"998classpath="${ant.core.lib}"999bootclasspath="${boot.java.home}/jre/lib/rt.jar"1000includeantruntime="false">1001<compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>1002<compilerarg line="${javac.lint.opts}"/>1003</javac>1004<copy todir="${build.toolclasses.dir}/" includeemptydirs="false">1005<fileset dir="${make.tools.dir}">1006<include name="**/*.properties"/>1007</fileset>1008</copy>1009</sequential>1010</macrodef>1011</target>10121013<target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">1014<mkdir dir="${build.toolclasses.dir}"/>1015<javac fork="true"1016source="${boot.javac.source}"1017target="${boot.javac.target}"1018executable="${boot.java.home}/bin/javac"1019srcdir="${make.tools.dir}"1020includes="genstubs/* anttasks/GenStubs*"1021destdir="${build.toolclasses.dir}/"1022classpath="${ant.core.lib}"1023includeantruntime="false">1024<compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>1025<compilerarg line="${javac.lint.opts}"/>1026</javac>1027<taskdef name="genstubs"1028classname="anttasks.GenStubsTask"1029classpath="${build.toolclasses.dir}/"/>1030</target>10311032<target name="-def-javadoc-tool" depends="-check-target.java.home">1033<macrodef name="javadoc-tool">1034<attribute name="name"/>1035<attribute name="includes"/>1036<attribute name="options" default=""/>1037<attribute name="source" default="1.5"/> <!-- FIXME -->1038<sequential>1039<property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->1040<!-- Note: even with this default value, includes1041from src.classes.dir get javadoc'd; see packageset below -->1042<property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->1043<javadoc1044executable="${target.java.home}/bin/javadoc"1045destdir="${build.javadoc.dir}/@{name}"1046source="@{source}"1047windowtitle="UNOFFICIAL"1048failonerror="true"1049use="true"1050author="false"1051version="false"1052packagenames="${javadoc.packagenames}" >1053<header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>1054<arg line="@{options}"/>1055<bootclasspath>1056<path location="${build.classes.dir}"/>1057<path location="${target.java.home}/jre/lib/rt.jar"/>1058</bootclasspath>1059<sourcepath>1060<pathelement location="${src.classes.dir}"/>1061</sourcepath>1062<!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->1063<!-- means that {@link some.package} will not work, which is no good. -->1064<!-- (It correctly skips excluded single classes, but not if packageset is also included, -->1065<!-- which also causes duplicates in the class index for included files.) -->1066<packageset dir="${src.classes.dir}" includes="@{includes}">1067<or>1068<filename name="java/"/>1069<filename name="javax/"/>1070<filename name="com/sun/javadoc/"/>1071<filename name="com/sun/source/"/>1072</or>1073</packageset>1074</javadoc>1075</sequential>1076</macrodef>1077</target>10781079<target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">1080<taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">1081<classpath>1082<pathelement location="${jtreg.home}/lib/jtreg.jar"/>1083<pathelement location="${jtreg.home}/lib/javatest.jar"/>1084</classpath>1085</taskdef>1086<macrodef name="jtreg-tool">1087<attribute name="name"/>1088<attribute name="tests"/>1089<attribute name="jdk" default="${target.java.home}"/>1090<attribute name="samevm" default="true"/>1091<attribute name="verbose" default="${default.jtreg.verbose}"/>1092<attribute name="options" default="${other.jtreg.options}"/>1093<attribute name="keywords" default="-keywords:!ignore"/>1094<attribute name="jpda.jvmargs" default=""/>1095<sequential>1096<property name="coverage.options" value=""/> <!-- default -->1097<property name="coverage.classpath" value=""/> <!-- default -->1098<property name="default.jtreg.verbose" value="summary"/> <!-- default -->1099<property name="other.jtreg.options" value=""/> <!-- default -->1100<jtreg1101dir="${test.dir}"1102workDir="${build.jtreg.dir}/@{name}/work"1103reportDir="${build.jtreg.dir}/@{name}/report"1104jdk="@{jdk}"1105samevm="@{samevm}" verbose="@{verbose}"1106failonerror="false" resultproperty="jtreg.@{name}.result"1107javacoptions="-g"1108vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs}">1109<arg line="@{keywords}"/>1110<arg line="@{options}"/>1111<arg line="@{tests}"/>1112</jtreg>1113<!-- the next two properties are for convenience, when only1114a single instance of jtreg will be invoked. -->1115<condition property="jtreg.passed">1116<equals arg1="${jtreg.@{name}.result}" arg2="0"/>1117</condition>1118<property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>1119</sequential>1120</macrodef>1121<property name="jtreg.defined" value="true"/>1122</target>11231124<target name="-def-cobertura" depends="-check-cobertura.home">1125<path id="cobertura.classpath">1126<fileset dir="${cobertura.home}">1127<include name="cobertura.jar"/>1128<include name="lib/**/*.jar"/>1129</fileset>1130</path>1131<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>1132</target>11331134<target name="-def-checkstyle" unless="checkstyle.defined"1135depends="-check-checkstyle.home">1136<taskdef resource="checkstyletask.properties">1137<classpath>1138<pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>1139</classpath>1140</taskdef>1141<property name="checkstyle.defined" value="true"/>1142</target>11431144<target name="-def-findbugs" unless="findbugs.defined"1145depends="-check-findbugs.home,-check-target.java.home">1146<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">1147<classpath>1148<pathelement location="${findbugs.home}/lib/findbugs.jar"/>1149</classpath>1150</taskdef>1151<macrodef name="findbugs-tool">1152<attribute name="name"/>1153<attribute name="output" default="emacs"/>1154<attribute name="outputFile" default=""/>1155<attribute name="reportLevel" default="high"/>1156<sequential>1157<findbugs1158home="${findbugs.home}"1159output="@{output}"1160outputFile="@{outputFile}"1161reportLevel="@{reportLevel}"1162failOnError="false"1163errorProperty="findbugs.@{name}.errors"1164warningsProperty="findbugs.@{name}.warnings"1165jvm="${target.java.home}/bin/java"1166jvmargs="-Xmx512M" >1167<class location="${dist.dir}/lib/@{name}.jar"/>1168<auxClasspath>1169<pathelement location="${build.classes.dir}"/>1170</auxClasspath>1171<sourcePath>1172<pathelement location="${src.classes.dir}"/>1173</sourcePath>1174</findbugs>1175</sequential>1176</macrodef>1177<property name="findbugs.defined" value="true"/>1178</target>11791180<target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">1181<taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>1182<property name="vizant.defined" value="true"/>1183</target>11841185<target name="-def-check">1186<macrodef name="check">1187<attribute name="name"/>1188<attribute name="property"/>1189<attribute name="marker" default=""/>1190<sequential>1191<fail message="Cannot locate @{name}: please set @{property} to its location">1192<condition>1193<not>1194<isset property="@{property}"/>1195</not>1196</condition>1197</fail>1198<fail message="@{name} is not installed in ${@{property}}">1199<condition>1200<and>1201<not>1202<equals arg1="@{marker}" arg2=""/>1203</not>1204<not>1205<available file="${@{property}}/@{marker}"/>1206</not>1207</and>1208</condition>1209</fail>1210</sequential>1211</macrodef>1212</target>12131214</project>1215121612171218