build.xml 52.8 KB
Newer Older
D
duke 已提交
1 2
<?xml version="1.0" encoding="UTF-8"?>
<!--
3
 Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
4 5 6 7
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 This code is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License version 2 only, as
8
 published by the Free Software Foundation.  Oracle designates this
D
duke 已提交
9
 particular file as subject to the "Classpath" exception as provided
10
 by Oracle in the LICENSE file that accompanied this code.
D
duke 已提交
11 12 13 14 15 16 17 18 19 20 21

 This code is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 version 2 for more details (a copy is included in the LICENSE file that
 accompanied this code).

 You should have received a copy of the GNU General Public License version
 2 along with this work; if not, write to the Free Software Foundation,
 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

22 23 24
 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 or visit www.oracle.com if you need additional information or have any
 questions.
D
duke 已提交
25 26 27
-->

<!--
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
 This is the main build file for the complete langtools repository.
 It is used when building JDK (in which case it is invoked from the
 Makefile), and it can be used when working on the tools themselves,
 in an IDE such as NetBeans.

 External dependencies are specified via properties. These can be given
 on the command line, or by providing a local build.properties file.
 (They can also be edited into make/build.properties, although that is not
 recommended.)  At a minimum, boot.java.home must be set to the installed
 location of the version of JDK used to build this repository. Additional
 properties may be required, depending on the targets that are built.
 For example, to run any of the jtreg tests you must set jtreg.home,
 to run findbugs on the code you must set findbugs.home, and so on.

 For the most part, javac can be built using the previous version of JDK.
 However, a small number of javac files require access to the latest JDK,
 which may not yet have been compiled. To compile these files, you can do
 one of the following:
 - Set boot.java.home to a recent build of the latest version of JDK.
 - Set import.jdk to either a recent build (containing jre/lib/rt.jar)
   or to jdk source repository.  In the latter case, stub files will
   automatically be generated and used for the required API, to avoid
   unnecessary compilation of the source repository.
 If you do neither, the relevant files will not be built.

 The main build happens in two phases:
 - First, javac and other tools as needed are built using ${boot.java.home}.
   (This implies a constraint on the source code that they can be compiled
   with the previous version of JDK.
 - Second, all required classes are compiled with the latest javac, created
   in the previous step.
 The first phase is called the bootstrap phase. All targets, properties and
 tasks that are specific to that phase have "bootstrap" in their name.

 For more details on the JDK build, see
    http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build
    http://openjdk.java.net/groups/build/
 For more details on the stub generator, see
    http://blogs.sun.com/jjg/entry/building_javac_for_jdk7

 Internal details ...

 Interim build products are created in the build/ directory.
 Final build products are created in the dist/ directory.
 When building JDK, the dist/directory will contain:
 - A bootstrap compiler suitable for running with ${boot.java.home}
   suitable for compiling downstream parts of JDK
 - Source files and class files for inclusion in the JDK being built
 When building standalone, the dist/directory will contain:
 - Separate jar files for each of the separate langtools components
 - Simple scripts to invoke the tools by executing the corresponding
   jar files.
 These jar files and scripts are "for developer use only".

 This file is organized into sections as follows:
 - global property definitions
 - general top level targets
 - general diagnostic/debugging targets
86
 - groups of targets for each tool: javac, javadoc, doclets, javah, javap
87 88 89 90 91 92 93 94
    Within each group, the following targets are provided, where applicable
      build-bootstrap-TOOL      build the bootstrap version of the tool
      build-classes-TOOL        build the classes for the tool
      build-TOOL                build the jar file and script for the tool
      jtreg-TOOL                build the tool and run the appropriate tests
      findbugs-TOOL             run findbugs on the tool's source oode
      TOOL                      build the tool, run the tests, and run findbugs
 - utility definitions
D
duke 已提交
95 96 97
 -->

<project name="langtools" default="build" basedir="..">
98 99 100
    <!--
    **** Global property definitions.
    -->
101

102 103 104 105 106 107 108
    <!-- Force full debuginfo for javac if the debug.classfiles
    property is set.  This must be BEFORE the include of
    build.properties because it sets javac.debuglevel.  -->
    <condition property="javac.debuglevel" value="source,lines,vars">
        <equals arg1="${debug.classfiles}" arg2="true"/>
    </condition>

D
duke 已提交
109 110 111 112 113 114 115 116 117 118
    <!-- The following locations can be used to override default property values. -->

    <!-- Use this location for customizations specific to this instance of this workspace -->
    <property file="build.properties"/>

    <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
    <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>

    <!-- Use this location for customizations common to all OpenJDK workspaces -->
    <property file="${user.home}/.openjdk/build.properties"/>
119 120

    <!-- Convenient shorthands for standard locations within the workspace. -->
D
duke 已提交
121 122 123 124 125
    <property name="build.dir" location="build"/>
    <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
    <property name="build.coverage.dir" location="${build.dir}/coverage"/>
    <property name="build.classes.dir" location="${build.dir}/classes"/>
    <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
126
    <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
D
duke 已提交
127 128 129 130 131 132 133
    <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
    <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
    <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
    <property name="dist.dir" location="dist"/>
    <property name="dist.bin.dir" location="${dist.dir}/bin"/>
    <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
    <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
134
    <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/>
D
duke 已提交
135 136
    <property name="dist.lib.dir" location="${dist.dir}/lib"/>
    <property name="make.dir" location="make"/>
137
    <property name="make.conf.dir" location="${make.dir}/conf"/>
D
duke 已提交
138 139 140 141 142 143 144 145 146 147
    <property name="make.tools.dir" location="${make.dir}/tools"/>
    <property name="src.dir" location="src"/>
    <property name="src.bin.dir" location="${src.dir}/share/bin"/>
    <property name="src.classes.dir" location="${src.dir}/share/classes"/>
    <property name="test.dir" location="test"/>

    <!-- java.marker is set to a marker file to check for within a Java install dir.
         The best file to check for across Solaris/Linux/Windows/MacOS is one of the
         executables; regrettably, that is OS-specific. -->
    <condition property="java.marker" value="bin/java">
148
        <os family="unix"/>
D
duke 已提交
149 150
    </condition>
    <condition property="java.marker" value="bin/java.exe">
151
        <os family="windows"/>
D
duke 已提交
152
    </condition>
153

D
duke 已提交
154
    <!-- Standard property values, if not overriden by earlier settings. -->
155
    <property file="${make.dir}/build.properties"/>
J
jjg 已提交
156 157

    <!-- launcher.java is used in the launcher scripts provided to run
158 159 160 161 162 163
        the tools' jar files.  If it has not already been set, then
        default it to use ${target.java.home}, if available, otherwise
        quietly default to simply use "java". -->
    <condition property="launcher.java"
        value="${target.java.home}/bin/java" else="java">
        <isset property="target.java.home"/>
J
jjg 已提交
164 165
    </condition>

166 167 168 169
    <!-- Logic for handling access import jdk classes, if available.
        import.jdk should be unset, or set to jdk home (to use rt.jar)
        or to jdk repo (to use src/share/classes).
        Based on the value, if any, set up default values for javac's sourcepath,
J
jjg 已提交
170
        classpath and bootclasspath. Note: the default values are overridden
171 172 173 174 175 176 177 178
        in the build-bootstrap-classes macro. -->

    <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
        filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
    <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
        ignoresystemclasses="true"
        classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>

179 180 181 182 183
    <!-- Set the default bootclasspath option used for javac.
        Note that different variants of the option are used, meaning we can't just
        define the value for the option.
        Note the explicit use of the standard property ${path.separator} in the following.
        This is because Ant is not clever enough to handle direct use of : or ; -->
184
    <condition property="javac.bootclasspath.opt"
185
            value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
186 187 188 189
            else="-Xbootclasspath/p:${build.classes.dir}">
        <isset property="import.jdk.jar"/>
    </condition>

190 191 192 193
    <condition property="boot.java.provides.latest.jdk">
        <available
            ignoresystemclasses="true"
            classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
194 195
    </condition>

196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
    <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}">
        <isset property="boot.java.provides.latest.jdk"/>
    </condition>

    <condition property="exclude.files" value="" else="${require.latest.jdk.files}">
        <or>
            <isset property="boot.java.provides.latest.jdk"/>
            <isset property="import.jdk"/>
        </or>
    </condition>

    <condition property="require.import.jdk.stubs">
        <and>
            <not>
                <isset property="boot.java.provides.latest.jdk"/>
            </not>
            <isset property="import.jdk.src.dir"/>
        </and>
    </condition>

    <!-- Set the default value of the sourcepath used for javac. -->
    <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
        <isset property="require.import.jdk.stubs"/>
    </condition>

    <!-- Set the default value of the classpath used for javac. -->
    <property name="javac.classpath" value=""/>


    <!--
    **** General top level targets.
    -->
228

D
duke 已提交
229 230 231 232 233 234 235 236 237 238 239 240 241
    <!-- Standard target to build deliverables for JDK build. -->

    <target name="build" depends="build-bootstrap-tools,build-all-classes">
        <copy todir="${dist.dir}/bootstrap">
            <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
        </copy>
        <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
            <include name="*"/>
        </chmod>
        <mkdir dir="${dist.lib.dir}"/>
        <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
        <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
    </target>
242

243
    <target name="build-bootstrap-tools"
244
        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah,build-bootstrap-sjavac"
245
    />
246

247
    <target name="build-all-tools"
248
        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-sjavac"
249
    />
250

251
    <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
252
        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
253
    </target>
254

D
duke 已提交
255 256 257 258 259 260 261 262 263
    <!-- clean -->

    <target name="clean" description="Delete all generated files">
        <delete dir="${build.dir}"/>
        <delete dir="${dist.dir}"/>
    </target>

    <!-- Additional targets for running tools on the build -->

264 265 266 267
    <target name="jtreg" depends="build-all-tools,-def-jtreg">
        <jtreg-tool name="all" tests="${jtreg.tests}"/>
    </target>

268 269 270 271 272 273 274 275 276 277 278 279
    <target name="checkstyle" depends="-def-checkstyle"
        description="Generates reports for code convention violations.">
        <mkdir dir="${dist.checkstyle.dir}"/>
        <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"
              failureProperty="checkstyle.failure"
              failOnViolation="false">
            <formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/>
            <fileset dir="src" includes="**/*.java, **/*.properties"/>
        </checkstyle>
        <!-- transform the output to a simple html -->
        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
               out="${dist.checkstyle.dir}/checkstyle_report.html"
280
               style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
        <!-- transform the output to a very simple emacs friendly text file -->
        <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
               out="${dist.checkstyle.dir}/checkstyle_report.tmp"
               style="${make.conf.dir}/checkstyle-emacs.xsl"/>
        <!-- beautify remove extra lines -->
        <move file="${dist.checkstyle.dir}/checkstyle_report.tmp"
             toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt">
            <filterchain>
                <ignoreblank/>
                <replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/>
            </filterchain>
        </move>
    </target>
    <!-- target can be invoked from an ide, the output of which can be used
         to access and fix the errors directly.
     -->
    <target name="checkstyle-ide" depends="checkstyle">
        <concat>
            <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/>
300
        </concat>
301
    </target>
302

D
duke 已提交
303 304 305 306 307 308 309 310 311 312 313 314
    <target name="findbugs" depends="-def-findbugs,build-all-tools">
        <property name="findbugs.reportLevel" value="medium"/>
        <mkdir dir="${dist.findbugs.dir}"/>
        <findbugs
            home="${findbugs.home}"
            projectName="JDK langtools ${full.version}"
            output="xml"
            outputFile="${dist.findbugs.dir}/findbugs.xml"
            reportLevel="${findbugs.reportLevel}"
            failOnError="false"
            errorProperty="findbugs.all.errors"
            warningsProperty="findbugs.all.warnings"
315
            jvm="${target.java.home}/bin/java"
D
duke 已提交
316 317 318 319 320 321 322 323 324 325 326 327
            jvmargs="-Xmx512M">
            <class location="${build.classes.dir}"/>
            <sourcePath>
                <pathelement location="${src.classes.dir}"/>
            </sourcePath>
        </findbugs>
        <exec executable="sh">
            <arg value="${findbugs.home}/bin/convertXmlToText"/>
            <arg value="-longBugCodes"/>
            <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
            <arg value="${dist.findbugs.dir}/findbugs.xml"/>
            <redirector output="${dist.findbugs.dir}/findbugs.html"/>
328
        </exec>
D
duke 已提交
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
    </target>

    <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>

    <target name="instrument-classes" depends="-def-cobertura">
        <!-- only define the following property when we want coverage info -->
        <path id="coverage.classpath">
            <pathelement location="${build.coverage.dir}/classes"/>
            <path refid="cobertura.classpath"/>
        </path>
        <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
        <property name="coverage.classpath" refid="coverage.classpath"/>
        <mkdir dir="${build.coverage.dir}/classes"/>
        <delete file="${build.coverage.dir}/cobertura.ser"/>
        <cobertura-instrument todir="${build.coverage.dir}/classes"
            datafile="${build.coverage.dir}/cobertura.ser">
345
            <fileset dir="${build.classes.dir}"
D
duke 已提交
346 347
               includes="**/*.class" excludes="**/resources/*.class"/>
        </cobertura-instrument>
348
    </target>
D
duke 已提交
349 350 351

    <target name="coverage-report" depends="-def-cobertura">
        <mkdir dir="${dist.coverage.dir}"/>
352
        <cobertura-report
D
duke 已提交
353 354 355
            srcdir="${src.classes.dir}"
            destdir="${dist.coverage.dir}"
            datafile="${build.coverage.dir}/cobertura.ser"/>
356 357 358
        <cobertura-report
            format="xml"
            srcdir="${src.classes.dir}"
D
duke 已提交
359 360 361
            destdir="${dist.coverage.dir}"
            datafile="${build.coverage.dir}/cobertura.ser"/>
    </target>
362

363 364 365 366 367 368 369 370
    <target name="diags-examples" depends="build-javac">
        <!-- can override the following on the command line if desired. -->
        <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
        <mkdir dir="${build.dir}/diag-examples/classes"/>
        <javac fork="true"
            executable="${dist.bin.dir}/javac"
            srcdir="test/tools/javac/diags"
            destdir="${build.dir}/diag-examples/classes"
371
            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
372 373 374 375
            sourcepath=""
            classpath="${dist.lib.dir}/javac.jar"
            includeAntRuntime="no"
            debug="${javac.debug}"
J
jjg 已提交
376 377 378
            debuglevel="${javac.debuglevel}">
            <compilerarg line="${javac.lint.opts}"/>
        </javac>
379 380 381 382 383
        <java fork="true"
            jvm="${target.java.home}/bin/java"
            dir="test/tools/javac/diags"
            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
            classname="RunExamples">
384
            <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
385 386 387 388 389 390 391 392 393 394
            <arg value="-examples"/>
            <arg value="examples"/>
            <arg value="-o"/>
            <arg file="${diags.examples.out}"/>
            <arg value="-showFiles"/>
            <arg value="-title"/>
            <arg value="Examples of javac diagnostics"/>
        </java>
    </target>

395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
    <!-- a patching facility to speed up incorporating the langtools' classfiles
         into a jdk of your choice. Either target.java.home or patch.jdk can be
         set on the command line; setting target.java.home has the advantage of
         patching the jdk used for jtreg and other tests.
    -->
    <target name="patch" depends="build-all-classes">
        <condition property="patch.jdk" value="${target.java.home}">
            <available file="${target.java.home}" type="dir"/>
        </condition>
        <fail message="patch.jdk or target.java.home is not set, please set target.java.home, or patch.jdk for an alternate jdk image to patch">
            <condition>
                <not>
                    <isset property="patch.jdk"/>
                </not>
            </condition>
        </fail>
        <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/>
        <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/>
        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar">
            <condition>
                <not>
                    <available file="${patch.tools.jar}" type="file"/>
                </not>
            </condition>
        </fail>
        <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar">
            <condition>
                <not>
                    <available file="${patch.rt.jar}" type="file"/>
                </not>
            </condition>
        </fail>
        <zip zipfile="${patch.tools.jar}" update="true">
            <zipfileset dir="${build.classes.dir}" includes="com/**"/>
        </zip>
        <zip zipfile="${patch.rt.jar}" update="true">
            <zipfileset dir="${build.classes.dir}" includes="javax/**"/>
        </zip>
    </target>
434

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
    <target name="doclint-api" depends="build-all-classes">
        <delete dir="${build.dir}/doclint/classes"/>
        <mkdir dir="${build.dir}/doclint/classes"/>
        <javac fork="true"
               executable="${boot.javac}"
               srcdir="${src.classes.dir}:${build.gensrc.dir}"
               destdir="${build.dir}/doclint/classes"
               includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**"
               excludes=""
               sourcepath="${javac.sourcepath}"
               classpath="${javac.classpath}"
               includeAntRuntime="no"
               source="${javac.source}"
               target="${javac.target}"
               debug="${javac.debug}"
               debuglevel="${javac.debuglevel}">
            <compilerarg value="-implicit:none"/>
            <compilerarg value="-Xprefer:source"/>
            <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
            <compilerarg line="${javac.no.jdk.warnings}"/>
            <compilerarg line="${javac.version.opt}"/>
            <compilerarg line="-Xdoclint:all/protected,-missing"/>
        </javac>
    </target>

460 461 462 463 464 465 466 467 468 469 470 471
    <!--
    **** Debugging/diagnostic targets.
    -->

    <!-- standard JDK target -->
    <target name="sanity"
        description="display settings of configuration values">
        <echo level="info">ant.home = ${ant.home}</echo>
        <echo level="info">boot.java.home = ${boot.java.home}</echo>
        <echo level="info">target.java.home = ${target.java.home}</echo>
        <echo level="info">jtreg.home = ${jtreg.home}</echo>
        <echo level="info">findbugs.home = ${findbugs.home}</echo>
472
        <echo level="info">checkstyle.home = ${checkstyle.home}</echo>
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
    </target>

    <target name="post-sanity" depends="-def-jtreg,sanity,build"
        description="perform basic validation after a standard build">
        <jtreg
            dir="make/test"
            workDir="${build.jtreg.dir}/post-sanity/work"
            reportDir="${build.jtreg.dir}/post-sanity/report"
            jdk="${target.java.home}"
            verbose="summary"
            failonerror="false" resultproperty="jtreg.post-sanity.result">
        </jtreg>
    </target>

    <!-- use vizant tool to generate graphical image of this Ant file.-->
    <target name="vizant" depends="-def-vizant">
        <mkdir dir="${build.dir}"/>
        <echo message="Generating ${build.dir}/build.dot"/>
        <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/>
        <echo message="Generating ${build.dir}/build.png"/>
        <exec executable="${dot}" >
            <arg value="-Tpng"/>
            <arg value="-o"/>
            <arg file="${build.dir}/build.png"/>
            <arg file="${build.dir}/build.dot"/>
        </exec>
    </target>

    <target name="check-import.jdk">
        <echo message="import.jdk: ${import.jdk}"/>
        <echo message="import.jdk.jar: ${import.jdk.jar}"/>
        <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
    </target>

    <target name="diagnostics">
        <diagnostics/>
    </target>


    <!--
    **** javac targets.
    -->
D
duke 已提交
515

516 517 518 519 520
    <target name="build-bootstrap-javac"
            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
        <build-bootstrap-classes includes="${javac.includes}"/>
        <build-bootstrap-jar     name="javac" includes="${javac.includes}"/>
        <build-bootstrap-tool    name="javac"/>
D
duke 已提交
521
    </target>
522

523
    <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
524
        <build-classes includes="${javac.includes}"/>
D
duke 已提交
525
    </target>
526

527 528 529
    <target name="build-javac" depends="build-classes-javac">
        <build-jar  name="javac" includes="${javac.includes}"/>
        <build-tool name="javac"/>
D
duke 已提交
530
    </target>
531

D
duke 已提交
532
    <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
533
        <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls.option}"/>
D
duke 已提交
534
    </target>
535

536
    <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
537
        <jtreg-tool name="javac" tests="${javac.tests}"/>
D
duke 已提交
538
    </target>
539

D
duke 已提交
540 541 542
    <target name="findbugs-javac" depends="build-javac,-def-findbugs">
        <findbugs-tool name="javac"/>
    </target>
543

D
duke 已提交
544
    <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
545

546 547 548 549

    <!--
    **** javadoc targets.
    -->
D
duke 已提交
550 551

    <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
552 553 554 555
        <build-bootstrap-classes includes="${javadoc.includes}"/>
        <build-bootstrap-jar     name="javadoc" includes="${javadoc.includes}"
                                 jarclasspath="javac.jar doclets.jar"/>
        <build-bootstrap-tool    name="javadoc"/>
D
duke 已提交
556
    </target>
557

D
duke 已提交
558
    <target name="build-classes-javadoc" depends="build-classes-javac">
559
        <build-classes includes="${javadoc.includes}"/>
D
duke 已提交
560
    </target>
561

562 563
    <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
        <build-jar  name="javadoc" includes="${javadoc.includes}"
D
duke 已提交
564
                    jarclasspath="javac.jar doclets.jar"/>
565
        <build-tool name="javadoc"/>
D
duke 已提交
566
    </target>
567

D
duke 已提交
568 569 570
    <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
        <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
    </target>
571

D
duke 已提交
572
    <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
573
        <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
D
duke 已提交
574
    </target>
575

D
duke 已提交
576 577 578
    <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
        <findbugs-tool name="javadoc"/>
    </target>
579

D
duke 已提交
580
    <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
581

582 583 584 585

    <!--
    **** doclets targets.
    -->
D
duke 已提交
586 587

    <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
588 589 590 591
        <build-bootstrap-classes includes="${doclets.includes}"/>
        <build-bootstrap-jar     name="doclets" includes="${doclets.includes}"
                                 jarmainclass="com.sun.tools.javadoc.Main"
                                 jarclasspath="javadoc.jar"/>
D
duke 已提交
592
    </target>
593

D
duke 已提交
594
    <target name="build-classes-doclets" depends="build-classes-javadoc">
595
        <build-classes includes="${doclets.includes}"/>
D
duke 已提交
596
    </target>
597

598
    <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
D
duke 已提交
599
        <!-- just jar, no bin for doclets -->
600
        <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
D
duke 已提交
601 602 603
    </target>

    <!-- (no javadoc for doclets) -->
604

D
duke 已提交
605
    <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
606
        <jtreg-tool name="doclets" tests="${doclets.tests}"/>
D
duke 已提交
607
    </target>
608

D
duke 已提交
609 610 611
    <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
        <findbugs-tool name="doclets"/>
    </target>
612

D
duke 已提交
613
    <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
614

615 616 617 618

    <!--
    **** javah targets.
    -->
D
duke 已提交
619 620

    <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
621 622 623 624
        <build-bootstrap-classes includes="${javah.includes}"/>
        <build-bootstrap-jar     name="javah" includes="${javah.includes}"
                                 jarclasspath="javadoc.jar doclets.jar javac.jar"/>
        <build-bootstrap-tool    name="javah"/>
D
duke 已提交
625
    </target>
626

627 628 629
    <target name="build-javah" depends="build-javac,build-classes-javah">
        <build-jar  name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
        <build-tool name="javah"/>
D
duke 已提交
630
    </target>
631

D
duke 已提交
632
    <target name="build-classes-javah" depends="build-classes-javadoc">
633
        <build-classes includes="${javah.includes}"/>
D
duke 已提交
634
    </target>
635

D
duke 已提交
636 637 638
    <!-- (no javadoc for javah) -->

    <target name="jtreg-javah" depends="build-javah,-def-jtreg">
639
        <jtreg-tool name="javah" tests="${javah.tests}"/>
D
duke 已提交
640
    </target>
641

D
duke 已提交
642 643 644
    <target name="findbugs-javah" depends="build-javah,-def-findbugs">
        <findbugs-tool name="javah"/>
    </target>
645

D
duke 已提交
646
    <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
647

648 649 650 651

    <!--
    **** javap targets.
    -->
D
duke 已提交
652

653 654 655 656 657 658
    <target name="build-bootstrap-javap"
            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
        <build-bootstrap-classes includes="${javap.includes}"/>
        <build-bootstrap-jar     name="javap" includes="${javap.includes}"
                                 jarmainclass="sun.tools.javap.Main"/>
        <build-bootstrap-tool    name="javap"/>
D
duke 已提交
659
    </target>
660

661
    <target name="build-classes-javap" depends="build-classes-javac">
662
        <build-classes includes="${javap.includes}"/>
D
duke 已提交
663
    </target>
664

665 666
    <target name="build-javap" depends="build-javac,build-classes-javap">
        <build-jar  name="javap" includes="${javap.includes}"
J
jjg 已提交
667
                    jarmainclass="com.sun.tools.javap.Main"
668
                    jarclasspath="javac.jar"/>
669
        <build-tool name="javap"/>
D
duke 已提交
670
    </target>
671

D
duke 已提交
672 673 674
    <!-- (no javadoc for javap) -->

    <target name="jtreg-javap" depends="build-javap,-def-jtreg">
675
        <jtreg-tool name="javap" tests="${javap.tests}"/>
D
duke 已提交
676
    </target>
677

D
duke 已提交
678 679 680
    <target name="findbugs-javap" depends="build-javap,-def-findbugs">
        <findbugs-tool name="javap"/>
    </target>
681

D
duke 已提交
682
    <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
683

684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
    <!--
    **** sjavac targets.
    -->

    <target name="build-bootstrap-sjavac"
            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
        <build-bootstrap-classes includes="${sjavac.includes}"/>
        <build-bootstrap-jar     name="sjavac" includes="${sjavac.includes}"
                                 jarmainclass="com.sun.tools.sjavac.Main"/>
        <build-bootstrap-tool    name="sjavac"/>
    </target>

    <target name="build-classes-sjavac" depends="build-classes-javac">
        <build-classes includes="${sjavac.includes}"/>
    </target>

    <target name="build-sjavac" depends="build-classes-sjavac">
        <build-jar  name="sjavac" includes="${sjavac.includes}"
                    jarmainclass="com.sun.tools.sjavac.Main"
                    jarclasspath="sjavac.jar"/>
        <build-tool name="sjavac"/>
    </target>
706

707 708 709 710 711 712 713 714 715 716 717
    <!-- (no javadoc for javap) -->

    <target name="jtreg-sjavac" depends="build-sjavac,-def-jtreg">
        <jtreg-tool name="sjavac" tests="${sjavac.tests}"/>
    </target>

    <target name="findbugs-sjavac" depends="build-sjavac,-def-findbugs">
        <findbugs-tool name="sjavac"/>
    </target>

    <target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/>
718

719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741
    <!--
    **** crules targets.
    -->

    <target name="build-crules" depends="-def-compilecrules,-def-build-jar-with-services">
        <compilecrules/>
        <build-jar-with-services
                    name="crules"
                    includes="crules/* crules/resources/*"
                    classes.dir="${build.toolclasses.dir}"
                    lib.dir="${build.toolclasses.dir}"
                    jarmainclass=""
                    jarclasspath="crules.jar"
                    service.type="com.sun.source.util.Plugin"
                    service.provider="crules.MutableFieldsAnalyzer"/>
        <build-tool name="crules"/>
    </target>

    <target name="check-coding-rules" depends="build-bootstrap-javac,-create-import-jdk-stubs,build-crules">
        <build-classes includes="${javac.includes}"
            plugin.options="-J-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar -Xplugin:mutable_fields_analyzer" />
    </target>

742 743 744 745 746
    <!--
    **** Create import JDK stubs.
    -->

    <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
747 748 749 750
        <mkdir dir="${build.genstubs.dir}"/>
        <genstubs
            srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
            includes="${import.jdk.stub.files}"
751
            fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"
752 753 754
        />
    </target>

755 756 757 758 759 760

    <!--
    **** Check targets.
    **** "-check-*" targets check that a required property is set, and set to a reasonable value.
    **** A user friendly message is generated if not, and the build exits.
    -->
761

D
duke 已提交
762 763 764
    <target name="-check-boot.java.home" depends="-def-check">
        <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
    </target>
765

D
duke 已提交
766 767 768
    <target name="-check-target.java.home" depends="-def-check">
        <check name="target java" property="target.java.home" marker="${java.marker}"/>
    </target>
769

D
duke 已提交
770 771 772
    <target name="-check-cobertura.home" depends="-def-check">
        <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
    </target>
773

D
duke 已提交
774 775 776
    <target name="-check-findbugs.home" depends="-def-check">
        <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
    </target>
777

778 779 780
    <target name="-check-checkstyle.home" depends="-def-check">
        <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
    </target>
781

D
duke 已提交
782 783 784
    <target name="-check-jtreg.home" depends="-def-check">
        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
    </target>
785

786 787 788 789 790
    <target name="-check-vizant" depends="-def-check">
        <check name="vizant" property="vizant.jar"/>
        <check name="dot" property="dot"/>
    </target>

791 792 793 794

    <!--
    **** Targets for Ant macro and task definitions.
    -->
D
duke 已提交
795

796
    <target name="-def-build-tool">
D
duke 已提交
797 798 799
        <macrodef name="build-tool">
            <attribute name="name"/>
            <attribute name="bin.dir" default="${dist.bin.dir}"/>
J
jjg 已提交
800
            <attribute name="java" default="${launcher.java}"/>
D
duke 已提交
801 802 803 804
            <sequential>
                <mkdir dir="@{bin.dir}"/>
                <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
                    <filterset begintoken="#" endtoken="#">
805 806
                        <filter token="PROGRAM" value="@{name}"/>
                        <filter token="TARGET_JAVA" value="@{java}"/>
807
                        <filter token="PS" value="${path.separator}"/>
D
duke 已提交
808 809 810 811 812 813 814
                    </filterset>
                </copy>
                <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
            </sequential>
        </macrodef>
    </target>

815
    <target name="-def-build-jar">
D
duke 已提交
816 817 818 819 820 821 822 823 824 825 826 827
        <macrodef name="build-jar">
            <attribute name="name"/>
            <attribute name="includes"/>
            <attribute name="classes.dir" default="${build.classes.dir}"/>
            <attribute name="lib.dir" default="${dist.lib.dir}"/>
            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
            <attribute name="jarclasspath" default=""/>
            <sequential>
                <mkdir dir="@{lib.dir}"/>
                <jar destfile="@{lib.dir}/@{name}.jar"
                     basedir="@{classes.dir}"
                     includes="@{includes}">
828
                    <manifest>
D
duke 已提交
829 830 831 832 833 834 835 836
                        <attribute name="Main-Class" value="@{jarmainclass}"/>
                        <attribute name="Class-Path" value="@{jarclasspath}"/>
                    </manifest>
                </jar>
            </sequential>
        </macrodef>
    </target>

837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861
    <target name="-def-build-jar-with-services">
        <macrodef name="build-jar-with-services">
            <attribute name="name"/>
            <attribute name="includes"/>
            <attribute name="classes.dir" default="${build.classes.dir}"/>
            <attribute name="lib.dir" default="${dist.lib.dir}"/>
            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
            <attribute name="jarclasspath" default=""/>
            <attribute name="service.type" default=""/>
            <attribute name="service.provider" default=""/>
            <sequential>
                <mkdir dir="${build.toolclasses.dir}"/>
                <jar destfile="@{lib.dir}/@{name}.jar"
                     basedir="@{classes.dir}"
                     includes="@{includes}">
                    <service type="@{service.type}" provider="@{service.provider}"/>
                    <manifest>
                        <attribute name="Main-Class" value="@{jarmainclass}"/>
                        <attribute name="Class-Path" value="@{jarclasspath}"/>
                    </manifest>
                </jar>
            </sequential>
        </macrodef>
    </target>

D
duke 已提交
862 863 864
    <target name="-def-build-classes" depends="-def-pcompile">
        <macrodef name="build-classes">
            <attribute name="includes"/>
865
            <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
D
duke 已提交
866 867
            <attribute name="classes.dir" default="${build.classes.dir}"/>
            <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
868 869 870 871
            <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
            <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
            <attribute name="classpath" default="${javac.classpath}"/>
            <attribute name="sourcepath" default="${javac.sourcepath}"/>
872 873 874
            <attribute name="java.home" default="${boot.java.home}"/>
            <attribute name="source" default="${javac.source}"/>
            <attribute name="target" default="${javac.target}"/>
D
duke 已提交
875 876
            <attribute name="release" default="${release}"/>
            <attribute name="full.version" default="${full.version}"/>
877
            <attribute name="plugin.options" default=""/>
D
duke 已提交
878
            <sequential>
879 880 881 882
                <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
                <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
                <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
                <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
D
duke 已提交
883 884 885 886 887 888
                <mkdir dir="@{gensrc.dir}"/>
                <mkdir dir="@{classes.dir}"/>
                <pcompile srcdir="${src.classes.dir}"
                          destdir="@{gensrc.dir}"
                          includes="@{includes}"/>
                <copy todir="@{gensrc.dir}">
889
                    <fileset dir="${src.classes.dir}" includes="@{includes}"/>
D
duke 已提交
890 891 892 893 894 895 896 897 898 899 900
                    <globmapper from="*.properties-template" to="*.properties"/>
                    <filterset begintoken="$(" endtoken=")">
                        <filter token="JDK_VERSION" value="${jdk.version}"/>
                        <filter token="RELEASE" value="@{release}"/>
                        <filter token="FULL_VERSION" value="@{full.version}"/>
                    </filterset>
                </copy>
                <pcompile srcdir="@{gensrc.dir}"
                          destdir="@{gensrc.dir}"
                          includes="**/*.properties"/>
                <javac fork="true"
901 902
                       executable="@{java.home}/bin/javac"
                       srcdir="${src.classes.dir}:@{gensrc.dir}"
D
duke 已提交
903 904 905
                       destdir="@{classes.dir}"
                       includes="@{includes}"
                       excludes="@{excludes}"
906 907
                       sourcepath="@{sourcepath}"
                       classpath="@{classpath}"
D
duke 已提交
908
                       includeAntRuntime="no"
909 910
                       source="@{source}"
                       target="@{target}"
911
                       debug="${javac.debug}"
D
duke 已提交
912
                       debuglevel="${javac.debuglevel}">
913 914 915 916
                    <compilerarg value="-implicit:none"/>
                    <compilerarg value="-Xprefer:source"/>
                    <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
                    <compilerarg line="@{bootclasspath.opt}"/>
D
duke 已提交
917 918 919
                    <compilerarg line="${javac.no.jdk.warnings}"/>
                    <compilerarg line="${javac.version.opt}"/>
                    <compilerarg line="${javac.lint.opts}"/>
920
                    <compilerarg line="@{plugin.options}"/>
D
duke 已提交
921
                </javac>
J
jjg 已提交
922 923
                <copy todir="@{classes.dir}" includeemptydirs="false">
                    <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
D
duke 已提交
924 925 926
                        <exclude name="**/*.java"/>
                        <exclude name="**/*.properties"/>
                        <exclude name="**/*-template"/>
927 928 929
                        <exclude name="**/*.rej"/>
                        <exclude name="**/*.orig"/>
                        <exclude name="**/overview.html"/>
D
duke 已提交
930 931 932 933 934 935
                        <exclude name="**/package.html"/>
                    </fileset>
                </copy>
            </sequential>
        </macrodef>
    </target>
936

D
duke 已提交
937 938 939 940
    <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
        <presetdef name="build-bootstrap-tool">
            <build-tool
                bin.dir="${build.bootstrap.dir}/bin"
941
                java="${boot.java}"/>
D
duke 已提交
942 943
        </presetdef>
    </target>
944

D
duke 已提交
945 946 947
    <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
        <presetdef name="build-bootstrap-jar">
            <build-jar
948 949 950 951 952 953 954 955 956 957
                classes.dir="${build.bootstrap.dir}/classes"
                lib.dir="${build.bootstrap.dir}/lib"/>
        </presetdef>
    </target>

    <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
        <presetdef name="build-bootstrap-classes">
            <build-classes
                source="${boot.javac.source}"
                target="${boot.javac.target}"
D
duke 已提交
958 959
                gensrc.dir="${build.bootstrap.dir}/gensrc"
                classes.dir="${build.bootstrap.dir}/classes"
960 961 962
                javac.bootclasspath=""
                bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
                sourcepath=""
D
duke 已提交
963
                release="${bootstrap.release}"
964
                full.version="${bootstrap.full.version}"
965
                excludes="${bootstrap.exclude.files} **/package-info.java"/>
D
duke 已提交
966 967
        </presetdef>
    </target>
968

D
duke 已提交
969 970
    <target name="-def-pcompile">
        <mkdir dir="${build.toolclasses.dir}"/>
971
        <javac fork="true"
972 973
               source="${boot.javac.source}"
               target="${boot.javac.target}"
974
               executable="${boot.java.home}/bin/javac"
975 976
               srcdir="${make.tools.dir}"
               includes="compileproperties/* anttasks/CompileProperties*"
D
duke 已提交
977
               destdir="${build.toolclasses.dir}/"
978
               classpath="${ant.core.lib}"
J
jjg 已提交
979 980 981 982
               bootclasspath="${boot.java.home}/jre/lib/rt.jar"
               includeantruntime="false">
            <compilerarg line="${javac.lint.opts}"/>
        </javac>
D
duke 已提交
983
        <taskdef name="pcompile"
984
                 classname="anttasks.CompilePropertiesTask"
D
duke 已提交
985 986
                 classpath="${build.toolclasses.dir}/"/>
    </target>
987

988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
    <target name="-def-compilecrules">
        <macrodef name="compilecrules">
            <sequential>
                <mkdir dir="${build.toolclasses.dir}"/>
                <javac fork="true"
                       source="${boot.javac.source}"
                       target="${boot.javac.target}"
                       executable="${boot.java.home}/bin/javac"
                       srcdir="${make.tools.dir}"
                       includes="crules/*"
                       destdir="${build.toolclasses.dir}/"
                       classpath="${ant.core.lib}"
                       bootclasspath="${boot.java.home}/jre/lib/rt.jar"
                       includeantruntime="false">
                    <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
                    <compilerarg line="${javac.lint.opts}"/>
                </javac>
                <copy todir="${build.toolclasses.dir}/" includeemptydirs="false">
                    <fileset dir="${make.tools.dir}">
                        <include name="**/*.properties"/>
                    </fileset>
                </copy>
            </sequential>
        </macrodef>
    </target>

1014
    <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
1015 1016 1017 1018 1019
        <mkdir dir="${build.toolclasses.dir}"/>
        <javac fork="true"
               source="${boot.javac.source}"
               target="${boot.javac.target}"
               executable="${boot.java.home}/bin/javac"
1020 1021
               srcdir="${make.tools.dir}"
               includes="genstubs/* anttasks/GenStubs*"
1022
               destdir="${build.toolclasses.dir}/"
J
jjg 已提交
1023 1024 1025
               classpath="${ant.core.lib}"
               includeantruntime="false">
            <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
J
jjg 已提交
1026
            <compilerarg line="${javac.lint.opts}"/>
J
jjg 已提交
1027
        </javac>
1028
        <taskdef name="genstubs"
1029
                 classname="anttasks.GenStubsTask"
1030 1031 1032
                 classpath="${build.toolclasses.dir}/"/>
    </target>

D
duke 已提交
1033 1034 1035 1036 1037 1038 1039 1040 1041
    <target name="-def-javadoc-tool" depends="-check-target.java.home">
        <macrodef name="javadoc-tool">
            <attribute name="name"/>
            <attribute name="includes"/>
            <attribute name="options" default=""/>
            <attribute name="source" default="1.5"/> <!-- FIXME -->
            <sequential>
                <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
                <!-- Note: even with this default value, includes
1042
                from src.classes.dir get javadoc'd; see packageset below -->
D
duke 已提交
1043
                <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
1044
                <javadoc
D
duke 已提交
1045
                    executable="${target.java.home}/bin/javadoc"
1046
                    destdir="${build.javadoc.dir}/@{name}"
D
duke 已提交
1047
                    source="@{source}"
1048 1049
                    windowtitle="UNOFFICIAL"
                    failonerror="true"
D
duke 已提交
1050
                    use="true"
1051
                    author="false"
D
duke 已提交
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
                    version="false"
                    packagenames="${javadoc.packagenames}" >
                    <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
                    <arg line="@{options}"/>
                    <bootclasspath>
                        <path location="${build.classes.dir}"/>
                        <path location="${target.java.home}/jre/lib/rt.jar"/>
                    </bootclasspath>
                    <sourcepath>
                        <pathelement location="${src.classes.dir}"/>
                    </sourcepath>
                    <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
                    <!-- means that {@link some.package} will not work, which is no good. -->
                    <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
                    <!-- which also causes duplicates in the class index for included files.) -->
                    <packageset dir="${src.classes.dir}" includes="@{includes}">
                        <or>
                            <filename name="java/"/>
                            <filename name="javax/"/>
                            <filename name="com/sun/javadoc/"/>
                            <filename name="com/sun/source/"/>
                        </or>
                    </packageset>
                </javadoc>
            </sequential>
        </macrodef>
    </target>
1079 1080

    <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
D
duke 已提交
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090
        <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
            <classpath>
                <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
                <pathelement location="${jtreg.home}/lib/javatest.jar"/>
            </classpath>
        </taskdef>
        <macrodef name="jtreg-tool">
            <attribute name="name"/>
            <attribute name="tests"/>
            <attribute name="jdk" default="${target.java.home}"/>
1091
            <attribute name="samevm" default="true"/>
1092 1093
            <attribute name="verbose" default="${default.jtreg.verbose}"/>
            <attribute name="options" default="${other.jtreg.options}"/>
D
duke 已提交
1094 1095 1096
            <attribute name="keywords" default="-keywords:!ignore"/>
            <attribute name="jpda.jvmargs" default=""/>
            <sequential>
1097 1098 1099 1100
                <property name="coverage.options" value=""/>              <!-- default -->
                <property name="coverage.classpath" value=""/>            <!-- default -->
                <property name="default.jtreg.verbose" value="summary"/>  <!-- default -->
                <property name="other.jtreg.options" value=""/>           <!-- default -->
1101
                <jtreg
D
duke 已提交
1102
                    dir="${test.dir}"
1103
                    workDir="${build.jtreg.dir}/@{name}/work"
D
duke 已提交
1104 1105 1106 1107 1108
                    reportDir="${build.jtreg.dir}/@{name}/report"
                    jdk="@{jdk}"
                    samevm="@{samevm}" verbose="@{verbose}"
                    failonerror="false" resultproperty="jtreg.@{name}.result"
                    javacoptions="-g"
1109
                    vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs}">
D
duke 已提交
1110 1111 1112 1113
                    <arg line="@{keywords}"/>
                    <arg line="@{options}"/>
                    <arg line="@{tests}"/>
                </jtreg>
1114
                <!-- the next two properties are for convenience, when only
D
duke 已提交
1115 1116
                     a single instance of jtreg will be invoked. -->
                <condition property="jtreg.passed">
1117
                    <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
D
duke 已提交
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131
                </condition>
                <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
            </sequential>
        </macrodef>
        <property name="jtreg.defined" value="true"/>
    </target>

    <target name="-def-cobertura" depends="-check-cobertura.home">
        <path id="cobertura.classpath">
            <fileset dir="${cobertura.home}">
                <include name="cobertura.jar"/>
                <include name="lib/**/*.jar"/>
            </fileset>
        </path>
1132
        <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
D
duke 已提交
1133
    </target>
1134

1135 1136 1137 1138 1139 1140 1141 1142 1143
    <target name="-def-checkstyle" unless="checkstyle.defined"
        depends="-check-checkstyle.home">
        <taskdef resource="checkstyletask.properties">
            <classpath>
                <pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>
            </classpath>
        </taskdef>
        <property name="checkstyle.defined" value="true"/>
    </target>
1144

1145 1146
    <target name="-def-findbugs" unless="findbugs.defined"
        depends="-check-findbugs.home,-check-target.java.home">
D
duke 已提交
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157
        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
            <classpath>
                <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
            </classpath>
        </taskdef>
        <macrodef name="findbugs-tool">
            <attribute name="name"/>
            <attribute name="output" default="emacs"/>
            <attribute name="outputFile" default=""/>
            <attribute name="reportLevel" default="high"/>
            <sequential>
1158
                <findbugs
D
duke 已提交
1159 1160 1161 1162 1163 1164 1165
                    home="${findbugs.home}"
                    output="@{output}"
                    outputFile="@{outputFile}"
                    reportLevel="@{reportLevel}"
                    failOnError="false"
                    errorProperty="findbugs.@{name}.errors"
                    warningsProperty="findbugs.@{name}.warnings"
1166
                    jvm="${target.java.home}/bin/java"
D
duke 已提交
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179
                    jvmargs="-Xmx512M" >
                    <class location="${dist.dir}/lib/@{name}.jar"/>
                    <auxClasspath>
                        <pathelement location="${build.classes.dir}"/>
                    </auxClasspath>
                    <sourcePath>
                        <pathelement location="${src.classes.dir}"/>
                    </sourcePath>
                </findbugs>
            </sequential>
        </macrodef>
        <property name="findbugs.defined" value="true"/>
    </target>
1180

1181
    <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant">
1182
        <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/>
1183 1184
        <property name="vizant.defined" value="true"/>
    </target>
1185

D
duke 已提交
1186 1187 1188 1189
    <target name="-def-check">
        <macrodef name="check">
            <attribute name="name"/>
            <attribute name="property"/>
1190
            <attribute name="marker" default=""/>
D
duke 已提交
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200
            <sequential>
                <fail message="Cannot locate @{name}: please set @{property} to its location">
                    <condition>
                        <not>
                            <isset property="@{property}"/>
                        </not>
                    </condition>
                </fail>
                <fail message="@{name} is not installed in ${@{property}}">
                    <condition>
1201 1202 1203 1204
                        <and>
                            <not>
                                <equals arg1="@{marker}" arg2=""/>
                            </not>
1205 1206 1207
                            <not>
                                <available file="${@{property}}/@{marker}"/>
                            </not>
1208
                        </and>
D
duke 已提交
1209 1210 1211 1212 1213 1214 1215 1216
                    </condition>
                </fail>
            </sequential>
        </macrodef>
    </target>

</project>