make/build.xml

Thu, 02 Sep 2010 18:26:21 -0700

author
jjg
date
Thu, 02 Sep 2010 18:26:21 -0700
changeset 667
3ff3f20471b4
parent 656
6ef801fa38b7
child 680
80505c2026e7
permissions
-rw-r--r--

6921495: spurious semicolons in class def cause empty NOPOS blocks
Reviewed-by: mcimadamore

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3  Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
     4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6  This code is free software; you can redistribute it and/or modify it
     7  under the terms of the GNU General Public License version 2 only, as
     8  published by the Free Software Foundation.  Oracle designates this
     9  particular file as subject to the "Classpath" exception as provided
    10  by Oracle in the LICENSE file that accompanied this code.
    12  This code is distributed in the hope that it will be useful, but WITHOUT
    13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    14  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    15  version 2 for more details (a copy is included in the LICENSE file that
    16  accompanied this code).
    18  You should have received a copy of the GNU General Public License version
    19  2 along with this work; if not, write to the Free Software Foundation,
    20  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    22  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    23  or visit www.oracle.com if you need additional information or have any
    24  questions.
    25 -->
    27 <!--
    28  This is the main build file for the complete langtools repository.
    29  It is used when building JDK (in which case it is invoked from the
    30  Makefile), and it can be used when working on the tools themselves,
    31  in an IDE such as NetBeans.
    33  External dependencies are specified via properties. These can be given
    34  on the command line, or by providing a local build.properties file.
    35  (They can also be edited into make/build.properties, although that is not
    36  recommended.)  At a minimum, boot.java.home must be set to the installed
    37  location of the version of JDK used to build this repository. Additional
    38  properties may be required, depending on the targets that are built.
    39  For example, to run any of the jtreg tests you must set jtreg.home,
    40  to run findbugs on the code you must set findbugs.home, and so on.
    42  For the most part, javac can be built using the previous version of JDK.
    43  However, a small number of javac files require access to the latest JDK,
    44  which may not yet have been compiled. To compile these files, you can do
    45  one of the following:
    46  - Set boot.java.home to a recent build of the latest version of JDK.
    47  - Set import.jdk to either a recent build (containing jre/lib/rt.jar)
    48    or to jdk source repository.  In the latter case, stub files will
    49    automatically be generated and used for the required API, to avoid
    50    unnecessary compilation of the source repository.
    51  If you do neither, the relevant files will not be built.
    53  The main build happens in two phases:
    54  - First, javac and other tools as needed are built using ${boot.java.home}.
    55    (This implies a constraint on the source code that they can be compiled
    56    with the previous version of JDK.
    57  - Second, all required classes are compiled with the latest javac, created
    58    in the previous step.
    59  The first phase is called the bootstrap phase. All targets, properties and
    60  tasks that are specific to that phase have "bootstrap" in their name.
    62  For more details on the JDK build, see
    63     http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build
    64     http://openjdk.java.net/groups/build/
    65  For more details on the stub generator, see
    66     http://blogs.sun.com/jjg/entry/building_javac_for_jdk7
    68  Internal details ...
    70  Interim build products are created in the build/ directory.
    71  Final build products are created in the dist/ directory.
    72  When building JDK, the dist/directory will contain:
    73  - A bootstrap compiler suitable for running with ${boot.java.home}
    74    suitable for compiling downstream parts of JDK
    75  - Source files and class files for inclusion in the JDK being built
    76  When building standalone, the dist/directory will contain:
    77  - Separate jar files for each of the separate langtools components
    78  - Simple scripts to invoke the tools by executing the corresponding
    79    jar files.
    80  These jar files and scripts are "for developer use only".
    82  This file is organized into sections as follows:
    83  - global property definitions
    84  - general top level targets
    85  - general diagnostic/debugging targets
    86  - groups of targets for each tool: javac, javadoc, doclets, javah, javap, apt
    87     Within each group, the following targets are provided, where applicable
    88       build-bootstrap-TOOL      build the bootstrap version of the tool
    89       build-classes-TOOL        build the classes for the tool
    90       build-TOOL                build the jar file and script for the tool
    91       jtreg-TOOL                build the tool and run the appropriate tests
    92       findbugs-TOOL             run findbugs on the tool's source oode
    93       TOOL                      build the tool, run the tests, and run findbugs
    94  - utility definitions
    95  -->
    97 <project name="langtools" default="build" basedir="..">
    98     <!--
    99     **** Global property definitions.
   100     -->
   102     <!-- Force full debuginfo for javac if the debug.classfiles
   103     property is set.  This must be BEFORE the include of
   104     build.properties because it sets javac.debuglevel.  -->
   105     <condition property="javac.debuglevel" value="source,lines,vars">
   106         <equals arg1="${debug.classfiles}" arg2="true"/>
   107     </condition>
   109     <!-- The following locations can be used to override default property values. -->
   111     <!-- Use this location for customizations specific to this instance of this workspace -->
   112     <property file="build.properties"/>
   114     <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
   115     <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
   117     <!-- Use this location for customizations common to all OpenJDK workspaces -->
   118     <property file="${user.home}/.openjdk/build.properties"/>
   120     <!-- Convenient shorthands for standard locations within the workspace. -->
   121     <property name="build.dir" location="build"/>
   122     <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
   123     <property name="build.coverage.dir" location="${build.dir}/coverage"/>
   124     <property name="build.classes.dir" location="${build.dir}/classes"/>
   125     <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
   126     <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
   127     <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
   128     <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
   129     <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
   130     <property name="dist.dir" location="dist"/>
   131     <property name="dist.bin.dir" location="${dist.dir}/bin"/>
   132     <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
   133     <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
   134     <property name="dist.lib.dir" location="${dist.dir}/lib"/>
   135     <property name="make.dir" location="make"/>
   136     <property name="make.tools.dir" location="${make.dir}/tools"/>
   137     <property name="src.dir" location="src"/>
   138     <property name="src.bin.dir" location="${src.dir}/share/bin"/>
   139     <property name="src.classes.dir" location="${src.dir}/share/classes"/>
   140     <property name="test.dir" location="test"/>
   142     <!-- java.marker is set to a marker file to check for within a Java install dir.
   143          The best file to check for across Solaris/Linux/Windows/MacOS is one of the
   144          executables; regrettably, that is OS-specific. -->
   145     <condition property="java.marker" value="bin/java">
   146         <os family="unix"/>
   147     </condition>
   148     <condition property="java.marker" value="bin/java.exe">
   149         <os family="windows"/>
   150     </condition>
   152     <!-- Standard property values, if not overriden by earlier settings. -->
   153     <property file="${make.dir}/build.properties"/>
   155     <!-- launcher.java is used in the launcher scripts provided to run
   156         the tools' jar files.  If it has not already been set, then
   157         default it to use ${target.java.home}, if available, otherwise
   158         quietly default to simply use "java". -->
   159     <condition property="launcher.java"
   160         value="${target.java.home}/bin/java" else="java">
   161         <isset property="target.java.home"/>
   162     </condition>
   164     <!-- Logic for handling access import jdk classes, if available.
   165         import.jdk should be unset, or set to jdk home (to use rt.jar)
   166         or to jdk repo (to use src/share/classes).
   167         Based on the value, if any, set up default values for javac's sourcepath,
   168         classpath and bootclasspath. Note: the default values are overridden
   169         in the build-bootstrap-classes macro. -->
   171     <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
   172         filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
   173     <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
   174         ignoresystemclasses="true"
   175         classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
   177     <!-- Set the default bootclasspath option used for javac.
   178         Note that different variants of the option are used, meaning we can't just
   179         define the value for the option.
   180         Note the explicit use of the standard property ${path.separator} in the following.
   181         This is because Ant is not clever enough to handle direct use of : or ; -->
   182     <condition property="javac.bootclasspath.opt"
   183             value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
   184             else="-Xbootclasspath/p:${build.classes.dir}">
   185         <isset property="import.jdk.jar"/>
   186     </condition>
   188     <condition property="boot.java.provides.latest.jdk">
   189         <available
   190             ignoresystemclasses="true"
   191             classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
   192     </condition>
   194     <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">
   195         <isset property="boot.java.provides.latest.jdk"/>
   196     </condition>
   198     <condition property="exclude.files" value="" else="${require.latest.jdk.files}">
   199         <or>
   200             <isset property="boot.java.provides.latest.jdk"/>
   201             <isset property="import.jdk"/>
   202         </or>
   203     </condition>
   205     <condition property="require.import.jdk.stubs">
   206         <and>
   207             <not>
   208                 <isset property="boot.java.provides.latest.jdk"/>
   209             </not>
   210             <isset property="import.jdk.src.dir"/>
   211         </and>
   212     </condition>
   214     <!-- Set the default value of the sourcepath used for javac. -->
   215     <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
   216         <isset property="require.import.jdk.stubs"/>
   217     </condition>
   219     <!-- Set the default value of the classpath used for javac. -->
   220     <property name="javac.classpath" value=""/>
   223     <!--
   224     **** General top level targets.
   225     -->
   227     <!-- Standard target to build deliverables for JDK build. -->
   229     <target name="build" depends="build-bootstrap-tools,build-all-classes">
   230         <copy todir="${dist.dir}/bootstrap">
   231             <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
   232         </copy>
   233         <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
   234             <include name="*"/>
   235         </chmod>
   236         <mkdir dir="${dist.lib.dir}"/>
   237         <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
   238         <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
   239     </target>
   241     <target name="build-bootstrap-tools"
   242         depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
   243     />
   245     <target name="build-all-tools"
   246         depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"
   247     />
   249     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
   250         <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${apt.includes}"/>
   251     </target>
   253     <!-- clean -->
   255     <target name="clean" description="Delete all generated files">
   256         <delete dir="${build.dir}"/>
   257         <delete dir="${dist.dir}"/>
   258     </target>
   260     <!-- Additional targets for running tools on the build -->
   262     <target name="jtreg" depends="build-all-tools,-def-jtreg">
   263         <jtreg-tool name="all" tests="${jtreg.tests}"/>
   264     </target>
   266     <target name="findbugs" depends="-def-findbugs,build-all-tools">
   267         <property name="findbugs.reportLevel" value="medium"/>
   268         <mkdir dir="${dist.findbugs.dir}"/>
   269         <findbugs
   270             home="${findbugs.home}"
   271             projectName="JDK langtools ${full.version}"
   272             output="xml"
   273             outputFile="${dist.findbugs.dir}/findbugs.xml"
   274             reportLevel="${findbugs.reportLevel}"
   275             failOnError="false"
   276             errorProperty="findbugs.all.errors"
   277             warningsProperty="findbugs.all.warnings"
   278             jvmargs="-Xmx512M">
   279             <class location="${build.classes.dir}"/>
   280             <sourcePath>
   281                 <pathelement location="${src.classes.dir}"/>
   282             </sourcePath>
   283         </findbugs>
   284         <exec executable="sh">
   285             <arg value="${findbugs.home}/bin/convertXmlToText"/>
   286             <arg value="-longBugCodes"/>
   287             <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
   288             <arg value="${dist.findbugs.dir}/findbugs.xml"/>
   289             <redirector output="${dist.findbugs.dir}/findbugs.html"/>
   290         </exec>
   291     </target>
   293     <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
   295     <target name="instrument-classes" depends="-def-cobertura">
   296         <!-- only define the following property when we want coverage info -->
   297         <path id="coverage.classpath">
   298             <pathelement location="${build.coverage.dir}/classes"/>
   299             <path refid="cobertura.classpath"/>
   300         </path>
   301         <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
   302         <property name="coverage.classpath" refid="coverage.classpath"/>
   303         <mkdir dir="${build.coverage.dir}/classes"/>
   304         <delete file="${build.coverage.dir}/cobertura.ser"/>
   305         <cobertura-instrument todir="${build.coverage.dir}/classes"
   306             datafile="${build.coverage.dir}/cobertura.ser">
   307             <fileset dir="${build.classes.dir}"
   308                includes="**/*.class" excludes="**/resources/*.class"/>
   309         </cobertura-instrument>
   310     </target>
   312     <target name="coverage-report" depends="-def-cobertura">
   313         <mkdir dir="${dist.coverage.dir}"/>
   314         <cobertura-report
   315             srcdir="${src.classes.dir}"
   316             destdir="${dist.coverage.dir}"
   317             datafile="${build.coverage.dir}/cobertura.ser"/>
   318         <cobertura-report
   319             format="xml"
   320             srcdir="${src.classes.dir}"
   321             destdir="${dist.coverage.dir}"
   322             datafile="${build.coverage.dir}/cobertura.ser"/>
   323     </target>
   325     <target name="diags-examples" depends="build-javac">
   326         <!-- can override the following on the command line if desired. -->
   327         <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
   328         <mkdir dir="${build.dir}/diag-examples/classes"/>
   329         <javac fork="true"
   330             executable="${dist.bin.dir}/javac"
   331             srcdir="test/tools/javac/diags"
   332             destdir="${build.dir}/diag-examples/classes"
   333             includes="Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
   334             sourcepath=""
   335             classpath="${dist.lib.dir}/javac.jar"
   336             includeAntRuntime="no"
   337             debug="${javac.debug}"
   338             debuglevel="${javac.debuglevel}"/>
   339         <java fork="true"
   340             jvm="${target.java.home}/bin/java"
   341             dir="test/tools/javac/diags"
   342             classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
   343             classname="RunExamples">
   344             <arg value="-examples"/>
   345             <arg value="examples"/>
   346             <arg value="-o"/>
   347             <arg file="${diags.examples.out}"/>
   348             <arg value="-showFiles"/>
   349             <arg value="-title"/>
   350             <arg value="Examples of javac diagnostics"/>
   351         </java>
   352     </target>
   355     <!--
   356     **** Debugging/diagnostic targets.
   357     -->
   359     <!-- standard JDK target -->
   360     <target name="sanity"
   361         description="display settings of configuration values">
   362         <echo level="info">ant.home = ${ant.home}</echo>
   363         <echo level="info">boot.java.home = ${boot.java.home}</echo>
   364         <echo level="info">target.java.home = ${target.java.home}</echo>
   365         <echo level="info">jtreg.home = ${jtreg.home}</echo>
   366         <echo level="info">findbugs.home = ${findbugs.home}</echo>
   367     </target>
   369     <target name="post-sanity" depends="-def-jtreg,sanity,build"
   370         description="perform basic validation after a standard build">
   371         <jtreg
   372             dir="make/test"
   373             workDir="${build.jtreg.dir}/post-sanity/work"
   374             reportDir="${build.jtreg.dir}/post-sanity/report"
   375             jdk="${target.java.home}"
   376             verbose="summary"
   377             failonerror="false" resultproperty="jtreg.post-sanity.result">
   378         </jtreg>
   379     </target>
   381     <!-- use vizant tool to generate graphical image of this Ant file.-->
   382     <target name="vizant" depends="-def-vizant">
   383         <mkdir dir="${build.dir}"/>
   384         <echo message="Generating ${build.dir}/build.dot"/>
   385         <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
   386         <echo message="Generating ${build.dir}/build.png"/>
   387         <exec executable="${dot}" >
   388             <arg value="-Tpng"/>
   389             <arg value="-o"/>
   390             <arg file="${build.dir}/build.png"/>
   391             <arg file="${build.dir}/build.dot"/>
   392         </exec>
   393     </target>
   395     <target name="check-import.jdk">
   396         <echo message="import.jdk: ${import.jdk}"/>
   397         <echo message="import.jdk.jar: ${import.jdk.jar}"/>
   398         <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
   399     </target>
   401     <target name="diagnostics">
   402         <diagnostics/>
   403     </target>
   406     <!--
   407     **** javac targets.
   408     -->
   410     <target name="build-bootstrap-javac"
   411             depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
   412         <build-bootstrap-classes includes="${javac.includes}"/>
   413         <build-bootstrap-jar     name="javac" includes="${javac.includes}"/>
   414         <build-bootstrap-tool    name="javac"/>
   415     </target>
   417     <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
   418         <build-classes includes="${javac.includes}"/>
   419     </target>
   421     <target name="build-javac" depends="build-classes-javac">
   422         <build-jar  name="javac" includes="${javac.includes}"/>
   423         <build-tool name="javac"/>
   424     </target>
   426     <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
   427         <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls3.option}"/>
   428     </target>
   430     <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
   431         <jtreg-tool name="javac" tests="${javac.tests}"/>
   432     </target>
   434     <target name="findbugs-javac" depends="build-javac,-def-findbugs">
   435         <findbugs-tool name="javac"/>
   436     </target>
   438     <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
   441     <!--
   442     **** javadoc targets.
   443     -->
   445     <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
   446         <build-bootstrap-classes includes="${javadoc.includes}"/>
   447         <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
   448                                  jarclasspath="javac.jar doclets.jar"/>
   449         <build-bootstrap-tool    name="javadoc"/>
   450     </target>
   452     <target name="build-classes-javadoc" depends="build-classes-javac">
   453         <build-classes includes="${javadoc.includes}"/>
   454     </target>
   456     <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
   457         <build-jar  name="javadoc" includes="${javadoc.includes}"
   458                     jarclasspath="javac.jar doclets.jar"/>
   459         <build-tool name="javadoc"/>
   460     </target>
   462     <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
   463         <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
   464     </target>
   466     <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
   467         <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
   468     </target>
   470     <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
   471         <findbugs-tool name="javadoc"/>
   472     </target>
   474     <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
   477     <!--
   478     **** doclets targets.
   479     -->
   481     <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
   482         <build-bootstrap-classes includes="${doclets.includes}"/>
   483         <build-bootstrap-jar     name="doclets" includes="${doclets.includes}"
   484                                  jarmainclass="com.sun.tools.javadoc.Main"
   485                                  jarclasspath="javadoc.jar"/>
   486     </target>
   488     <target name="build-classes-doclets" depends="build-classes-javadoc">
   489         <build-classes includes="${doclets.includes}"/>
   490     </target>
   492     <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
   493         <!-- just jar, no bin for doclets -->
   494         <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
   495     </target>
   497     <!-- (no javadoc for doclets) -->
   499     <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
   500         <jtreg-tool name="doclets" tests="${doclets.tests}"/>
   501     </target>
   503     <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
   504         <findbugs-tool name="doclets"/>
   505     </target>
   507     <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
   510     <!--
   511     **** javah targets.
   512     -->
   514     <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
   515         <build-bootstrap-classes includes="${javah.includes}"/>
   516         <build-bootstrap-jar     name="javah" includes="${javah.includes}"
   517                                  jarclasspath="javadoc.jar doclets.jar javac.jar"/>
   518         <build-bootstrap-tool    name="javah"/>
   519     </target>
   521     <target name="build-javah" depends="build-javac,build-classes-javah">
   522         <build-jar  name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
   523         <build-tool name="javah"/>
   524     </target>
   526     <target name="build-classes-javah" depends="build-classes-javadoc">
   527         <build-classes includes="${javah.includes}"/>
   528     </target>
   530     <!-- (no javadoc for javah) -->
   532     <target name="jtreg-javah" depends="build-javah,-def-jtreg">
   533         <jtreg-tool name="javah" tests="${javah.tests}"/>
   534     </target>
   536     <target name="findbugs-javah" depends="build-javah,-def-findbugs">
   537         <findbugs-tool name="javah"/>
   538     </target>
   540     <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
   543     <!--
   544     **** javap targets.
   545     -->
   547     <target name="build-bootstrap-javap"
   548             depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
   549         <build-bootstrap-classes includes="${javap.includes}"/>
   550         <build-bootstrap-jar     name="javap" includes="${javap.includes}"
   551                                  jarmainclass="sun.tools.javap.Main"/>
   552         <build-bootstrap-tool    name="javap"/>
   553     </target>
   555     <target name="build-classes-javap" depends="build-classes-javac">
   556         <build-classes includes="${javap.includes}"/>
   557     </target>
   559     <target name="build-javap" depends="build-javac,build-classes-javap">
   560         <build-jar  name="javap" includes="${javap.includes}"
   561                     jarmainclass="com.sun.tools.javap.Main"
   562                     jarclasspath="javac.jar"/>
   563         <build-tool name="javap"/>
   564     </target>
   566     <!-- (no javadoc for javap) -->
   568     <target name="jtreg-javap" depends="build-javap,-def-jtreg">
   569         <jtreg-tool name="javap" tests="${javap.tests}"/>
   570     </target>
   572     <target name="findbugs-javap" depends="build-javap,-def-findbugs">
   573         <findbugs-tool name="javap"/>
   574     </target>
   576     <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
   579     <!--
   580     **** apt targets.
   581     -->
   583     <target name="build-bootstrap-apt" depends="build-bootstrap-javac">
   584         <build-bootstrap-classes includes="${apt.includes}"/>
   585         <build-bootstrap-jar     name="apt" includes="${apt.includes}"
   586                                  jarclasspath="javac.jar"/>
   587         <build-bootstrap-tool    name="apt"/>
   588     </target>
   590     <target name="build-apt" depends="build-javac,build-classes-apt">
   591         <build-jar  name="apt" includes="${apt.includes}" jarclasspath="javac.jar"/>
   592         <build-tool name="apt"/>
   593     </target>
   595     <target name="build-classes-apt" depends="build-classes-javac">
   596         <build-classes includes="${apt.includes}"/>
   597     </target>
   599     <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
   600         <javadoc-tool name="apt" includes="${apt.includes}"/>
   601     </target>
   604     <target name="jtreg-apt" depends="build-apt,-def-jtreg">
   605         <jtreg-tool name="apt" tests="${apt.tests}"/>
   606     </target>
   608     <target name="findbugs-apt" depends="build-apt,-def-findbugs">
   609         <findbugs-tool name="apt"/>
   610     </target>
   612     <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
   615     <!--
   616     **** Create import JDK stubs.
   617     -->
   619     <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
   620         <mkdir dir="${build.genstubs.dir}"/>
   621         <genstubs
   622             srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
   623             includes="${import.jdk.stub.files}"
   624             fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"
   625         />
   626     </target>
   629     <!--
   630     **** Check targets.
   631     **** "-check-*" targets check that a required property is set, and set to a reasonable value.
   632     **** A user friendly message is generated if not, and the build exits.
   633     -->
   635     <target name="-check-boot.java.home" depends="-def-check">
   636         <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
   637     </target>
   639     <target name="-check-target.java.home" depends="-def-check">
   640         <check name="target java" property="target.java.home" marker="${java.marker}"/>
   641     </target>
   643     <target name="-check-cobertura.home" depends="-def-check">
   644         <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
   645     </target>
   647     <target name="-check-findbugs.home" depends="-def-check">
   648         <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
   649     </target>
   651     <target name="-check-jtreg.home" depends="-def-check">
   652         <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
   653     </target>
   655     <target name="-check-vizant" depends="-def-check">
   656         <check name="vizant" property="vizant.jar"/>
   657         <check name="dot" property="dot"/>
   658     </target>
   661     <!--
   662     **** Targets for Ant macro and task definitions.
   663     -->
   665     <target name="-def-build-tool">
   666         <macrodef name="build-tool">
   667             <attribute name="name"/>
   668             <attribute name="bin.dir" default="${dist.bin.dir}"/>
   669             <attribute name="java" default="${launcher.java}"/>
   670             <sequential>
   671                 <mkdir dir="@{bin.dir}"/>
   672                 <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
   673                     <filterset begintoken="#" endtoken="#">
   674                         <filter token="PROGRAM" value="@{name}"/>
   675                         <filter token="TARGET_JAVA" value="@{java}"/>
   676                         <filter token="PS" value="${path.separator}"/>
   677                     </filterset>
   678                 </copy>
   679                 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
   680             </sequential>
   681         </macrodef>
   682     </target>
   684     <target name="-def-build-jar">
   685         <macrodef name="build-jar">
   686             <attribute name="name"/>
   687             <attribute name="includes"/>
   688             <attribute name="classes.dir" default="${build.classes.dir}"/>
   689             <attribute name="lib.dir" default="${dist.lib.dir}"/>
   690             <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
   691             <attribute name="jarclasspath" default=""/>
   692             <sequential>
   693                 <mkdir dir="@{lib.dir}"/>
   694                 <jar destfile="@{lib.dir}/@{name}.jar"
   695                      basedir="@{classes.dir}"
   696                      includes="@{includes}">
   697                     <manifest>
   698                         <attribute name="Main-Class" value="@{jarmainclass}"/>
   699                         <attribute name="Class-Path" value="@{jarclasspath}"/>
   700                     </manifest>
   701                 </jar>
   702             </sequential>
   703         </macrodef>
   704     </target>
   706     <target name="-def-build-classes" depends="-def-pcompile">
   707         <macrodef name="build-classes">
   708             <attribute name="includes"/>
   709             <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
   710             <attribute name="classes.dir" default="${build.classes.dir}"/>
   711             <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
   712             <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
   713             <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
   714             <attribute name="classpath" default="${javac.classpath}"/>
   715             <attribute name="sourcepath" default="${javac.sourcepath}"/>
   716             <attribute name="java.home" default="${boot.java.home}"/>
   717             <attribute name="source" default="${javac.source}"/>
   718             <attribute name="target" default="${javac.target}"/>
   719             <attribute name="release" default="${release}"/>
   720             <attribute name="full.version" default="${full.version}"/>
   721             <sequential>
   722                 <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
   723                 <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
   724                 <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
   725                 <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
   726                 <mkdir dir="@{gensrc.dir}"/>
   727                 <mkdir dir="@{classes.dir}"/>
   728                 <pcompile srcdir="${src.classes.dir}"
   729                           destdir="@{gensrc.dir}"
   730                           includes="@{includes}"/>
   731                 <copy todir="@{gensrc.dir}">
   732                     <fileset dir="${src.classes.dir}" includes="@{includes}"/>
   733                     <globmapper from="*.properties-template" to="*.properties"/>
   734                     <filterset begintoken="$(" endtoken=")">
   735                         <filter token="JDK_VERSION" value="${jdk.version}"/>
   736                         <filter token="RELEASE" value="@{release}"/>
   737                         <filter token="FULL_VERSION" value="@{full.version}"/>
   738                     </filterset>
   739                 </copy>
   740                 <pcompile srcdir="@{gensrc.dir}"
   741                           destdir="@{gensrc.dir}"
   742                           includes="**/*.properties"/>
   743                 <javac fork="true"
   744                        executable="@{java.home}/bin/javac"
   745                        srcdir="${src.classes.dir}:@{gensrc.dir}"
   746                        destdir="@{classes.dir}"
   747                        includes="@{includes}"
   748                        excludes="@{excludes}"
   749                        sourcepath="@{sourcepath}"
   750                        classpath="@{classpath}"
   751                        includeAntRuntime="no"
   752                        source="@{source}"
   753                        target="@{target}"
   754                        debug="${javac.debug}"
   755                        debuglevel="${javac.debuglevel}">
   756                     <compilerarg value="-implicit:none"/>
   757                     <compilerarg value="-Xprefer:source"/>
   758                     <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
   759                     <compilerarg line="@{bootclasspath.opt}"/>
   760                     <compilerarg line="${javac.no.jdk.warnings}"/>
   761                     <compilerarg line="${javac.version.opt}"/>
   762                     <compilerarg line="${javac.lint.opts}"/>
   763                 </javac>
   764                 <copy todir="@{classes.dir}" includeemptydirs="false">
   765                     <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
   766                         <exclude name="**/*.java"/>
   767                         <exclude name="**/*.properties"/>
   768                         <exclude name="**/*-template"/>
   769                         <exclude name="**/package.html"/>
   770                     </fileset>
   771                 </copy>
   772             </sequential>
   773         </macrodef>
   774     </target>
   776     <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
   777         <presetdef name="build-bootstrap-tool">
   778             <build-tool
   779                 bin.dir="${build.bootstrap.dir}/bin"
   780                 java="${boot.java}"/>
   781         </presetdef>
   782     </target>
   784     <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
   785         <presetdef name="build-bootstrap-jar">
   786             <build-jar
   787                 classes.dir="${build.bootstrap.dir}/classes"
   788                 lib.dir="${build.bootstrap.dir}/lib"/>
   789         </presetdef>
   790     </target>
   792     <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
   793         <presetdef name="build-bootstrap-classes">
   794             <build-classes
   795                 source="${boot.javac.source}"
   796                 target="${boot.javac.target}"
   797                 gensrc.dir="${build.bootstrap.dir}/gensrc"
   798                 classes.dir="${build.bootstrap.dir}/classes"
   799                 javac.bootclasspath=""
   800                 bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
   801                 sourcepath=""
   802                 release="${bootstrap.release}"
   803                 full.version="${bootstrap.full.version}"
   804                 excludes="${bootstrap.exclude.files} **/package-info.java"/>
   805         </presetdef>
   806     </target>
   808     <target name="-def-pcompile">
   809         <mkdir dir="${build.toolclasses.dir}"/>
   810         <javac fork="true"
   811                source="${boot.javac.source}"
   812                target="${boot.javac.target}"
   813                executable="${boot.java.home}/bin/javac"
   814                srcdir="${make.tools.dir}/CompileProperties"
   815                destdir="${build.toolclasses.dir}/"
   816                classpath="${ant.home}/lib/ant.jar"/>
   817         <taskdef name="pcompile"
   818                  classname="CompilePropertiesTask"
   819                  classpath="${build.toolclasses.dir}/"/>
   820     </target>
   822     <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
   823         <mkdir dir="${build.toolclasses.dir}"/>
   824         <javac fork="true"
   825                source="${boot.javac.source}"
   826                target="${boot.javac.target}"
   827                executable="${boot.java.home}/bin/javac"
   828                srcdir="${make.tools.dir}/GenStubs"
   829                destdir="${build.toolclasses.dir}/"
   830                classpath="${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"/>
   831         <taskdef name="genstubs"
   832                  classname="GenStubs$$Ant"
   833                  classpath="${build.toolclasses.dir}/"/>
   834     </target>
   836     <target name="-def-javadoc-tool" depends="-check-target.java.home">
   837         <macrodef name="javadoc-tool">
   838             <attribute name="name"/>
   839             <attribute name="includes"/>
   840             <attribute name="options" default=""/>
   841             <attribute name="source" default="1.5"/> <!-- FIXME -->
   842             <sequential>
   843                 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
   844                 <!-- Note: even with this default value, includes
   845                 from src.classes.dir get javadoc'd; see packageset below -->
   846                 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
   847                 <javadoc
   848                     executable="${target.java.home}/bin/javadoc"
   849                     destdir="${build.javadoc.dir}/@{name}"
   850                     source="@{source}"
   851                     windowtitle="UNOFFICIAL"
   852                     failonerror="true"
   853                     use="true"
   854                     author="false"
   855                     version="false"
   856                     packagenames="${javadoc.packagenames}" >
   857                     <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
   858                     <arg line="@{options}"/>
   859                     <bootclasspath>
   860                         <path location="${build.classes.dir}"/>
   861                         <path location="${target.java.home}/jre/lib/rt.jar"/>
   862                     </bootclasspath>
   863                     <sourcepath>
   864                         <pathelement location="${src.classes.dir}"/>
   865                     </sourcepath>
   866                     <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
   867                     <!-- means that {@link some.package} will not work, which is no good. -->
   868                     <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
   869                     <!-- which also causes duplicates in the class index for included files.) -->
   870                     <packageset dir="${src.classes.dir}" includes="@{includes}">
   871                         <or>
   872                             <filename name="java/"/>
   873                             <filename name="javax/"/>
   874                             <filename name="com/sun/javadoc/"/>
   875                             <filename name="com/sun/mirror/"/>
   876                             <filename name="com/sun/source/"/>
   877                         </or>
   878                     </packageset>
   879                 </javadoc>
   880             </sequential>
   881         </macrodef>
   882     </target>
   884     <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
   885         <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
   886             <classpath>
   887                 <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
   888                 <pathelement location="${jtreg.home}/lib/javatest.jar"/>
   889             </classpath>
   890         </taskdef>
   891         <macrodef name="jtreg-tool">
   892             <attribute name="name"/>
   893             <attribute name="tests"/>
   894             <attribute name="jdk" default="${target.java.home}"/>
   895             <attribute name="samevm" default="true"/>
   896             <attribute name="verbose" default="${default.jtreg.verbose}"/>
   897             <attribute name="options" default="${other.jtreg.options}"/>
   898             <attribute name="keywords" default="-keywords:!ignore"/>
   899             <attribute name="jpda.jvmargs" default=""/>
   900             <sequential>
   901                 <property name="coverage.options" value=""/>              <!-- default -->
   902                 <property name="coverage.classpath" value=""/>            <!-- default -->
   903                 <property name="default.jtreg.verbose" value="summary"/>  <!-- default -->
   904                 <property name="other.jtreg.options" value=""/>           <!-- default -->
   905                 <jtreg
   906                     dir="${test.dir}"
   907                     workDir="${build.jtreg.dir}/@{name}/work"
   908                     reportDir="${build.jtreg.dir}/@{name}/report"
   909                     jdk="@{jdk}"
   910                     samevm="@{samevm}" verbose="@{verbose}"
   911                     failonerror="false" resultproperty="jtreg.@{name}.result"
   912                     javacoptions="-g"
   913                     vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}:${build.classes.dir} @{jpda.jvmargs}">
   914                     <arg line="@{keywords}"/>
   915                     <arg line="@{options}"/>
   916                     <arg line="@{tests}"/>
   917                 </jtreg>
   918                 <!-- the next two properties are for convenience, when only
   919                      a single instance of jtreg will be invoked. -->
   920                 <condition property="jtreg.passed">
   921                     <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
   922                 </condition>
   923                 <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
   924             </sequential>
   925         </macrodef>
   926         <property name="jtreg.defined" value="true"/>
   927     </target>
   929     <target name="-def-cobertura" depends="-check-cobertura.home">
   930         <path id="cobertura.classpath">
   931             <fileset dir="${cobertura.home}">
   932                 <include name="cobertura.jar"/>
   933                 <include name="lib/**/*.jar"/>
   934             </fileset>
   935         </path>
   936         <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
   937     </target>
   939     <target name="-def-findbugs" unless="findbugs.defined" depends="-check-findbugs.home">
   940         <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
   941             <classpath>
   942                 <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
   943             </classpath>
   944         </taskdef>
   945         <macrodef name="findbugs-tool">
   946             <attribute name="name"/>
   947             <attribute name="output" default="emacs"/>
   948             <attribute name="outputFile" default=""/>
   949             <attribute name="reportLevel" default="high"/>
   950             <sequential>
   951                 <findbugs
   952                     home="${findbugs.home}"
   953                     output="@{output}"
   954                     outputFile="@{outputFile}"
   955                     reportLevel="@{reportLevel}"
   956                     failOnError="false"
   957                     errorProperty="findbugs.@{name}.errors"
   958                     warningsProperty="findbugs.@{name}.warnings"
   959                     jvmargs="-Xmx512M" >
   960                     <class location="${dist.dir}/lib/@{name}.jar"/>
   961                     <auxClasspath>
   962                         <pathelement location="${build.classes.dir}"/>
   963                     </auxClasspath>
   964                     <sourcePath>
   965                         <pathelement location="${src.classes.dir}"/>
   966                     </sourcePath>
   967                 </findbugs>
   968             </sequential>
   969         </macrodef>
   970         <property name="findbugs.defined" value="true"/>
   971     </target>
   973     <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
   974         <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
   975         <property name="vizant.defined" value="true"/>
   976     </target>
   978     <target name="-def-check">
   979         <macrodef name="check">
   980             <attribute name="name"/>
   981             <attribute name="property"/>
   982             <attribute name="marker" default=""/>
   983             <sequential>
   984                 <fail message="Cannot locate @{name}: please set @{property} to its location">
   985                     <condition>
   986                         <not>
   987                             <isset property="@{property}"/>
   988                         </not>
   989                     </condition>
   990                 </fail>
   991                 <fail message="@{name} is not installed in ${@{property}}">
   992                     <condition>
   993                         <and>
   994                             <not>
   995                                 <equals arg1="@{marker}" arg2=""/>
   996                             </not>
   997                             <not>
   998                                 <available file="${@{property}}/@{marker}"/>
   999                             </not>
  1000                         </and>
  1001                     </condition>
  1002                 </fail>
  1003             </sequential>
  1004         </macrodef>
  1005     </target>
  1007 </project>

mercurial