build.xml revision 2603:00d021d01485
1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. 4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 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. 11 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). 17 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. 21 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--> 26 27<!-- 28 This is the main build file for the complete langtools repository. 29 It is used when building JDK (in which case it is invoked from the 30 Makefile), and it can be used when working on the tools themselves, 31 in an IDE such as NetBeans. 32 33 External dependencies are specified via properties. These can be given 34 on the command line, or by providing a local build.properties file. 35 (They can also be edited into make/build.properties, although that is not 36 recommended.) At a minimum, boot.java.home must be set to the installed 37 location of the version of JDK used to build this repository. Additional 38 properties may be required, depending on the targets that are built. 39 For example, to run any of the jtreg tests you must set jtreg.home, 40 to run findbugs on the code you must set findbugs.home, and so on. 41 42 For the most part, javac can be built using the previous version of JDK. 43 However, a small number of javac files require access to the latest JDK, 44 which may not yet have been compiled. To compile these files, you can do 45 one of the following: 46 - Set boot.java.home to a recent build of the latest version of JDK. 47 - Set import.jdk to either a recent build (containing jre/lib/rt.jar) 48 or to jdk source repository. In the latter case, stub files will 49 automatically be generated and used for the required API, to avoid 50 unnecessary compilation of the source repository. 51 If you do neither, the relevant files will not be built. 52 53 The main build happens in two phases: 54 - First, javac and other tools as needed are built using ${boot.java.home}. 55 (This implies a constraint on the source code that they can be compiled 56 with the previous version of JDK. 57 - Second, all required classes are compiled with the latest javac, created 58 in the previous step. 59 The first phase is called the bootstrap phase. All targets, properties and 60 tasks that are specific to that phase have "bootstrap" in their name. 61 62 For more details on the JDK build, see 63 http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build 64 http://openjdk.java.net/groups/build/ 65 For more details on the stub generator, see 66 http://blogs.sun.com/jjg/entry/building_javac_for_jdk7 67 68 Internal details ... 69 70 Interim build products are created in the build/ directory. 71 Final build products are created in the dist/ directory. 72 When building JDK, the dist/directory will contain: 73 - A bootstrap compiler suitable for running with ${boot.java.home} 74 suitable for compiling downstream parts of JDK 75 - Source files and class files for inclusion in the JDK being built 76 When building standalone, the dist/directory will contain: 77 - Separate jar files for each of the separate langtools components 78 - Simple scripts to invoke the tools by executing the corresponding 79 jar files. 80 These jar files and scripts are "for developer use only". 81 82 This file is organized into sections as follows: 83 - global property definitions 84 - general top level targets 85 - general diagnostic/debugging targets 86 - groups of targets for each tool: javac, javadoc, javah, javap 87 Within each group, the following targets are provided, where applicable 88 build-bootstrap-TOOL build the bootstrap version of the tool 89 build-classes-TOOL build the classes for the tool 90 build-TOOL build the jar file and script for the tool 91 jtreg-TOOL build the tool and run the appropriate tests 92 findbugs-TOOL run findbugs on the tool's source code 93 TOOL build the tool, run the tests, and run findbugs 94 - utility definitions 95 --> 96 97<project name="langtools" default="build" basedir=".."> 98 <!-- 99 **** Global property definitions. 100 --> 101 102 <!-- Force full debuginfo for javac if the debug.classfiles 103 property is set. This must be BEFORE the include of 104 build.properties because it sets javac.debuglevel. --> 105 <condition property="javac.debuglevel" value="source,lines,vars"> 106 <equals arg1="${debug.classfiles}" arg2="true"/> 107 </condition> 108 109 <!-- The following locations can be used to override default property values. --> 110 111 <!-- Use this location for customizations specific to this instance of this workspace --> 112 <property file="build.properties"/> 113 114 <!-- Use this location for customizations common to all OpenJDK langtools workspaces --> 115 <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/> 116 117 <!-- Use this location for customizations common to all OpenJDK workspaces --> 118 <property file="${user.home}/.openjdk/build.properties"/> 119 120 <!-- Convenient shorthands for standard locations within the workspace. --> 121 <property name="build.dir" location="build"/> 122 <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/> 123 <property name="build.coverage.dir" location="${build.dir}/coverage"/> 124 <property name="build.classes.dir" location="${build.dir}/classes"/> 125 <property name="build.gensrc.dir" location="${build.dir}/gensrc"/> 126 <property name="build.genstubs.dir" location="${build.dir}/genstubs"/> 127 <property name="build.javadoc.dir" location="${build.dir}/javadoc"/> 128 <property name="build.jtreg.dir" location="${build.dir}/jtreg"/> 129 <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/> 130 <property name="dist.dir" location="dist"/> 131 <property name="dist.bin.dir" location="${dist.dir}/bin"/> 132 <property name="dist.coverage.dir" location="${dist.dir}/coverage"/> 133 <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/> 134 <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/> 135 <property name="dist.lib.dir" location="${dist.dir}/lib"/> 136 <property name="make.dir" location="make"/> 137 <property name="make.conf.dir" location="${make.dir}/conf"/> 138 <property name="make.tools.dir" location="${make.dir}/tools"/> 139 <property name="src.dir" location="src"/> 140 <property name="src.bin.dir" location="${src.dir}/share/bin"/> 141 <property name="test.dir" location="test"/> 142 143 <path id="src.dirs"> 144 <pathelement path="${src.dir}/java.base/share/classes"/> 145 <pathelement path="${src.dir}/java.compiler/share/classes"/> 146 <pathelement path="${src.dir}/jdk.compiler/share/classes"/> 147 <pathelement path="${src.dir}/jdk.dev/share/classes"/> 148 <pathelement path="${src.dir}/jdk.javadoc/share/classes"/> 149 </path> 150 151 <pathconvert pathsep="," property="src.dirs.property" refid="src.dirs" /> 152 153 <!-- java.marker is set to a marker file to check for within a Java install dir. 154 The best file to check for across Solaris/Linux/Windows/MacOS is one of the 155 executables; regrettably, that is OS-specific. --> 156 <condition property="java.marker" value="bin/java"> 157 <os family="unix"/> 158 </condition> 159 <condition property="java.marker" value="bin/java.exe"> 160 <os family="windows"/> 161 </condition> 162 163 <!-- Standard property values, if not overriden by earlier settings. --> 164 <property file="${make.dir}/build.properties"/> 165 166 <!-- launcher.java is used in the launcher scripts provided to run 167 the tools' jar files. If it has not already been set, then 168 default it to use ${target.java.home}, if available, otherwise 169 quietly default to simply use "java". --> 170 <condition property="launcher.java" 171 value="${target.java.home}/bin/java" else="java"> 172 <isset property="target.java.home"/> 173 </condition> 174 175 <!-- Logic for handling access import jdk classes, if available. 176 import.jdk should be unset, or set to jdk home (to use rt.jar) 177 or to jdk repo (to use src/share/classes). 178 Based on the value, if any, set up default values for javac's sourcepath, 179 classpath and bootclasspath. Note: the default values are overridden 180 in the build-bootstrap-classes macro. --> 181 182 <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes" 183 filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/> 184 <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar" 185 ignoresystemclasses="true" 186 classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/> 187 188 <!-- Set the default bootclasspath option used for javac. 189 Note that different variants of the option are used, meaning we can't just 190 define the value for the option. 191 Note the explicit use of the standard property ${path.separator} in the following. 192 This is because Ant is not clever enough to handle direct use of : or ; --> 193 <condition property="javac.bootclasspath.opt" 194 value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}" 195 else="-Xbootclasspath/p:${build.classes.dir}"> 196 <isset property="import.jdk.jar"/> 197 </condition> 198 199 <condition property="boot.java.provides.latest.jdk"> 200 <available 201 ignoresystemclasses="true" 202 classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/> 203 </condition> 204 205 <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}"> 206 <isset property="boot.java.provides.latest.jdk"/> 207 </condition> 208 209 <condition property="exclude.files" value="" else="${require.latest.jdk.files}"> 210 <or> 211 <isset property="boot.java.provides.latest.jdk"/> 212 <isset property="import.jdk"/> 213 </or> 214 </condition> 215 216 <condition property="require.import.jdk.stubs"> 217 <and> 218 <not> 219 <isset property="boot.java.provides.latest.jdk"/> 220 </not> 221 <isset property="import.jdk.src.dir"/> 222 </and> 223 </condition> 224 225 <!-- Set the default value of the sourcepath used for javac. --> 226 <condition property="javac.sourcepath" value="${build.genstubs.dir}" else=""> 227 <isset property="require.import.jdk.stubs"/> 228 </condition> 229 230 <!-- Set the default value of the classpath used for javac. --> 231 <property name="javac.classpath" value=""/> 232 233 234 <!-- 235 **** General top level targets. 236 --> 237 238 <!-- Standard target to build deliverables for JDK build. --> 239 240 <target name="build" depends="build-bootstrap-tools,build-all-classes"> 241 <copy todir="${dist.dir}/bootstrap"> 242 <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/> 243 </copy> 244 <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx"> 245 <include name="*"/> 246 </chmod> 247 <mkdir dir="${dist.lib.dir}"/> 248 <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/> 249 <zip file="${dist.lib.dir}/src.zip"> 250 <multirootfileset basedirs="${src.dirs.property}" /> 251 </zip> 252 </target> 253 254 <target name="build-bootstrap-tools" 255 depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-javah,build-bootstrap-sjavac" 256 /> 257 258 <target name="build-all-tools" 259 depends="build-javac,build-javadoc,build-javah,build-javap,build-sjavac" 260 /> 261 262 <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs"> 263 <build-classes includes="${javac.includes} ${javadoc.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/> 264 </target> 265 266 <!-- clean --> 267 268 <target name="clean" description="Delete all generated files"> 269 <delete dir="${build.dir}"/> 270 <delete dir="${dist.dir}"/> 271 </target> 272 273 <!-- Additional targets for running tools on the build --> 274 275 <target name="jtreg" depends="build-all-tools,-def-jtreg"> 276 <jtreg-tool name="all" tests="${jtreg.tests}"/> 277 </target> 278 279 <target name="checkstyle" depends="-def-checkstyle" 280 description="Generates reports for code convention violations."> 281 <mkdir dir="${dist.checkstyle.dir}"/> 282 <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml" 283 failureProperty="checkstyle.failure" 284 failOnViolation="false"> 285 <formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/> 286 <fileset dir="src" includes="**/*.java, **/*.properties"/> 287 </checkstyle> 288 <!-- transform the output to a simple html --> 289 <xslt in="${dist.checkstyle.dir}/checkstyle_report.xml" 290 out="${dist.checkstyle.dir}/checkstyle_report.html" 291 style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/> 292 <!-- transform the output to a very simple emacs friendly text file --> 293 <xslt in="${dist.checkstyle.dir}/checkstyle_report.xml" 294 out="${dist.checkstyle.dir}/checkstyle_report.tmp" 295 style="${make.conf.dir}/checkstyle-emacs.xsl"/> 296 <!-- beautify remove extra lines --> 297 <move file="${dist.checkstyle.dir}/checkstyle_report.tmp" 298 toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"> 299 <filterchain> 300 <ignoreblank/> 301 <replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/> 302 </filterchain> 303 </move> 304 </target> 305 <!-- target can be invoked from an ide, the output of which can be used 306 to access and fix the errors directly. 307 --> 308 <target name="checkstyle-ide" depends="checkstyle"> 309 <concat> 310 <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/> 311 </concat> 312 </target> 313 314 <target name="findbugs" depends="-def-findbugs,build-all-tools"> 315 <property name="findbugs.reportLevel" value="medium"/> 316 <mkdir dir="${dist.findbugs.dir}"/> 317 <findbugs 318 home="${findbugs.home}" 319 projectName="JDK langtools ${full.version}" 320 output="xml" 321 outputFile="${dist.findbugs.dir}/findbugs.xml" 322 reportLevel="${findbugs.reportLevel}" 323 failOnError="false" 324 errorProperty="findbugs.all.errors" 325 warningsProperty="findbugs.all.warnings" 326 jvm="${target.java.home}/bin/java" 327 jvmargs="-Xmx512M"> 328 <class location="${build.classes.dir}"/> 329 <sourcePath> 330 <path refid="src.dirs"/> 331 </sourcePath> 332 </findbugs> 333 <exec executable="sh"> 334 <arg value="${findbugs.home}/bin/convertXmlToText"/> 335 <arg value="-longBugCodes"/> 336 <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/> 337 <arg value="${dist.findbugs.dir}/findbugs.xml"/> 338 <redirector output="${dist.findbugs.dir}/findbugs.html"/> 339 </exec> 340 </target> 341 342 <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/> 343 344 <target name="instrument-classes" depends="-def-cobertura"> 345 <!-- only define the following property when we want coverage info --> 346 <path id="coverage.classpath"> 347 <pathelement location="${build.coverage.dir}/classes"/> 348 <path refid="cobertura.classpath"/> 349 </path> 350 <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/> 351 <property name="coverage.classpath" refid="coverage.classpath"/> 352 <mkdir dir="${build.coverage.dir}/classes"/> 353 <delete file="${build.coverage.dir}/cobertura.ser"/> 354 <cobertura-instrument todir="${build.coverage.dir}/classes" 355 datafile="${build.coverage.dir}/cobertura.ser"> 356 <fileset dir="${build.classes.dir}" 357 includes="**/*.class" excludes="**/resources/*.class"/> 358 </cobertura-instrument> 359 </target> 360 361 <target name="coverage-report" depends="-def-cobertura"> 362 <mkdir dir="${dist.coverage.dir}"/> 363 <cobertura-report 364 destdir="${dist.coverage.dir}" 365 datafile="${build.coverage.dir}/cobertura.ser"> 366 <fileset dir="${src.dir}/java.base/share/classes"/> 367 <fileset dir="${src.dir}/java.compiler/share/classes"/> 368 <fileset dir="${src.dir}/jdk.compiler/share/classes"/> 369 <fileset dir="${src.dir}/jdk.dev/share/classes"/> 370 <fileset dir="${src.dir}/jdk.javadoc/share/classes"/> 371 </cobertura-report> 372 <cobertura-report 373 format="xml" 374 destdir="${dist.coverage.dir}" 375 datafile="${build.coverage.dir}/cobertura.ser"> 376 <fileset dir="${src.dir}/java.base/share/classes"/> 377 <fileset dir="${src.dir}/java.compiler/share/classes"/> 378 <fileset dir="${src.dir}/jdk.compiler/share/classes"/> 379 <fileset dir="${src.dir}/jdk.dev/share/classes"/> 380 <fileset dir="${src.dir}/jdk.javadoc/share/classes"/> 381 </cobertura-report> 382 </target> 383 384 <target name="diags-examples" depends="build-javac,build-javap"> 385 <!-- can override the following on the command line if desired. --> 386 <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/> 387 <mkdir dir="${build.dir}/diag-examples/classes"/> 388 <javac fork="true" 389 executable="${dist.bin.dir}/javac" 390 srcdir="test/tools/javac/diags" 391 destdir="${build.dir}/diag-examples/classes" 392 includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java" 393 sourcepath="" 394 classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar" 395 includeAntRuntime="no" 396 debug="${javac.debug}" 397 debuglevel="${javac.debuglevel}"> 398 <compilerarg line="${javac.lint.opts}"/> 399 </javac> 400 <java fork="true" 401 jvm="${target.java.home}/bin/java" 402 dir="test/tools/javac/diags" 403 classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar" 404 classname="RunExamples"> 405 <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/> 406 <arg value="-examples"/> 407 <arg value="examples"/> 408 <arg value="-o"/> 409 <arg file="${diags.examples.out}"/> 410 <arg value="-showFiles"/> 411 <arg value="-title"/> 412 <arg value="Examples of javac diagnostics"/> 413 </java> 414 </target> 415 416 <!-- a patching facility to speed up incorporating the langtools' classfiles 417 into a jdk of your choice. Either target.java.home or patch.jdk can be 418 set on the command line; setting target.java.home has the advantage of 419 patching the jdk used for jtreg and other tests. 420 --> 421 <target name="patch" depends="build-all-classes"> 422 <condition property="patch.jdk" value="${target.java.home}"> 423 <available file="${target.java.home}" type="dir"/> 424 </condition> 425 <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"> 426 <condition> 427 <not> 428 <isset property="patch.jdk"/> 429 </not> 430 </condition> 431 </fail> 432 <property name="patch.tools.jar" location="${patch.jdk}/lib/tools.jar"/> 433 <property name="patch.rt.jar" location="${patch.jdk}/jre/lib/rt.jar"/> 434 <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing tools.jar"> 435 <condition> 436 <not> 437 <available file="${patch.tools.jar}" type="file"/> 438 </not> 439 </condition> 440 </fail> 441 <fail message="patch.jdk or target.java.home must point to a valid jdk image: missing rt.jar"> 442 <condition> 443 <not> 444 <available file="${patch.rt.jar}" type="file"/> 445 </not> 446 </condition> 447 </fail> 448 <zip zipfile="${patch.tools.jar}" update="true"> 449 <zipfileset dir="${build.classes.dir}" includes="com/**"/> 450 </zip> 451 <zip zipfile="${patch.rt.jar}" update="true"> 452 <zipfileset dir="${build.classes.dir}" includes="javax/**"/> 453 </zip> 454 </target> 455 456 <target name="doclint-api" depends="build-all-classes"> 457 <delete dir="${build.dir}/doclint/classes"/> 458 <mkdir dir="${build.dir}/doclint/classes"/> 459 <javac fork="true" 460 executable="${boot.javac}" 461 destdir="${build.dir}/doclint/classes" 462 includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**" 463 excludes="" 464 sourcepath="${javac.sourcepath}" 465 classpath="${javac.classpath}" 466 includeAntRuntime="no" 467 source="${javac.source}" 468 target="${javac.target}" 469 debug="${javac.debug}" 470 debuglevel="${javac.debuglevel}"> 471 <compilerarg value="-implicit:none"/> 472 <compilerarg value="-Xprefer:source"/> 473 <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> 474 <compilerarg line="${javac.no.jdk.warnings}"/> 475 <compilerarg line="${javac.version.opt}"/> 476 <compilerarg line="-Xdoclint:all/protected,-missing"/> 477 <src> 478 <path refid="src.dirs"/> 479 <path location="${build.gensrc.dir}"/> 480 </src> 481 </javac> 482 </target> 483 484 <!-- Generate API docs for "important" test classes that are used by 485 multiple tests. 486 --> 487 <target name="test-framework-docs" depends="build-all-classes"> 488 <javadoc executable="${target.java.home}/bin/javadoc" 489 destdir="${build.dir}/testframeworkdocs"> 490 <!-- disable doclint for now; it might be good to enable -Xdoclint:missing --> 491 <arg value="-Xdoclint:none"/> 492 <!-- source files to be documented --> 493 <sourcefiles> 494 <fileset dir="${test.dir}"> 495 <include name="**/ToolBox.java"/> 496 <include name="**/*Tester.java"/> 497 <include name="**/*TestBase.java"/> 498 <include name="**/*Testing*.java"/> 499 </fileset> 500 </sourcefiles> 501 <!-- source path used for documentation --> 502 <sourcepath> 503 <pathelement path="${test.dir}/lib"/> 504 <pathelement path="${test.dir}/lib/combo"/> 505 <pathelement path="${test.dir}/tools/javac/lib"/> 506 <pathelement path="${test.dir}/tools/javac/classfiles/attributes/LocalVariableTable"/> 507 </sourcepath> 508 <!-- exclude the following "packages" found by <javadoc> 509 on the sourcepath --> 510 <excludepackage name="combo.tools.javac.combo"/> 511 <excludepackage name="tools.javac.combo"/> 512 <!-- library classes used for documentation --> 513 <classpath> 514 <pathelement path="${jtreg.home}/lib/testng.jar"/> 515 </classpath> 516 <!-- platform classes used for documentation --> 517 <bootclasspath> 518 <pathelement path="${build.dir}/classes"/> 519 <pathelement path="${target.java.home}/jre/lib/rt.jar"/> 520 </bootclasspath> 521 </javadoc> 522 </target> 523 524 <!-- 525 **** Debugging/diagnostic targets. 526 --> 527 528 <!-- standard JDK target --> 529 <target name="sanity" 530 description="display settings of configuration values"> 531 <echo level="info">ant.home = ${ant.home}</echo> 532 <echo level="info">boot.java.home = ${boot.java.home}</echo> 533 <echo level="info">target.java.home = ${target.java.home}</echo> 534 <echo level="info">jtreg.home = ${jtreg.home}</echo> 535 <echo level="info">findbugs.home = ${findbugs.home}</echo> 536 <echo level="info">checkstyle.home = ${checkstyle.home}</echo> 537 </target> 538 539 <target name="post-sanity" depends="-def-jtreg,sanity,build" 540 description="perform basic validation after a standard build"> 541 <jtreg 542 dir="make/test" 543 workDir="${build.jtreg.dir}/post-sanity/work" 544 reportDir="${build.jtreg.dir}/post-sanity/report" 545 jdk="${target.java.home}" 546 verbose="summary" 547 failonerror="false" resultproperty="jtreg.post-sanity.result"> 548 </jtreg> 549 </target> 550 551 <!-- use vizant tool to generate graphical image of this Ant file.--> 552 <target name="vizant" depends="-def-vizant"> 553 <mkdir dir="${build.dir}"/> 554 <echo message="Generating ${build.dir}/build.dot"/> 555 <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/> 556 <echo message="Generating ${build.dir}/build.png"/> 557 <exec executable="${dot}" > 558 <arg value="-Tpng"/> 559 <arg value="-o"/> 560 <arg file="${build.dir}/build.png"/> 561 <arg file="${build.dir}/build.dot"/> 562 </exec> 563 </target> 564 565 <target name="check-import.jdk"> 566 <echo message="import.jdk: ${import.jdk}"/> 567 <echo message="import.jdk.jar: ${import.jdk.jar}"/> 568 <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/> 569 </target> 570 571 <target name="diagnostics"> 572 <diagnostics/> 573 </target> 574 575 576 <!-- 577 **** javac targets. 578 --> 579 580 <target name="build-bootstrap-javac" 581 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> 582 <build-bootstrap-classes includes="${javac.includes}"/> 583 <build-bootstrap-jar name="javac" includes="${javac.includes}"/> 584 <build-bootstrap-tool name="javac"/> 585 </target> 586 587 <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs"> 588 <build-classes includes="${javac.includes}"/> 589 </target> 590 591 <target name="build-javac" depends="build-classes-javac"> 592 <build-jar name="javac" includes="${javac.includes}"/> 593 <build-tool name="javac"/> 594 </target> 595 596 <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool"> 597 <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls.option}"/> 598 </target> 599 600 <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg"> 601 <jtreg-tool name="javac" tests="${javac.tests}"/> 602 </target> 603 604 <target name="findbugs-javac" depends="build-javac,-def-findbugs"> 605 <findbugs-tool name="javac"/> 606 </target> 607 608 <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/> 609 610 611 <!-- 612 **** javadoc targets. 613 --> 614 615 <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac"> 616 <build-bootstrap-classes includes="${javadoc.includes}"/> 617 <build-bootstrap-jar name="javadoc" includes="${javadoc.includes}" 618 jarclasspath="javac.jar"/> 619 <build-bootstrap-tool name="javadoc"/> 620 </target> 621 622 <target name="build-classes-javadoc" depends="build-classes-javac"> 623 <build-classes includes="${javadoc.includes}"/> 624 </target> 625 626 <target name="build-javadoc" depends="build-javac,build-classes-javadoc"> 627 <build-jar name="javadoc" includes="${javadoc.includes}" 628 jarclasspath="javac.jar"/> 629 <build-tool name="javadoc"/> 630 </target> 631 632 <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool"> 633 <javadoc-tool name="javadoc" includes="${javadoc.includes}"/> 634 </target> 635 636 <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg"> 637 <jtreg-tool name="javadoc" tests="${javadoc.tests}"/> 638 </target> 639 640 <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs"> 641 <findbugs-tool name="javadoc"/> 642 </target> 643 644 <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/> 645 646 <!-- 647 **** javah targets. 648 --> 649 650 <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc"> 651 <build-bootstrap-classes includes="${javah.includes}"/> 652 <build-bootstrap-jar name="javah" includes="${javah.includes}" 653 jarclasspath="javadoc.jar javac.jar"/> 654 <build-bootstrap-tool name="javah"/> 655 </target> 656 657 <target name="build-javah" depends="build-javac,build-classes-javah"> 658 <build-jar name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/> 659 <build-tool name="javah"/> 660 </target> 661 662 <target name="build-classes-javah" depends="build-classes-javadoc"> 663 <build-classes includes="${javah.includes}"/> 664 </target> 665 666 <!-- (no javadoc for javah) --> 667 668 <target name="jtreg-javah" depends="build-javah,-def-jtreg"> 669 <jtreg-tool name="javah" tests="${javah.tests}"/> 670 </target> 671 672 <target name="findbugs-javah" depends="build-javah,-def-findbugs"> 673 <findbugs-tool name="javah"/> 674 </target> 675 676 <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/> 677 678 679 <!-- 680 **** javap targets. 681 --> 682 683 <target name="build-bootstrap-javap" 684 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> 685 <build-bootstrap-classes includes="${javap.includes}"/> 686 <build-bootstrap-jar name="javap" includes="${javap.includes}" 687 jarmainclass="sun.tools.javap.Main"/> 688 <build-bootstrap-tool name="javap"/> 689 </target> 690 691 <target name="build-classes-javap" depends="build-classes-javac"> 692 <build-classes includes="${javap.includes}"/> 693 </target> 694 695 <target name="build-javap" depends="build-javac,build-classes-javap"> 696 <build-jar name="javap" includes="${javap.includes}" 697 jarmainclass="com.sun.tools.javap.Main" 698 jarclasspath="javac.jar"/> 699 <build-tool name="javap"/> 700 </target> 701 702 <!-- (no javadoc for javap) --> 703 704 <target name="jtreg-javap" depends="build-javap,-def-jtreg"> 705 <jtreg-tool name="javap" tests="${javap.tests}"/> 706 </target> 707 708 <target name="findbugs-javap" depends="build-javap,-def-findbugs"> 709 <findbugs-tool name="javap"/> 710 </target> 711 712 <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/> 713 714 <!-- 715 **** sjavac targets. 716 --> 717 718 <target name="build-bootstrap-sjavac" 719 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> 720 <build-bootstrap-classes includes="${sjavac.includes}"/> 721 <build-bootstrap-jar name="sjavac" includes="${sjavac.includes}" 722 jarmainclass="com.sun.tools.sjavac.Main"/> 723 <build-bootstrap-tool name="sjavac"/> 724 </target> 725 726 <target name="build-classes-sjavac" depends="build-classes-javac"> 727 <build-classes includes="${sjavac.includes}"/> 728 </target> 729 730 <target name="build-sjavac" depends="build-classes-sjavac"> 731 <build-jar name="sjavac" includes="${sjavac.includes}" 732 jarmainclass="com.sun.tools.sjavac.Main" 733 jarclasspath="sjavac.jar"/> 734 <build-tool name="sjavac"/> 735 </target> 736 737 <!-- (no javadoc for javap) --> 738 739 <target name="jtreg-sjavac" depends="build-sjavac,-def-jtreg"> 740 <jtreg-tool name="sjavac" tests="${sjavac.tests}"/> 741 </target> 742 743 <target name="findbugs-sjavac" depends="build-sjavac,-def-findbugs"> 744 <findbugs-tool name="sjavac"/> 745 </target> 746 747 <target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/> 748 749 <!-- 750 **** crules targets. 751 --> 752 753 <target name="build-crules" 754 depends="-def-compilecrules,-def-build-jar-with-services,build-bootstrap-javac,-create-import-jdk-stubs"> 755 <compilecrules/> 756 <build-jar-with-services 757 name="crules" 758 includes="crules/* crules/resources/*" 759 classes.dir="${build.toolclasses.dir}" 760 lib.dir="${build.toolclasses.dir}" 761 jarmainclass="" 762 jarclasspath="crules.jar" 763 service.type="com.sun.source.util.Plugin" 764 service.provider="crules.CodingRulesAnalyzerPlugin"/> 765 <build-tool name="crules"/> 766 </target> 767 768 <target name="jtreg-crules" depends="build-javac,build-crules,-def-jtreg"> 769 <jtreg-tool name="crules" 770 tests="${crules.tests}" 771 extra.jvmargs="-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar" /> 772 </target> 773 774 <target name="check-coding-rules" depends="build-bootstrap-javac,-create-import-jdk-stubs,build-crules"> 775 <build-classes includes="${javac.includes}" 776 plugin.options="-J-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar -Xplugin:coding_rules" /> 777 </target> 778 779 <!-- 780 **** Create import JDK stubs. 781 --> 782 783 <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs"> 784 <mkdir dir="${build.genstubs.dir}"/> 785 <genstubs 786 srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}" 787 includes="${import.jdk.stub.files}" 788 fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}" 789 /> 790 </target> 791 792 <!-- 793 **** IDE support 794 --> 795 796 <target name="idea"> 797 <mkdir dir=".idea"/> 798 <copy todir=".idea" > 799 <fileset dir="make/intellij" excludes="**/src/**"/> 800 </copy> 801 <condition property="jtreg.idea.home" value="${jtreg.home}" else = "[jtreg.home]"> 802 <isset property="jtreg.home"/> 803 </condition> 804 <replace file=".idea/ant.xml" token="@@@" value="${jtreg.idea.home}"/> 805 <mkdir dir=".idea/classes"/> 806 <javac srcdir="make/intellij/src" 807 destdir=".idea/classes"/> 808 </target> 809 810 <!-- 811 **** Check targets. 812 **** "-check-*" targets check that a required property is set, and set to a reasonable value. 813 **** A user friendly message is generated if not, and the build exits. 814 --> 815 816 <target name="-check-boot.java.home" depends="-def-check"> 817 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> 818 </target> 819 820 <target name="-check-target.java.home" depends="-def-check"> 821 <check name="target java" property="target.java.home" marker="${java.marker}"/> 822 </target> 823 824 <target name="-check-cobertura.home" depends="-def-check"> 825 <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/> 826 </target> 827 828 <target name="-check-findbugs.home" depends="-def-check"> 829 <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/> 830 </target> 831 832 <target name="-check-checkstyle.home" depends="-def-check"> 833 <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/> 834 </target> 835 836 <target name="-check-jtreg.home" depends="-def-check"> 837 <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/> 838 </target> 839 840 <target name="-check-vizant" depends="-def-check"> 841 <check name="vizant" property="vizant.jar"/> 842 <check name="dot" property="dot"/> 843 </target> 844 845 846 <!-- 847 **** Targets for Ant macro and task definitions. 848 --> 849 850 <target name="-def-build-tool"> 851 <macrodef name="build-tool"> 852 <attribute name="name"/> 853 <attribute name="bin.dir" default="${dist.bin.dir}"/> 854 <attribute name="java" default="${launcher.java}"/> 855 <sequential> 856 <mkdir dir="@{bin.dir}"/> 857 <copy file="${make.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}"> 858 <filterset begintoken="#" endtoken="#"> 859 <filter token="PROGRAM" value="@{name}"/> 860 <filter token="TARGET_JAVA" value="@{java}"/> 861 <filter token="PS" value="${path.separator}"/> 862 </filterset> 863 </copy> 864 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/> 865 </sequential> 866 </macrodef> 867 </target> 868 869 <target name="-def-build-jar"> 870 <macrodef name="build-jar"> 871 <attribute name="name"/> 872 <attribute name="includes"/> 873 <attribute name="classes.dir" default="${build.classes.dir}"/> 874 <attribute name="lib.dir" default="${dist.lib.dir}"/> 875 <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/> 876 <attribute name="jarclasspath" default=""/> 877 <sequential> 878 <mkdir dir="@{lib.dir}"/> 879 <jar destfile="@{lib.dir}/@{name}.jar" 880 basedir="@{classes.dir}" 881 includes="@{includes}"> 882 <manifest> 883 <attribute name="Main-Class" value="@{jarmainclass}"/> 884 <attribute name="Class-Path" value="@{jarclasspath}"/> 885 </manifest> 886 </jar> 887 </sequential> 888 </macrodef> 889 </target> 890 891 <target name="-def-build-jar-with-services"> 892 <macrodef name="build-jar-with-services"> 893 <attribute name="name"/> 894 <attribute name="includes"/> 895 <attribute name="classes.dir" default="${build.classes.dir}"/> 896 <attribute name="lib.dir" default="${dist.lib.dir}"/> 897 <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/> 898 <attribute name="jarclasspath" default=""/> 899 <attribute name="service.type" default=""/> 900 <attribute name="service.provider" default=""/> 901 <sequential> 902 <mkdir dir="${build.toolclasses.dir}"/> 903 <jar destfile="@{lib.dir}/@{name}.jar" 904 basedir="@{classes.dir}" 905 includes="@{includes}"> 906 <service type="@{service.type}" provider="@{service.provider}"/> 907 <manifest> 908 <attribute name="Main-Class" value="@{jarmainclass}"/> 909 <attribute name="Class-Path" value="@{jarclasspath}"/> 910 </manifest> 911 </jar> 912 </sequential> 913 </macrodef> 914 </target> 915 916 <target name="-def-build-classes" depends="-def-pcompile"> 917 <macrodef name="build-classes"> 918 <attribute name="includes"/> 919 <attribute name="excludes" default="${exclude.files} **/package-info.java"/> 920 <attribute name="classes.dir" default="${build.classes.dir}"/> 921 <attribute name="gensrc.dir" default="${build.gensrc.dir}"/> 922 <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/> 923 <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/> 924 <attribute name="classpath" default="${javac.classpath}"/> 925 <attribute name="sourcepath" default="${javac.sourcepath}"/> 926 <attribute name="java.home" default="${boot.java.home}"/> 927 <attribute name="source" default="${javac.source}"/> 928 <attribute name="target" default="${javac.target}"/> 929 <attribute name="release" default="${release}"/> 930 <attribute name="full.version" default="${full.version}"/> 931 <attribute name="plugin.options" default=""/> 932 <sequential> 933 <echo level="verbose" message="build-classes: excludes=@{excludes}"/> 934 <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/> 935 <echo level="verbose" message="build-classes: classpath=@{classpath}"/> 936 <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/> 937 <mkdir dir="@{gensrc.dir}"/> 938 <mkdir dir="@{classes.dir}"/> 939 <pcompile destdir="@{gensrc.dir}" 940 includes="@{includes}"> 941 <src> 942 <path refid="src.dirs"/> 943 </src> 944 </pcompile> 945 <copy todir="@{gensrc.dir}"> 946 <multirootfileset basedirs="${src.dirs.property}" includes="@{includes}" /> 947 <globmapper from="*.properties-template" to="*.properties"/> 948 <filterset begintoken="$(" endtoken=")"> 949 <filter token="JDK_VERSION" value="${jdk.version}"/> 950 <filter token="RELEASE" value="@{release}"/> 951 <filter token="FULL_VERSION" value="@{full.version}"/> 952 </filterset> 953 </copy> 954 <pcompile destdir="@{gensrc.dir}" 955 includes="**/*.properties"> 956 <src> 957 <pathelement location="@{gensrc.dir}"/> 958 </src> 959 </pcompile> 960 <javac fork="true" 961 executable="@{java.home}/bin/javac" 962 destdir="@{classes.dir}" 963 includes="@{includes}" 964 excludes="@{excludes}" 965 sourcepath="@{sourcepath}" 966 classpath="@{classpath}" 967 includeAntRuntime="no" 968 source="@{source}" 969 target="@{target}" 970 debug="${javac.debug}" 971 debuglevel="${javac.debuglevel}"> 972 <compilerarg value="-implicit:none"/> 973 <compilerarg value="-Xprefer:source"/> 974 <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/> 975 <compilerarg line="@{bootclasspath.opt}"/> 976 <compilerarg line="${javac.no.jdk.warnings}"/> 977 <compilerarg line="${javac.version.opt}"/> 978 <compilerarg line="${javac.lint.opts}"/> 979 <compilerarg line="@{plugin.options}"/> 980 <src> 981 <path refid="src.dirs"/> 982 <path location="@{gensrc.dir}"/> 983 </src> 984 </javac> 985 <copy todir="@{classes.dir}" includeemptydirs="false"> 986 <multirootfileset basedirs="${src.dirs.property}" includes="@{includes}" excludes="@{excludes}"> 987 <exclude name="**/*.java"/> 988 <exclude name="**/*.properties"/> 989 <exclude name="**/*-template"/> 990 <exclude name="**/*.rej"/> 991 <exclude name="**/*.orig"/> 992 <exclude name="**/overview.html"/> 993 <exclude name="**/package.html"/> 994 </multirootfileset> 995 </copy> 996 </sequential> 997 </macrodef> 998 </target> 999 1000 <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool"> 1001 <presetdef name="build-bootstrap-tool"> 1002 <build-tool 1003 bin.dir="${build.bootstrap.dir}/bin" 1004 java="${boot.java}"/> 1005 </presetdef> 1006 </target> 1007 1008 <target name="-def-build-bootstrap-jar" depends="-def-build-jar"> 1009 <presetdef name="build-bootstrap-jar"> 1010 <build-jar 1011 classes.dir="${build.bootstrap.dir}/classes" 1012 lib.dir="${build.bootstrap.dir}/lib"/> 1013 </presetdef> 1014 </target> 1015 1016 <target name="-def-build-bootstrap-classes" depends="-def-build-classes"> 1017 <presetdef name="build-bootstrap-classes"> 1018 <build-classes 1019 source="${boot.javac.source}" 1020 target="${boot.javac.target}" 1021 gensrc.dir="${build.bootstrap.dir}/gensrc" 1022 classes.dir="${build.bootstrap.dir}/classes" 1023 javac.bootclasspath="" 1024 bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes" 1025 sourcepath="" 1026 release="${bootstrap.release}" 1027 full.version="${bootstrap.full.version}" 1028 excludes="${bootstrap.exclude.files} **/package-info.java"/> 1029 </presetdef> 1030 </target> 1031 1032 <target name="-def-pcompile"> 1033 <mkdir dir="${build.toolclasses.dir}"/> 1034 <javac fork="true" 1035 source="${boot.javac.source}" 1036 target="${boot.javac.target}" 1037 executable="${boot.java.home}/bin/javac" 1038 srcdir="${make.tools.dir}" 1039 includes="compileproperties/* anttasks/CompileProperties* anttasks/PathFileSet*" 1040 destdir="${build.toolclasses.dir}/" 1041 classpath="${ant.core.lib}" 1042 bootclasspath="${boot.java.home}/jre/lib/rt.jar" 1043 includeantruntime="false"> 1044 <compilerarg line="${javac.lint.opts}"/> 1045 </javac> 1046 <taskdef name="pcompile" 1047 classname="anttasks.CompilePropertiesTask" 1048 classpath="${build.toolclasses.dir}/"/> 1049 </target> 1050 1051 <target name="-def-compilecrules"> 1052 <macrodef name="compilecrules"> 1053 <sequential> 1054 <mkdir dir="${build.toolclasses.dir}"/> 1055 <javac fork="true" 1056 source="${boot.javac.source}" 1057 target="${boot.javac.target}" 1058 executable="${boot.java.home}/bin/javac" 1059 srcdir="${make.tools.dir}" 1060 includes="crules/*" 1061 destdir="${build.toolclasses.dir}/" 1062 classpath="${ant.core.lib}" 1063 bootclasspath="${boot.java.home}/jre/lib/rt.jar" 1064 includeantruntime="false"> 1065 <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> 1066 <compilerarg line="${javac.lint.opts}"/> 1067 </javac> 1068 <copy todir="${build.toolclasses.dir}/" includeemptydirs="false"> 1069 <fileset dir="${make.tools.dir}"> 1070 <include name="**/*.properties"/> 1071 </fileset> 1072 </copy> 1073 </sequential> 1074 </macrodef> 1075 </target> 1076 1077 <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs"> 1078 <mkdir dir="${build.toolclasses.dir}"/> 1079 <javac fork="true" 1080 source="${boot.javac.source}" 1081 target="${boot.javac.target}" 1082 executable="${boot.java.home}/bin/javac" 1083 srcdir="${make.tools.dir}" 1084 includes="genstubs/* anttasks/GenStubs*" 1085 destdir="${build.toolclasses.dir}/" 1086 classpath="${ant.core.lib}" 1087 includeantruntime="false"> 1088 <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> 1089 <compilerarg line="${javac.lint.opts}"/> 1090 </javac> 1091 <taskdef name="genstubs" 1092 classname="anttasks.GenStubsTask" 1093 classpath="${build.toolclasses.dir}/"/> 1094 </target> 1095 1096 <target name="-def-javadoc-tool" depends="-check-target.java.home"> 1097 <macrodef name="javadoc-tool"> 1098 <attribute name="name"/> 1099 <attribute name="includes"/> 1100 <attribute name="options" default=""/> 1101 <attribute name="source" default="${javac.source}"/> 1102 <sequential> 1103 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> 1104 <!-- Note: even with this default value, includes 1105 from source directories get javadoc'd; see packageset below --> 1106 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> 1107 <javadoc 1108 executable="${target.java.home}/bin/javadoc" 1109 destdir="${build.javadoc.dir}/@{name}" 1110 source="@{source}" 1111 windowtitle="UNOFFICIAL" 1112 failonerror="true" 1113 use="true" 1114 author="false" 1115 version="false" 1116 packagenames="${javadoc.packagenames}" > 1117 <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header> 1118 <arg line="@{options}"/> 1119 <arg value="-tag" /> 1120 <arg value="implNote:a:Implementation Note:"/> 1121 <bootclasspath> 1122 <path location="${build.classes.dir}"/> 1123 <path location="${target.java.home}/jre/lib/rt.jar"/> 1124 </bootclasspath> 1125 <sourcepath> 1126 <path refid="src.dirs"/> 1127 </sourcepath> 1128 <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> --> 1129 <!-- means that {@link some.package} will not work, which is no good. --> 1130 <!-- (It correctly skips excluded single classes, but not if packageset is also included, --> 1131 <!-- which also causes duplicates in the class index for included files.) --> 1132 <packageset dir="${src.dir}/java.base/share/classes" includes="@{includes}"> 1133 <or> 1134 <filename name="java/"/> 1135 <filename name="javax/"/> 1136 <filename name="com/sun/javadoc/"/> 1137 <filename name="com/sun/source/"/> 1138 </or> 1139 </packageset> 1140 <packageset dir="${src.dir}/java.compiler/share/classes" includes="@{includes}"> 1141 <or> 1142 <filename name="java/"/> 1143 <filename name="javax/"/> 1144 <filename name="com/sun/javadoc/"/> 1145 <filename name="com/sun/source/"/> 1146 </or> 1147 </packageset> 1148 <packageset dir="${src.dir}/jdk.compiler/share/classes" includes="@{includes}"> 1149 <or> 1150 <filename name="java/"/> 1151 <filename name="javax/"/> 1152 <filename name="com/sun/javadoc/"/> 1153 <filename name="com/sun/source/"/> 1154 </or> 1155 </packageset> 1156 <packageset dir="${src.dir}/jdk.dev/share/classes" includes="@{includes}"> 1157 <or> 1158 <filename name="java/"/> 1159 <filename name="javax/"/> 1160 <filename name="com/sun/javadoc/"/> 1161 <filename name="com/sun/source/"/> 1162 </or> 1163 </packageset> 1164 <packageset dir="${src.dir}/jdk.javadoc/share/classes" includes="@{includes}"> 1165 <or> 1166 <filename name="java/"/> 1167 <filename name="javax/"/> 1168 <filename name="com/sun/javadoc/"/> 1169 <filename name="com/sun/source/"/> 1170 </or> 1171 </packageset> 1172 </javadoc> 1173 </sequential> 1174 </macrodef> 1175 </target> 1176 1177 <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home"> 1178 <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"> 1179 <classpath> 1180 <pathelement location="${jtreg.home}/lib/jtreg.jar"/> 1181 <pathelement location="${jtreg.home}/lib/javatest.jar"/> 1182 </classpath> 1183 </taskdef> 1184 <macrodef name="jtreg-tool"> 1185 <attribute name="name"/> 1186 <attribute name="tests"/> 1187 <attribute name="jdk" default="${target.java.home}"/> 1188 <attribute name="samevm" default="true"/> 1189 <attribute name="verbose" default="${default.jtreg.verbose}"/> 1190 <attribute name="options" default="${other.jtreg.options}"/> 1191 <attribute name="keywords" default="-keywords:!ignore"/> 1192 <attribute name="jpda.jvmargs" default=""/> 1193 <attribute name="extra.jvmargs" default=""/> 1194 <sequential> 1195 <property name="coverage.options" value=""/> <!-- default --> 1196 <property name="coverage.classpath" value=""/> <!-- default --> 1197 <property name="default.jtreg.verbose" value="summary"/> <!-- default --> 1198 <property name="other.jtreg.options" value=""/> <!-- default --> 1199 <jtreg 1200 dir="${test.dir}" 1201 workDir="${build.jtreg.dir}/@{name}/work" 1202 reportDir="${build.jtreg.dir}/@{name}/report" 1203 jdk="@{jdk}" 1204 samevm="@{samevm}" verbose="@{verbose}" 1205 failonerror="false" resultproperty="jtreg.@{name}.result" 1206 javacoptions="-g" 1207 vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}${build.classes.dir} @{jpda.jvmargs} @{extra.jvmargs}"> 1208 <arg line="@{keywords}"/> 1209 <arg line="@{options}"/> 1210 <arg line="@{tests}"/> 1211 </jtreg> 1212 <!-- the next two properties are for convenience, when only 1213 a single instance of jtreg will be invoked. --> 1214 <condition property="jtreg.passed"> 1215 <equals arg1="${jtreg.@{name}.result}" arg2="0"/> 1216 </condition> 1217 <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/> 1218 </sequential> 1219 </macrodef> 1220 <property name="jtreg.defined" value="true"/> 1221 </target> 1222 1223 <target name="-def-cobertura" depends="-check-cobertura.home"> 1224 <path id="cobertura.classpath"> 1225 <fileset dir="${cobertura.home}"> 1226 <include name="cobertura.jar"/> 1227 <include name="lib/**/*.jar"/> 1228 </fileset> 1229 </path> 1230 <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/> 1231 </target> 1232 1233 <target name="-def-checkstyle" unless="checkstyle.defined" 1234 depends="-check-checkstyle.home"> 1235 <taskdef resource="checkstyletask.properties"> 1236 <classpath> 1237 <pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/> 1238 </classpath> 1239 </taskdef> 1240 <property name="checkstyle.defined" value="true"/> 1241 </target> 1242 1243 <target name="-def-findbugs" unless="findbugs.defined" 1244 depends="-check-findbugs.home,-check-target.java.home"> 1245 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"> 1246 <classpath> 1247 <pathelement location="${findbugs.home}/lib/findbugs.jar"/> 1248 </classpath> 1249 </taskdef> 1250 <macrodef name="findbugs-tool"> 1251 <attribute name="name"/> 1252 <attribute name="output" default="emacs"/> 1253 <attribute name="outputFile" default=""/> 1254 <attribute name="reportLevel" default="high"/> 1255 <sequential> 1256 <findbugs 1257 home="${findbugs.home}" 1258 output="@{output}" 1259 outputFile="@{outputFile}" 1260 reportLevel="@{reportLevel}" 1261 failOnError="false" 1262 errorProperty="findbugs.@{name}.errors" 1263 warningsProperty="findbugs.@{name}.warnings" 1264 jvm="${target.java.home}/bin/java" 1265 jvmargs="-Xmx512M" > 1266 <class location="${dist.dir}/lib/@{name}.jar"/> 1267 <auxClasspath> 1268 <pathelement location="${build.classes.dir}"/> 1269 </auxClasspath> 1270 <sourcePath> 1271 <path refid="src.dirs"/> 1272 </sourcePath> 1273 </findbugs> 1274 </sequential> 1275 </macrodef> 1276 <property name="findbugs.defined" value="true"/> 1277 </target> 1278 1279 <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant"> 1280 <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/> 1281 <property name="vizant.defined" value="true"/> 1282 </target> 1283 1284 <target name="-def-check"> 1285 <macrodef name="check"> 1286 <attribute name="name"/> 1287 <attribute name="property"/> 1288 <attribute name="marker" default=""/> 1289 <sequential> 1290 <fail message="Cannot locate @{name}: please set @{property} to its location"> 1291 <condition> 1292 <not> 1293 <isset property="@{property}"/> 1294 </not> 1295 </condition> 1296 </fail> 1297 <fail message="@{name} is not installed in ${@{property}}"> 1298 <condition> 1299 <and> 1300 <not> 1301 <equals arg1="@{marker}" arg2=""/> 1302 </not> 1303 <not> 1304 <available file="${@{property}}/@{marker}"/> 1305 </not> 1306 </and> 1307 </condition> 1308 </fail> 1309 </sequential> 1310 </macrodef> 1311 </target> 1312 1313</project> 1314 1315