make/build.xml

Fri, 04 Jun 2010 14:54:54 -0700

author
jjg
date
Fri, 04 Jun 2010 14:54:54 -0700
changeset 578
b7fc560217d3
parent 554
9d9f26857129
child 579
d33b91f360fc
permissions
-rw-r--r--

6958391: add vizant support to langtools build
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 workspace.
    29  It is used both when working on the tools in NetBeans, and when building
    30  JDK itself, in which case it is invoked from the wrapper Makefile.
    31  -->
    33 <project name="langtools" default="build" basedir="..">
    35     <!-- Force full debuginfo for javac if the debug.classfiles
    36     property is set.  This must be BEFORE the include of
    37     build.properties because it sets javac.debuglevel.  -->
    38     <condition property="javac.debuglevel" value="source,lines,vars">
    39         <equals arg1="${debug.classfiles}" arg2="true"/>
    40     </condition>
    42     <!-- The following locations can be used to override default property values. -->
    44     <!-- Use this location for customizations specific to this instance of this workspace -->
    45     <property file="build.properties"/>
    47     <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
    48     <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
    50     <!-- Use this location for customizations common to all OpenJDK workspaces -->
    51     <property file="${user.home}/.openjdk/build.properties"/>
    53     <!-- Convenient shorthands for standard locations within the workspace. -->
    54     <property name="build.dir" location="build"/>
    55     <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
    56     <property name="build.coverage.dir" location="${build.dir}/coverage"/>
    57     <property name="build.classes.dir" location="${build.dir}/classes"/>
    58     <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
    59     <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
    60     <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
    61     <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
    62     <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
    63     <property name="dist.dir" location="dist"/>
    64     <property name="dist.bin.dir" location="${dist.dir}/bin"/>
    65     <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
    66     <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
    67     <property name="dist.lib.dir" location="${dist.dir}/lib"/>
    68     <property name="make.dir" location="make"/>
    69     <property name="make.tools.dir" location="${make.dir}/tools"/>
    70     <property name="src.dir" location="src"/>
    71     <property name="src.bin.dir" location="${src.dir}/share/bin"/>
    72     <property name="src.classes.dir" location="${src.dir}/share/classes"/>
    73     <property name="test.dir" location="test"/>
    75     <!-- java.marker is set to a marker file to check for within a Java install dir.
    76          The best file to check for across Solaris/Linux/Windows/MacOS is one of the
    77          executables; regrettably, that is OS-specific. -->
    78     <condition property="java.marker" value="bin/java">
    79         <os family="unix"/>
    80     </condition>
    81     <condition property="java.marker" value="bin/java.exe">
    82         <os family="windows"/>
    83     </condition>
    85     <!-- Standard property values, if not overriden by earlier settings. -->
    86     <property file="${make.dir}/build.properties"/>
    88     <!-- launcher.java is used in the launcher scripts provided to run
    89         the tools' jar files.  If it has not already been set, then
    90         default it to use ${target.java.home}, if available, otherwise
    91         quietly default to simply use "java". -->
    92     <condition property="launcher.java"
    93         value="${target.java.home}/bin/java" else="java">
    94         <isset property="target.java.home"/>
    95     </condition>
    97     <!-- Logic for handling access import jdk classes, if available.
    98         import.jdk should be unset, or set to jdk home (to use rt.jar)
    99         or to jdk repo (to use src/share/classes).
   100         Based on the value, if any, set up default values for javac's sourcepath,
   101         classpath and bootclasspath. Note: the default values are overridden
   102         in the build-bootstrap-classes macro. -->
   104     <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
   105         filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
   106     <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
   107         ignoresystemclasses="true"
   108         classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
   110     <!-- Set the default value of the sourcepath used for javac. -->
   111     <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
   112         <isset property="import.jdk.src.dir"/>
   113     </condition>
   115     <!-- Set the default value of the classpath used for javac. -->
   116     <property name="javac.classpath" value=""/>
   118     <!-- Set the default bootclasspath option used for javac. 
   119 	Note that different variants of the option are used, meaning we can't just 
   120 	define the value for the option.
   121 	Note the explicit use of the standard property ${path.separator} in the following.
   122 	This is because Ant is not clever enough to handle direct use of : or ; -->
   123     <condition property="javac.bootclasspath.opt"
   124             value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
   125             else="-Xbootclasspath/p:${build.classes.dir}">
   126         <isset property="import.jdk.jar"/>
   127     </condition>
   129     <condition property="exclude.files" value="" else="${require.import.jdk.files}">
   130         <isset property="import.jdk"/>
   131     </condition>
   133     <!-- for debugging -->
   134     <target name="check-import.jdk">
   135         <echo message="import.jdk: ${import.jdk}"/>
   136         <echo message="import.jdk.jar: ${import.jdk.jar}"/>
   137         <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
   138     </target>
   140     <target name="vizant" depends="-def-vizant">
   141 	<mkdir dir="${build.dir}"/>
   142 	<echo message="Generating ${build.dir}/build.dot"/>
   143         <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
   144 	<echo message="Generating ${build.dir}/build.png"/>
   145         <exec executable="${dot}" >
   146             <arg value="-Tpng"/>
   147             <arg value="-o"/>
   148             <arg file="${build.dir}/build.png"/>
   149             <arg file="${build.dir}/build.dot"/>
   150         </exec> 
   151     </target>
   153     <!-- Standard target to build deliverables for JDK build. -->
   155     <target name="build" depends="build-bootstrap-tools,build-all-classes">
   156         <copy todir="${dist.dir}/bootstrap">
   157             <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
   158         </copy>
   159         <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
   160             <include name="*"/>
   161         </chmod>
   162         <mkdir dir="${dist.lib.dir}"/>
   163         <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
   164         <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
   165     </target>
   167     <target name="build-bootstrap-tools"
   168         depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
   169     />
   171     <target name="build-all-tools"
   172         depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"
   173     />
   175     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
   176         <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${apt.includes}"/>
   177     </target>
   179     <!-- clean -->
   181     <target name="clean" description="Delete all generated files">
   182         <delete dir="${build.dir}"/>
   183         <delete dir="${dist.dir}"/>
   184     </target>
   186     <!-- Additional targets for running tools on the build -->
   188     <target name="jtreg" depends="build-all-tools,-def-jtreg">
   189         <jtreg-tool name="all" tests="${jtreg.tests}"/>
   190     </target>
   192     <target name="findbugs" depends="-def-findbugs,build-all-tools">
   193         <property name="findbugs.reportLevel" value="medium"/>
   194         <mkdir dir="${dist.findbugs.dir}"/>
   195         <findbugs
   196             home="${findbugs.home}"
   197             projectName="JDK langtools ${full.version}"
   198             output="xml"
   199             outputFile="${dist.findbugs.dir}/findbugs.xml"
   200             reportLevel="${findbugs.reportLevel}"
   201             failOnError="false"
   202             errorProperty="findbugs.all.errors"
   203             warningsProperty="findbugs.all.warnings"
   204             jvmargs="-Xmx512M">
   205             <class location="${build.classes.dir}"/>
   206             <sourcePath>
   207                 <pathelement location="${src.classes.dir}"/>
   208             </sourcePath>
   209         </findbugs>
   210         <exec executable="sh">
   211             <arg value="${findbugs.home}/bin/convertXmlToText"/>
   212             <arg value="-longBugCodes"/>
   213             <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
   214             <arg value="${dist.findbugs.dir}/findbugs.xml"/>
   215             <redirector output="${dist.findbugs.dir}/findbugs.html"/>
   216         </exec>
   217     </target>
   219     <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
   221     <target name="instrument-classes" depends="-def-cobertura">
   222         <!-- only define the following property when we want coverage info -->
   223         <path id="coverage.classpath">
   224             <pathelement location="${build.coverage.dir}/classes"/>
   225             <path refid="cobertura.classpath"/>
   226         </path>
   227         <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
   228         <property name="coverage.classpath" refid="coverage.classpath"/>
   229         <mkdir dir="${build.coverage.dir}/classes"/>
   230         <delete file="${build.coverage.dir}/cobertura.ser"/>
   231         <cobertura-instrument todir="${build.coverage.dir}/classes"
   232             datafile="${build.coverage.dir}/cobertura.ser">
   233             <fileset dir="${build.classes.dir}"
   234                includes="**/*.class" excludes="**/resources/*.class"/>
   235         </cobertura-instrument>
   236     </target>
   238     <target name="coverage-report" depends="-def-cobertura">
   239         <mkdir dir="${dist.coverage.dir}"/>
   240         <cobertura-report
   241             srcdir="${src.classes.dir}"
   242             destdir="${dist.coverage.dir}"
   243             datafile="${build.coverage.dir}/cobertura.ser"/>
   244         <cobertura-report
   245             format="xml"
   246             srcdir="${src.classes.dir}"
   247             destdir="${dist.coverage.dir}"
   248             datafile="${build.coverage.dir}/cobertura.ser"/>
   249     </target>
   251     <!-- javac targets -->
   253     <target name="build-bootstrap-javac"
   254             depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
   255         <build-bootstrap-classes includes="${javac.includes}"/>
   256         <build-bootstrap-jar     name="javac" includes="${javac.includes}"/>
   257         <build-bootstrap-tool    name="javac"/>
   258     </target>
   260     <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
   261         <build-classes includes="${javac.includes}"/>
   262     </target>
   264     <target name="build-javac" depends="build-classes-javac">
   265         <build-jar  name="javac" includes="${javac.includes}"/>
   266         <build-tool name="javac"/>
   267     </target>
   269     <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
   270         <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls3.option}"/>
   271     </target>
   273     <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
   274         <jtreg-tool name="javac" tests="${javac.tests}"/>
   275     </target>
   277     <target name="findbugs-javac" depends="build-javac,-def-findbugs">
   278         <findbugs-tool name="javac"/>
   279     </target>
   281     <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
   283     <!-- javadoc targets -->
   285     <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
   286         <build-bootstrap-classes includes="${javadoc.includes}"/>
   287         <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
   288                                  jarclasspath="javac.jar doclets.jar"/>
   289         <build-bootstrap-tool    name="javadoc"/>
   290     </target>
   292     <target name="build-classes-javadoc" depends="build-classes-javac">
   293         <build-classes includes="${javadoc.includes}"/>
   294     </target>
   296     <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
   297         <build-jar  name="javadoc" includes="${javadoc.includes}"
   298                     jarclasspath="javac.jar doclets.jar"/>
   299         <build-tool name="javadoc"/>
   300     </target>
   302     <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
   303         <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
   304     </target>
   306     <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
   307         <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
   308     </target>
   310     <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
   311         <findbugs-tool name="javadoc"/>
   312     </target>
   314     <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
   316     <!-- doclets targets -->
   318     <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
   319         <build-bootstrap-classes includes="${doclets.includes}"/>
   320         <build-bootstrap-jar     name="doclets" includes="${doclets.includes}"
   321                                  jarmainclass="com.sun.tools.javadoc.Main"
   322                                  jarclasspath="javadoc.jar"/>
   323     </target>
   325     <target name="build-classes-doclets" depends="build-classes-javadoc">
   326         <build-classes includes="${doclets.includes}"/>
   327     </target>
   329     <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
   330         <!-- just jar, no bin for doclets -->
   331         <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
   332     </target>
   334     <!-- (no javadoc for doclets) -->
   336     <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
   337         <jtreg-tool name="doclets" tests="${doclets.tests}"/>
   338     </target>
   340     <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
   341         <findbugs-tool name="doclets"/>
   342     </target>
   344     <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
   346     <!-- javah targets -->
   348     <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
   349         <build-bootstrap-classes includes="${javah.includes}"/>
   350         <build-bootstrap-jar     name="javah" includes="${javah.includes}"
   351                                  jarclasspath="javadoc.jar doclets.jar javac.jar"/>
   352         <build-bootstrap-tool    name="javah"/>
   353     </target>
   355     <target name="build-javah" depends="build-javac,build-classes-javah">
   356         <build-jar  name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
   357         <build-tool name="javah"/>
   358     </target>
   360     <target name="build-classes-javah" depends="build-classes-javadoc">
   361         <build-classes includes="${javah.includes}"/>
   362     </target>
   364     <!-- (no javadoc for javah) -->
   366     <target name="jtreg-javah" depends="build-javah,-def-jtreg">
   367         <jtreg-tool name="javah" tests="${javah.tests}"/>
   368     </target>
   370     <target name="findbugs-javah" depends="build-javah,-def-findbugs">
   371         <findbugs-tool name="javah"/>
   372     </target>
   374     <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
   376     <!-- javap targets -->
   378     <target name="build-bootstrap-javap"
   379             depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
   380         <build-bootstrap-classes includes="${javap.includes}"/>
   381         <build-bootstrap-jar     name="javap" includes="${javap.includes}"
   382                                  jarmainclass="sun.tools.javap.Main"/>
   383         <build-bootstrap-tool    name="javap"/>
   384     </target>
   386     <target name="build-classes-javap" depends="build-classes-javac">
   387         <build-classes includes="${javap.includes}"/>
   388     </target>
   390     <target name="build-javap" depends="build-javac,build-classes-javap">
   391         <build-jar  name="javap" includes="${javap.includes}"
   392                     jarmainclass="com.sun.tools.javap.Main"
   393                     jarclasspath="javac.jar"/>
   394         <build-tool name="javap"/>
   395     </target>
   397     <!-- (no javadoc for javap) -->
   399     <target name="jtreg-javap" depends="build-javap,-def-jtreg">
   400         <jtreg-tool name="javap" tests="${javap.tests}"/>
   401     </target>
   403     <target name="findbugs-javap" depends="build-javap,-def-findbugs">
   404         <findbugs-tool name="javap"/>
   405     </target>
   407     <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
   409     <!-- apt targets -->
   411     <target name="build-bootstrap-apt" depends="build-bootstrap-javac">
   412         <build-bootstrap-classes includes="${apt.includes}"/>
   413         <build-bootstrap-jar     name="apt" includes="${apt.includes}"
   414                                  jarclasspath="javac.jar"/>
   415         <build-bootstrap-tool    name="apt"/>
   416     </target>
   418     <target name="build-apt" depends="build-javac,build-classes-apt">
   419         <build-jar  name="apt" includes="${apt.includes}" jarclasspath="javac.jar"/>
   420         <build-tool name="apt"/>
   421     </target>
   423     <target name="build-classes-apt" depends="build-classes-javac">
   424         <build-classes includes="${apt.includes}"/>
   425     </target>
   427     <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
   428         <javadoc-tool name="apt" includes="${apt.includes}"/>
   429     </target>
   432     <target name="jtreg-apt" depends="build-apt,-def-jtreg">
   433         <jtreg-tool name="apt" tests="${apt.tests}"/>
   434     </target>
   436     <target name="findbugs-apt" depends="build-apt,-def-findbugs">
   437         <findbugs-tool name="apt"/>
   438     </target>
   440     <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
   442     <!-- Create import JDK stubs -->
   444     <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="import.jdk.src.dir">
   445         <mkdir dir="${build.genstubs.dir}"/>
   446         <genstubs
   447             srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
   448             includes="${import.jdk.stub.files}"
   449             fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"
   450         />
   451     </target>
   453     <!-- Check targets -->
   455     <target name="-check-boot.java.home" depends="-def-check">
   456         <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
   457     </target>
   459     <target name="-check-target.java.home" depends="-def-check">
   460         <check name="target java" property="target.java.home" marker="${java.marker}"/>
   461     </target>
   463     <target name="-check-cobertura.home" depends="-def-check">
   464         <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
   465     </target>
   467     <target name="-check-findbugs.home" depends="-def-check">
   468         <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
   469     </target>
   471     <target name="-check-jtreg.home" depends="-def-check">
   472         <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
   473     </target>
   475     <target name="-check-vizant" depends="-def-check">
   476         <check name="vizant" property="vizant.jar"/>
   477         <check name="dot" property="dot"/>
   478     </target>
   480     <!-- Ant macro and preset defs -->
   482     <target name="-def-build-tool">
   483         <macrodef name="build-tool">
   484             <attribute name="name"/>
   485             <attribute name="bin.dir" default="${dist.bin.dir}"/>
   486             <attribute name="java" default="${launcher.java}"/>
   487             <sequential>
   488                 <mkdir dir="@{bin.dir}"/>
   489                 <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
   490                     <filterset begintoken="#" endtoken="#">
   491                         <filter token="PROGRAM" value="@{name}"/>
   492                         <filter token="TARGET_JAVA" value="@{java}"/>
   493                     </filterset>
   494                 </copy>
   495                 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
   496             </sequential>
   497         </macrodef>
   498     </target>
   500     <target name="-def-build-jar">
   501         <macrodef name="build-jar">
   502             <attribute name="name"/>
   503             <attribute name="includes"/>
   504             <attribute name="classes.dir" default="${build.classes.dir}"/>
   505             <attribute name="lib.dir" default="${dist.lib.dir}"/>
   506             <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
   507             <attribute name="jarclasspath" default=""/>
   508             <sequential>
   509                 <mkdir dir="@{lib.dir}"/>
   510                 <jar destfile="@{lib.dir}/@{name}.jar"
   511                      basedir="@{classes.dir}"
   512                      includes="@{includes}">
   513                     <manifest>
   514                         <attribute name="Main-Class" value="@{jarmainclass}"/>
   515                         <attribute name="Class-Path" value="@{jarclasspath}"/>
   516                     </manifest>
   517                 </jar>
   518             </sequential>
   519         </macrodef>
   520     </target>
   522     <target name="-def-build-classes" depends="-def-pcompile">
   523         <macrodef name="build-classes">
   524             <attribute name="includes"/>
   525             <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
   526             <attribute name="classes.dir" default="${build.classes.dir}"/>
   527             <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
   528             <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
   529             <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
   530             <attribute name="classpath" default="${javac.classpath}"/>
   531             <attribute name="sourcepath" default="${javac.sourcepath}"/>
   532             <attribute name="java.home" default="${boot.java.home}"/>
   533             <attribute name="source" default="${javac.source}"/>
   534             <attribute name="target" default="${javac.target}"/>
   535             <attribute name="release" default="${release}"/>
   536             <attribute name="full.version" default="${full.version}"/>
   537             <sequential>
   538                 <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
   539                 <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
   540                 <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
   541                 <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
   542                 <mkdir dir="@{gensrc.dir}"/>
   543                 <mkdir dir="@{classes.dir}"/>
   544                 <pcompile srcdir="${src.classes.dir}"
   545                           destdir="@{gensrc.dir}"
   546                           includes="@{includes}"/>
   547                 <copy todir="@{gensrc.dir}">
   548                     <fileset dir="${src.classes.dir}" includes="@{includes}"/>
   549                     <globmapper from="*.properties-template" to="*.properties"/>
   550                     <filterset begintoken="$(" endtoken=")">
   551                         <filter token="JDK_VERSION" value="${jdk.version}"/>
   552                         <filter token="RELEASE" value="@{release}"/>
   553                         <filter token="FULL_VERSION" value="@{full.version}"/>
   554                     </filterset>
   555                 </copy>
   556                 <pcompile srcdir="@{gensrc.dir}"
   557                           destdir="@{gensrc.dir}"
   558                           includes="**/*.properties"/>
   559                 <javac fork="true"
   560                        executable="@{java.home}/bin/javac"
   561                        srcdir="${src.classes.dir}:@{gensrc.dir}"
   562                        destdir="@{classes.dir}"
   563                        includes="@{includes}"
   564                        excludes="@{excludes}"
   565                        sourcepath="@{sourcepath}"
   566                        classpath="@{classpath}"
   567                        includeAntRuntime="no"
   568                        source="@{source}"
   569                        target="@{target}"
   570                        debug="${javac.debug}"
   571                        debuglevel="${javac.debuglevel}">
   572                     <compilerarg value="-implicit:none"/>
   573                     <compilerarg value="-Xprefer:source"/>
   574                     <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
   575                     <compilerarg line="@{bootclasspath.opt}"/>
   576                     <compilerarg line="${javac.no.jdk.warnings}"/>
   577                     <compilerarg line="${javac.version.opt}"/>
   578                     <compilerarg line="${javac.lint.opts}"/>
   579                 </javac>
   580                 <copy todir="@{classes.dir}" includeemptydirs="false">
   581                     <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
   582                         <exclude name="**/*.java"/>
   583                         <exclude name="**/*.properties"/>
   584                         <exclude name="**/*-template"/>
   585                         <exclude name="**/package.html"/>
   586                     </fileset>
   587                 </copy>
   588             </sequential>
   589         </macrodef>
   590     </target>
   592     <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
   593         <presetdef name="build-bootstrap-tool">
   594             <build-tool
   595                 bin.dir="${build.bootstrap.dir}/bin"
   596                 java="${boot.java}"/>
   597         </presetdef>
   598     </target>
   600     <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
   601         <presetdef name="build-bootstrap-jar">
   602             <build-jar
   603                 classes.dir="${build.bootstrap.dir}/classes"
   604                 lib.dir="${build.bootstrap.dir}/lib"/>
   605         </presetdef>
   606     </target>
   608     <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
   609         <presetdef name="build-bootstrap-classes">
   610             <build-classes
   611                 source="${boot.javac.source}"
   612                 target="${boot.javac.target}"
   613                 gensrc.dir="${build.bootstrap.dir}/gensrc"
   614                 classes.dir="${build.bootstrap.dir}/classes"
   615                 javac.bootclasspath=""
   616                 bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
   617                 sourcepath=""
   618                 release="${bootstrap.release}"
   619                 full.version="${bootstrap.full.version}"
   620                 excludes="${require.import.jdk.files} **/package-info.java"/>
   621         </presetdef>
   622     </target>
   624     <target name="-def-pcompile">
   625         <mkdir dir="${build.toolclasses.dir}"/>
   626         <javac fork="true"
   627                source="${boot.javac.source}"
   628                target="${boot.javac.target}"
   629                executable="${boot.java.home}/bin/javac"
   630                srcdir="${make.tools.dir}/CompileProperties"
   631                destdir="${build.toolclasses.dir}/"
   632                classpath="${ant.home}/lib/ant.jar"/>
   633         <taskdef name="pcompile"
   634                  classname="CompilePropertiesTask"
   635                  classpath="${build.toolclasses.dir}/"/>
   636     </target>
   638     <target name="-def-genstubs" depends="build-bootstrap-javac">
   639         <mkdir dir="${build.toolclasses.dir}"/>
   640         <javac fork="true"
   641                source="${boot.javac.source}"
   642                target="${boot.javac.target}"
   643                executable="${boot.java.home}/bin/javac"
   644                srcdir="${make.tools.dir}/GenStubs"
   645                destdir="${build.toolclasses.dir}/"
   646                classpath="${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"/>
   647         <taskdef name="genstubs"
   648                  classname="GenStubs$$Ant"
   649                  classpath="${build.toolclasses.dir}/"/>
   650     </target>
   652     <target name="-def-javadoc-tool" depends="-check-target.java.home">
   653         <macrodef name="javadoc-tool">
   654             <attribute name="name"/>
   655             <attribute name="includes"/>
   656             <attribute name="options" default=""/>
   657             <attribute name="source" default="1.5"/> <!-- FIXME -->
   658             <sequential>
   659                 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
   660                 <!-- Note: even with this default value, includes
   661          from src.classes.dir get javadoc'd; see packageset below -->
   662                 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
   663                 <javadoc
   664                     executable="${target.java.home}/bin/javadoc"
   665                     destdir="${build.javadoc.dir}/@{name}"
   666                     source="@{source}"
   667                     windowtitle="UNOFFICIAL"
   668                     failonerror="true"
   669                     use="true"
   670                     author="false"
   671                     version="false"
   672                     packagenames="${javadoc.packagenames}" >
   673                     <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
   674                     <arg line="@{options}"/>
   675                     <bootclasspath>
   676                         <path location="${build.classes.dir}"/>
   677                         <path location="${target.java.home}/jre/lib/rt.jar"/>
   678                     </bootclasspath>
   679                     <sourcepath>
   680                         <pathelement location="${src.classes.dir}"/>
   681                     </sourcepath>
   682                     <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
   683                     <!-- means that {@link some.package} will not work, which is no good. -->
   684                     <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
   685                     <!-- which also causes duplicates in the class index for included files.) -->
   686                     <packageset dir="${src.classes.dir}" includes="@{includes}">
   687                         <or>
   688                             <filename name="java/"/>
   689                             <filename name="javax/"/>
   690                             <filename name="com/sun/javadoc/"/>
   691                             <filename name="com/sun/mirror/"/>
   692                             <filename name="com/sun/source/"/>
   693                         </or>
   694                     </packageset>
   695                 </javadoc>
   696             </sequential>
   697         </macrodef>
   698     </target>
   700     <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
   701         <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
   702             <classpath>
   703                 <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
   704                 <pathelement location="${jtreg.home}/lib/javatest.jar"/>
   705             </classpath>
   706         </taskdef>
   707         <macrodef name="jtreg-tool">
   708             <attribute name="name"/>
   709             <attribute name="tests"/>
   710             <attribute name="jdk" default="${target.java.home}"/>
   711             <attribute name="samevm" default="true"/>
   712             <attribute name="verbose" default="summary"/>
   713             <attribute name="options" default=""/>
   714             <attribute name="keywords" default="-keywords:!ignore"/>
   715             <attribute name="jpda.jvmargs" default=""/>
   716             <sequential>
   717                 <property name="coverage.options" value=""/>    <!-- default -->
   718                 <property name="coverage.classpath" value=""/>    <!-- default -->
   719                 <jtreg
   720                     dir="${test.dir}"
   721                     workDir="${build.jtreg.dir}/@{name}/work"
   722                     reportDir="${build.jtreg.dir}/@{name}/report"
   723                     jdk="@{jdk}"
   724                     samevm="@{samevm}" verbose="@{verbose}"
   725                     failonerror="false" resultproperty="jtreg.@{name}.result"
   726                     javacoptions="-g"
   727                     vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}:${build.classes.dir} @{jpda.jvmargs}">
   728                     <arg line="@{keywords}"/>
   729                     <arg line="@{options}"/>
   730                     <arg line="@{tests}"/>
   731                 </jtreg>
   732                 <!-- the next two properties are for convenience, when only
   733                      a single instance of jtreg will be invoked. -->
   734                 <condition property="jtreg.passed">
   735                     <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
   736                 </condition>
   737                 <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
   738             </sequential>
   739         </macrodef>
   740         <property name="jtreg.defined" value="true"/>
   741     </target>
   743     <target name="-def-cobertura" depends="-check-cobertura.home">
   744         <path id="cobertura.classpath">
   745             <fileset dir="${cobertura.home}">
   746                 <include name="cobertura.jar"/>
   747                 <include name="lib/**/*.jar"/>
   748             </fileset>
   749         </path>
   750         <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
   751     </target>
   753     <target name="-def-findbugs" unless="findbugs.defined" depends="-check-findbugs.home">
   754         <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
   755             <classpath>
   756                 <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
   757             </classpath>
   758         </taskdef>
   759         <macrodef name="findbugs-tool">
   760             <attribute name="name"/>
   761             <attribute name="output" default="emacs"/>
   762             <attribute name="outputFile" default=""/>
   763             <attribute name="reportLevel" default="high"/>
   764             <sequential>
   765                 <findbugs
   766                     home="${findbugs.home}"
   767                     output="@{output}"
   768                     outputFile="@{outputFile}"
   769                     reportLevel="@{reportLevel}"
   770                     failOnError="false"
   771                     errorProperty="findbugs.@{name}.errors"
   772                     warningsProperty="findbugs.@{name}.warnings"
   773                     jvmargs="-Xmx512M" >
   774                     <class location="${dist.dir}/lib/@{name}.jar"/>
   775                     <auxClasspath>
   776                         <pathelement location="${build.classes.dir}"/>
   777                     </auxClasspath>
   778                     <sourcePath>
   779                         <pathelement location="${src.classes.dir}"/>
   780                     </sourcePath>
   781                 </findbugs>
   782             </sequential>
   783         </macrodef>
   784         <property name="findbugs.defined" value="true"/>
   785     </target>
   787     <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
   788 	<taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
   789         <property name="vizant.defined" value="true"/>
   790     </target>
   792     <target name="-def-check">
   793         <macrodef name="check">
   794             <attribute name="name"/>
   795             <attribute name="property"/>
   796             <attribute name="marker" default=""/>
   797             <sequential>
   798                 <fail message="Cannot locate @{name}: please set @{property} to its location">
   799                     <condition>
   800                         <not>
   801                             <isset property="@{property}"/>
   802                         </not>
   803                     </condition>
   804                 </fail>
   805                 <fail message="@{name} is not installed in ${@{property}}">
   806                     <condition>
   807 			<and>
   808 			    <not>
   809 				<equals arg1="@{marker}" arg2=""/>
   810 			    </not>
   811                             <not>
   812                                 <available file="${@{property}}/@{marker}"/>
   813                             </not>
   814 			</and>
   815                     </condition>
   816                 </fail>
   817             </sequential>
   818         </macrodef>
   819     </target>
   821     <!-- standard JDK target -->
   822     <target name="sanity"
   823         description="display settings of configuration values">
   824         <echo level="info">ant.home = ${ant.home}</echo>
   825         <echo level="info">boot.java.home = ${boot.java.home}</echo>
   826         <echo level="info">target.java.home = ${target.java.home}</echo>
   827         <echo level="info">jtreg.home = ${jtreg.home}</echo>
   828         <echo level="info">findbugs.home = ${findbugs.home}</echo>
   829     </target>
   831     <!-- useful debugging targets -->
   832     <target name="diagnostics">
   833         <diagnostics/>
   834     </target>
   836     <target name="post-sanity" depends="-def-jtreg,sanity,build"
   837         description="perform basic validation after a standard build">
   838         <jtreg
   839             dir="make/test"
   840             workDir="${build.jtreg.dir}/post-sanity/work"
   841             reportDir="${build.jtreg.dir}/post-sanity/report"
   842             jdk="${target.java.home}"
   843             verbose="summary"
   844             failonerror="false" resultproperty="jtreg.post-sanity.result">
   845         </jtreg>
   847     </target>
   848 </project>

mercurial