build.xml revision 3062:15bdc18525ff
1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright (c) 2007, 2015, 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 a convenience build file supporting development in the langtools 29 repository. It can be run either standalone, or from IDEs. This build script 30 is for a developer use only, it is not used to build the production version 31 of javac or other langtools tools. 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 The main build happens in two phases: 43 - First, javac is built using ${boot.java.home}. (This implies a constraint 44 on the source code that they can be compiled with the previous version of JDK. 45 - Second, all required classes are compiled with the latest javac, created 46 in the previous step. 47 The build generally builds one module at time. 48 49 For more details on the stub generator, see 50 http://blogs.sun.com/jjg/entry/building_javac_for_jdk7 51 52 Internal details ... 53 54 Bootstrap classes are built into the build/bootstrap/<module-name>/classes directory. 55 Final classes are built into the build/<module-name>/classes directory. 56 Final runnable javac is in dist/bin and dist/lib. Bootstrap javac (if requested by 57 using the build-bootstrap-javac target) is built into dist/bootstrap. 58 59 This file is organized into sections as follows: 60 - global property definitions 61 - primary top level targets (cleaning, building, testing, producing javac) 62 - secondary top level targets (code analysis, diagnostics, extra documentation, etc.) 63 - utility definitions 64 --> 65 66<project name="langtools" default="build" basedir=".."> 67 <!-- 68 **** Global property definitions. 69 --> 70 71 <!-- The following locations can be used to override default property values. --> 72 73 <!-- Use this location for customizations specific to this instance of this workspace --> 74 <property file="build.properties"/> 75 76 <!-- Use this location for customizations common to all OpenJDK langtools workspaces --> 77 <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/> 78 79 <!-- Use this location for customizations common to all OpenJDK workspaces --> 80 <property file="${user.home}/.openjdk/build.properties"/> 81 82 <!-- Convenient shorthands for standard locations within the workspace. --> 83 <property name="build.dir" location="build"/> 84 <property name="build.crules.dir" location="${build.dir}/crules"/> 85 <property name="build.jtreg.dir" location="${build.dir}/jtreg"/> 86 <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/> 87 <property name="build.javadoc.dir" location="${build.dir}/javadoc"/> 88 <property name="dist.dir" location="dist"/> 89 <property name="dist.bin.dir" location="${dist.dir}/bin"/> 90 <property name="dist.lib.dir" location="${dist.dir}/lib"/> 91 <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/> 92 <property name="dist.checkstyle.dir" location="${dist.dir}/checkstyle"/> 93 <property name="make.dir" location="make"/> 94 <property name="make.conf.dir" location="${make.dir}/conf"/> 95 <property name="make.tools.dir" location="${make.dir}/tools"/> 96 <property name="test.dir" location="test"/> 97 98 <property name="boot.build.dir" location="${build.dir}/bootstrap"/> 99 <property name="boot.dist.dir" location="${dist.dir}/bootstrap"/> 100 <property name="boot.dist.bin.dir" location="${boot.dist.dir}/bin"/> 101 <property name="boot.dist.lib.dir" location="${boot.dist.dir}/lib"/> 102 103 <!-- java.marker is set to a marker file to check for within a Java install dir. 104 The best file to check for across Solaris/Linux/Windows/MacOS is one of the 105 executables; regrettably, that is OS-specific. --> 106 <condition property="java.marker" value="bin/java"> 107 <os family="unix"/> 108 </condition> 109 <condition property="java.marker" value="bin/java.exe"> 110 <os family="windows"/> 111 </condition> 112 113 <!-- Standard property values, if not overriden by earlier settings. --> 114 <property file="${make.dir}/build.properties"/> 115 116 <!-- launcher.java is used in the launcher scripts provided to run 117 the tools' jar files. If it has not already been set, then 118 default it to use ${target.java.home}, if available, otherwise 119 quietly default to simply use "java". --> 120 <condition property="launcher.java" 121 value="${target.java.home}/bin/java" else="java"> 122 <isset property="target.java.home"/> 123 </condition> 124 125 <!-- setup basic properties holding paths to all sources, generated source and class directories 126 (both boot and non-boot) --> 127 <pathconvert property="langtools.sources"> 128 <path> 129 <pathelement path="${langtools.modules}" /> 130 </path> 131 <map from="${basedir}/" to="${basedir}/src/" /> 132 <mapper type="glob" from="*" to="*/share/classes"/> 133 </pathconvert> 134 <pathconvert property="langtools.gensrc"> 135 <path> 136 <pathelement path="${langtools.modules}" /> 137 </path> 138 <map from="${basedir}/" to="${build.dir}/" /> 139 <mapper type="glob" from="*" to="*/gensrc"/> 140 </pathconvert> 141 <pathconvert property="langtools.boot.classes"> 142 <path> 143 <pathelement path="${langtools.modules}" /> 144 </path> 145 <map from="${basedir}/" to="${boot.build.dir}/" /> 146 <mapper type="glob" from="*" to="*/classes"/> 147 </pathconvert> 148 <pathconvert property="langtools.classes"> 149 <path> 150 <pathelement path="${langtools.modules}" /> 151 </path> 152 <map from="${basedir}/" to="${build.dir}/" /> 153 <mapper type="glob" from="*" to="*/classes"/> 154 </pathconvert> 155 156 <!-- 157 **** Primary targets 158 --> 159 160 <target name="clean" description="Delete all generated files"> 161 <delete dir="${build.dir}"/> 162 <delete dir="${dist.dir}"/> 163 </target> 164 165 <target name="build" depends="build-all-tools"> 166 </target> 167 168 <target name="build-all-tools" depends="build-all-classes,-def-build-all-module-jars,-def-build-tool"> 169 <build-all-module-jars /> 170 <build-tool name="javac"/> 171 <build-tool name="javadoc"/> 172 <build-tool name="javap"/> 173 <build-tool name="javah"/> 174 <build-tool name="sjavac"/> 175 <build-tool name="jshell"/> 176 </target> 177 178 <target name="build-all-classes" depends="-def-build-all-module-classes,build-bootstrap-javac-classes"> 179 <build-all-module-classes /> 180 </target> 181 182 <target name="jtreg" depends="build-all-tools,-def-jtreg"> 183 <jtreg-tool name="all" tests="${jtreg.tests}"/> 184 </target> 185 186 <target name="javadoc" depends="build-all-classes,-def-javadoc-tool"> 187 <javadoc-tool options="${javadoc.jls.option}"/> 188 </target> 189 190 <target name="build-bootstrap-javac-classes" depends="-check-boot.java.home,-def-build-all-module-classes"> 191 <build-all-module-classes compilation.kind="boot." /> 192 </target> 193 194 <!-- 195 **** Extra targets 196 --> 197 198 <target name="build-bootstrap-javac" depends="build-bootstrap-javac-classes,-def-build-all-module-jars,-def-build-tool"> 199 <build-all-module-jars compilation.kind="boot." /> 200 <build-tool name="javac" compilation.kind="boot." /> 201 </target> 202 203 <target name="jtreg-bootstrap-javac" depends="build-bootstrap-javac,-def-jtreg"> 204 <jtreg-tool name="bootstrap-javac" 205 tests="${boot.javac.tests}" 206 langtools.classes="${langtools.boot.classes}"/> 207 </target> 208 209 <target name="checkstyle" depends="-def-checkstyle" 210 description="Generates reports for code convention violations."> 211 <mkdir dir="${dist.checkstyle.dir}"/> 212 <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml" 213 failureProperty="checkstyle.failure" 214 failOnViolation="false"> 215 <formatter type="xml" tofile="${dist.checkstyle.dir}/checkstyle_report.xml"/> 216 <fileset dir="src" includes="**/*.java, **/*.properties"/> 217 </checkstyle> 218 <!-- transform the output to a simple html --> 219 <xslt in="${dist.checkstyle.dir}/checkstyle_report.xml" 220 out="${dist.checkstyle.dir}/checkstyle_report.html" 221 style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/> 222 <!-- transform the output to a very simple emacs friendly text file --> 223 <xslt in="${dist.checkstyle.dir}/checkstyle_report.xml" 224 out="${dist.checkstyle.dir}/checkstyle_report.tmp" 225 style="${make.conf.dir}/checkstyle-emacs.xsl"/> 226 <!-- beautify remove extra lines --> 227 <move file="${dist.checkstyle.dir}/checkstyle_report.tmp" 228 toFile="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"> 229 <filterchain> 230 <ignoreblank/> 231 <replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/> 232 </filterchain> 233 </move> 234 </target> 235 <!-- target can be invoked from an ide, the output of which can be used 236 to access and fix the errors directly. 237 --> 238 <target name="checkstyle-ide" depends="checkstyle"> 239 <concat> 240 <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/> 241 </concat> 242 </target> 243 244 <target name="findbugs" depends="-def-findbugs,build-all-tools"> 245 <property name="findbugs.reportLevel" value="medium"/> 246 <mkdir dir="${dist.findbugs.dir}"/> 247 <findbugs 248 home="${findbugs.home}" 249 projectName="JDK langtools ${full.version}" 250 output="xml" 251 outputFile="${dist.findbugs.dir}/findbugs.xml" 252 reportLevel="${findbugs.reportLevel}" 253 failOnError="false" 254 errorProperty="findbugs.all.errors" 255 warningsProperty="findbugs.all.warnings" 256 jvm="${target.java.home}/bin/java" 257 jvmargs="-Xmx512M"> 258 <class location="${build.dir}/java.compiler/classes"/> 259 <class location="${build.dir}/jdk.compiler/classes"/> 260 <class location="${build.dir}/jdk.javadoc/classes"/> 261 <class location="${build.dir}/jdk.jdeps/classes"/> 262 <sourcePath> 263 <pathelement path="${langtools.sources}"/> 264 </sourcePath> 265 </findbugs> 266 <exec executable="sh"> 267 <arg value="${findbugs.home}/bin/convertXmlToText"/> 268 <arg value="-longBugCodes"/> 269 <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/> 270 <arg value="${dist.findbugs.dir}/findbugs.xml"/> 271 <redirector output="${dist.findbugs.dir}/findbugs.html"/> 272 </exec> 273 </target> 274 275 <target name="diags-examples" depends="build-all-tools"> 276 <!-- can override the following on the command line if desired. --> 277 <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/> 278 <mkdir dir="${build.dir}/diag-examples/classes"/> 279 <javac fork="true" 280 executable="${dist.bin.dir}/javac" 281 srcdir="test/tools/javac/diags" 282 destdir="${build.dir}/diag-examples/classes" 283 includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java" 284 sourcepath="" 285 classpath="${langtools.classes}" 286 includeAntRuntime="no" 287 debug="${javac.debug}" 288 debuglevel="${javac.debuglevel}"> 289 <compilerarg line="${javac.lint.opts}"/> 290 </javac> 291 <java fork="true" 292 jvm="${target.java.home}/bin/java" 293 dir="test/tools/javac/diags" 294 classpath="${build.dir}/diag-examples/classes;${langtools.classes}" 295 classname="RunExamples"> 296 <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/> 297 <arg value="-examples"/> 298 <arg value="examples"/> 299 <arg value="-o"/> 300 <arg file="${diags.examples.out}"/> 301 <arg value="-showFiles"/> 302 <arg value="-title"/> 303 <arg value="Examples of javac diagnostics"/> 304 </java> 305 </target> 306 307 <target name="doclint-api" depends="build-all-classes"> 308 <delete dir="${build.dir}/doclint/classes"/> 309 <mkdir dir="${build.dir}/doclint/classes"/> 310 <javac fork="true" 311 executable="${boot.java.home}/bin/javac" 312 destdir="${build.dir}/doclint/classes" 313 includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**" 314 excludes="" 315 sourcepath="" 316 classpath="${langtools.classes}" 317 includeAntRuntime="no" 318 source="${javac.source}" 319 target="${javac.target}" 320 debug="${javac.debug}" 321 debuglevel="${javac.debuglevel}"> 322 <compilerarg value="-implicit:none"/> 323 <compilerarg value="-Xprefer:source"/> 324 <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> 325 <compilerarg line="${javac.extra.opts}"/> 326 <compilerarg line="-Xdoclint:all/protected,-missing"/> 327 <src> 328 <pathelement path="${langtools.sources}"/> 329 <pathelement path="${langtools.gensrc}"/> 330 </src> 331 </javac> 332 </target> 333 334 <!-- Generate API docs for "important" test classes that are used by 335 multiple tests. 336 --> 337 <target name="test-framework-docs" depends="build-all-classes"> 338 <javadoc executable="${target.java.home}/bin/javadoc" 339 destdir="${build.dir}/testframeworkdocs"> 340 <!-- disable doclint for now; it might be good to enable -Xdoclint:missing --> 341 <arg value="-Xdoclint:none"/> 342 <!-- source files to be documented --> 343 <sourcefiles> 344 <fileset dir="${test.dir}"> 345 <include name="**/ToolBox.java"/> 346 <include name="**/*Tester.java"/> 347 <include name="**/*TestBase.java"/> 348 <include name="**/*Testing*.java"/> 349 </fileset> 350 </sourcefiles> 351 <!-- source path used for documentation --> 352 <sourcepath> 353 <pathelement path="${test.dir}/lib"/> 354 <pathelement path="${test.dir}/lib/combo"/> 355 <pathelement path="${test.dir}/tools/javac/lib"/> 356 <pathelement path="${test.dir}/tools/javac/classfiles/attributes/LocalVariableTable"/> 357 </sourcepath> 358 <!-- exclude the following "packages" found by <javadoc> 359 on the sourcepath --> 360 <excludepackage name="combo.tools.javac.combo"/> 361 <excludepackage name="tools.javac.combo"/> 362 <!-- library classes used for documentation --> 363 <classpath> 364 <pathelement path="${jtreg.home}/lib/testng.jar"/> 365 </classpath> 366 <!-- platform classes used for documentation --> 367 <bootclasspath> 368 <pathelement path="${langtools.classes}"/> 369 <pathelement path="${target.java.home}/jre/lib/rt.jar"/> 370 </bootclasspath> 371 </javadoc> 372 </target> 373 374 <target name="sanity" 375 description="display settings of configuration values"> 376 <echo level="info">ant.home = ${ant.home}</echo> 377 <echo level="info">boot.java.home = ${boot.java.home}</echo> 378 <echo level="info">target.java.home = ${target.java.home}</echo> 379 <echo level="info">jtreg.home = ${jtreg.home}</echo> 380 <echo level="info">findbugs.home = ${findbugs.home}</echo> 381 <echo level="info">checkstyle.home = ${checkstyle.home}</echo> 382 </target> 383 384 <target name="diagnostics"> 385 <diagnostics/> 386 </target> 387 388 <target name="jtreg-crules" depends="build-all-classes,-def-jtreg"> 389 <mkdir dir="${build.crules.dir}/classes"/> 390 <javac fork="true" 391 source="${boot.javac.source}" 392 target="${boot.javac.target}" 393 executable="${boot.java.home}/bin/javac" 394 srcdir="${make.tools.dir}" 395 includes="crules/*" 396 destdir="${build.crules.dir}/classes" 397 includeantruntime="false"> 398 <compilerarg value="-Xbootclasspath/p:${langtools.classes}"/> 399 <compilerarg line="${javac.lint.opts}"/> 400 </javac> 401 <copy todir="${build.crules.dir}/classes" includeemptydirs="false"> 402 <fileset dir="${make.tools.dir}"> 403 <include name="**/*.properties"/> 404 </fileset> 405 </copy> 406 <echo file="${build.crules.dir}/classes/META-INF/services/com.sun.source.util.Plugin">crules.CodingRulesAnalyzerPlugin</echo> 407 <jtreg-tool name="crules" 408 tests="${crules.tests}" 409 extra.jvmargs="-Xbootclasspath/a:${build.crules.dir}/classes" /> 410 </target> 411 412 <!-- 413 **** IDE support 414 --> 415 416 <target name="idea"> 417 <mkdir dir=".idea"/> 418 <copy todir=".idea" > 419 <fileset dir="make/intellij" excludes="**/src/**"/> 420 </copy> 421 <condition property="jtreg.idea.home" value="${jtreg.home}" else = "[jtreg.home]"> 422 <isset property="jtreg.home"/> 423 </condition> 424 <replace file=".idea/ant.xml" token="@@@" value="${jtreg.idea.home}"/> 425 <replace file=".idea/workspace.xml" token="@FILE_SEP@" value="${file.separator}"/> 426 <replace file=".idea/workspace.xml" token="@PATH_SEP@" value="${path.separator}"/> 427 <mkdir dir=".idea/classes"/> 428 <javac srcdir="make/intellij/src" 429 destdir=".idea/classes"/> 430 </target> 431 432 <!-- 433 **** Check targets. 434 **** "-check-*" targets check that a required property is set, and set to a reasonable value. 435 **** A user friendly message is generated if not, and the build exits. 436 --> 437 438 <target name="-check-boot.java.home" depends="-def-check"> 439 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> 440 </target> 441 442 <target name="-check-target.java.home" depends="-def-check"> 443 <check name="target java" property="target.java.home" marker="${java.marker}"/> 444 </target> 445 446 <target name="-check-jtreg.home" depends="-def-check"> 447 <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/> 448 </target> 449 450 <target name="-check-findbugs.home" depends="-def-check"> 451 <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/> 452 </target> 453 454 <target name="-check-checkstyle.home" depends="-def-check"> 455 <check name="checkstyle" property="checkstyle.home" marker=""/> <!--TODO: better checkstyle verification--> 456 </target> 457 458 <!-- Definitions --> 459 460 <target name="-def-build-all-module-jars" depends="-def-build-module-jar"> 461 <macrodef name="build-all-module-jars"> 462 <attribute name="compilation.kind" default=""/> 463 <sequential> 464 <build-module-jar module.name="java.compiler" compilation.kind="@{compilation.kind}" /> 465 <build-module-jar module.name="jdk.compiler" compilation.kind="@{compilation.kind}" /> 466 <build-module-jar module.name="jdk.javadoc" compilation.kind="@{compilation.kind}" /> 467 <build-module-jar module.name="jdk.jdeps" compilation.kind="@{compilation.kind}" /> 468 <build-module-jar module.name="jdk.internal.le" compilation.kind="@{compilation.kind}" /> 469 <build-module-jar module.name="jdk.jdi" compilation.kind="@{compilation.kind}" /> 470 <build-module-jar module.name="jdk.jshell" compilation.kind="@{compilation.kind}" /> 471 </sequential> 472 </macrodef> 473 </target> 474 475 <target name="-def-build-module-jar"> 476 <macrodef name="build-module-jar"> 477 <attribute name="module.name"/> 478 <attribute name="compilation.kind"/> 479 <attribute name="dependencies" default="${@{compilation.kind}@{module.name}.dependencies}"/> 480 <attribute name="build.dir" default="${@{compilation.kind}build.dir}"/> 481 <attribute name="lib.dir" default="${@{compilation.kind}dist.lib.dir}"/> 482 <attribute name="classes.dir" default="@{build.dir}/@{module.name}/classes"/> 483 <sequential> 484 <mkdir dir="@{lib.dir}"/> 485 <local name="jarclasspath" /> 486 <pathconvert property="jarclasspath"> 487 <path> 488 <pathelement path="@{dependencies}" /> 489 </path> 490 <map from="${basedir}/" to="" /> 491 <mapper type="glob" from="*" to="*.jar"/> 492 </pathconvert> 493 <jar destfile="@{lib.dir}/@{module.name}.jar" 494 basedir="@{classes.dir}"> 495 <manifest> 496 <attribute name="Class-Path" value="@{jarclasspath}"/> 497 </manifest> 498 </jar> 499 </sequential> 500 </macrodef> 501 </target> 502 503 <target name="-def-build-tool"> 504 <macrodef name="build-tool"> 505 <attribute name="name"/> 506 <attribute name="compilation.kind" default=""/> 507 <attribute name="bin.dir" default="${@{compilation.kind}dist.bin.dir}"/> 508 <attribute name="java" default="${launcher.java}"/> 509 <attribute name="main.class" default="${tool.@{name}.main.class}"/> 510 <sequential> 511 <mkdir dir="@{bin.dir}"/> 512 <copy file="${make.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}"> 513 <filterset begintoken="#" endtoken="#"> 514 <filter token="PROGRAM" value="@{main.class}"/> 515 <filter token="TARGET_JAVA" value="@{java}"/> 516 <filter token="PS" value="${path.separator}"/> 517 </filterset> 518 </copy> 519 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/> 520 </sequential> 521 </macrodef> 522 </target> 523 524 <target name="-def-build-all-module-classes" depends="-def-build-module-classes"> 525 <macrodef name="build-all-module-classes"> 526 <attribute name="compilation.kind" default=""/> 527 <sequential> 528 <build-module-classes module.name="java.compiler" 529 compilation.kind="@{compilation.kind}" /> 530 <build-module-classes module.name="jdk.compiler" 531 compilation.kind="@{compilation.kind}" 532 resource.includes="${javac.resource.includes}" /> 533 <build-module-classes module.name="jdk.javadoc" 534 compilation.kind="@{compilation.kind}" /> 535 <build-module-classes module.name="jdk.jdeps" 536 compilation.kind="@{compilation.kind}" /> 537 <copy-module-classes module.name="jdk.internal.le" 538 compilation.kind="@{compilation.kind}" /> 539 <copy-module-classes module.name="jdk.jdi" 540 compilation.kind="@{compilation.kind}" /> 541 <build-module-classes module.name="jdk.jshell" 542 compilation.kind="@{compilation.kind}" /> 543 </sequential> 544 </macrodef> 545 </target> 546 547 <target name="-def-build-module-classes" depends="-def-pcompile,-def-pparse,-def-cdumper"> 548 <macrodef name="build-module-classes"> 549 <attribute name="module.name"/> 550 <attribute name="compilation.kind" default=""/> 551 <attribute name="resource.includes" default="nonExistent" /> 552 <attribute name="dependencies" default="${@{module.name}.dependencies}"/> 553 <attribute name="includes" default="${@{compilation.kind}javac.includes}"/> 554 <attribute name="javac.lint.opts" default="${@{compilation.kind}javac.lint.opts}"/> 555 <attribute name="javac.extra.opts" default="${@{compilation.kind}javac.extra.opts}"/> 556 <attribute name="build.dir" default="${@{compilation.kind}build.dir}"/> 557 <attribute name="excludes" default="${exclude.files} **/package-info.java"/> 558 <attribute name="classes.dir" default="@{build.dir}/@{module.name}/classes"/> 559 <attribute name="gensrc.dir" default="@{build.dir}/@{module.name}/gensrc"/> 560 <attribute name="depcache.dir" default="@{build.dir}/@{module.name}/depcache"/> 561 <attribute name="java.home" default="${boot.java.home}"/> 562 <attribute name="source" default="${@{compilation.kind}javac.source}"/> 563 <attribute name="target" default="${@{compilation.kind}javac.target}"/> 564 <attribute name="release" default="${release}"/> 565 <attribute name="full.version" default="${full.version}"/> 566 <attribute name="plugin.options" default=""/> 567 <sequential> 568 <echo level="verbose" message="build-classes: excludes=@{excludes}"/> 569 <echo level="verbose" message="build-classes: classpath=@{classpath}"/> 570 <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/> 571 <echo level="verbose" message="build-classes: dependencies=@{dependencies}"/> 572 <local name="src.dir" /> 573 <property name="src.dir" location="${basedir}/src/@{module.name}/share/classes"/> 574 <local name="classpath" /> 575 <pathconvert property="classpath"> 576 <path> 577 <pathelement path="@{dependencies}" /> 578 </path> 579 <map from="${basedir}/" to="@{build.dir}/" /> 580 <mapper type="glob" from="*" to="*/classes"/> 581 </pathconvert> 582 <local name="bootclasspath.prepend"/> 583 <condition property="bootclasspath.prepend" value="" else="${langtools.boot.classes}"> 584 <equals arg1="@{compilation.kind}" arg2="boot."/> 585 </condition> 586 <mkdir dir="@{classes.dir}"/> 587 <mkdir dir="@{gensrc.dir}"/> 588 <mkdir dir="@{depcache.dir}"/> 589 <pcompile destdir="@{gensrc.dir}" 590 includes="@{includes}"> 591 <src> 592 <path location="${src.dir}"/> 593 </src> 594 </pcompile> 595 <pparse destdir="@{gensrc.dir}" 596 includes="@{resource.includes}"> 597 <src> 598 <path location="${src.dir}"/> 599 </src> 600 </pparse> 601 <copy todir="@{gensrc.dir}"> 602 <fileset dir="${src.dir}" includes="@{includes}" /> 603 <globmapper from="*.properties-template" to="*.properties"/> 604 <filterset begintoken="$(" endtoken=")"> 605 <filter token="JDK_VERSION" value="${jdk.version}"/> 606 <filter token="RELEASE" value="@{release}"/> 607 <filter token="FULL_VERSION" value="@{full.version}"/> 608 </filterset> 609 </copy> 610 <pcompile destdir="@{gensrc.dir}" 611 includes="**/*.properties"> 612 <src> 613 <pathelement location="@{gensrc.dir}"/> 614 </src> 615 </pcompile> 616 <antcall target="-do-depend"> 617 <param name="src.dir" value="${src.dir}" /> 618 <param name="classes.dir" value="@{classes.dir}" /> 619 <param name="gensrc.dir" value="@{gensrc.dir}" /> 620 <param name="depcache.dir" value="@{depcache.dir}" /> 621 <param name="classpath" value="${classpath}" /> 622 </antcall> 623 <javac fork="true" 624 executable="@{java.home}/bin/javac" 625 destdir="@{classes.dir}" 626 includes="@{includes}" 627 excludes="@{excludes}" 628 sourcepath="${src.dir}:@{gensrc.dir}" 629 classpath="${classpath}" 630 includeAntRuntime="no" 631 source="@{source}" 632 target="@{target}" 633 debug="${javac.debug}" 634 debuglevel="${javac.debuglevel}"> 635 <compilerarg value="-implicit:none"/> 636 <compilerarg value="-Xprefer:source"/> 637 <compilerarg value="-J-Xbootclasspath/p:${bootclasspath.prepend}"/> 638 <compilerarg value="-Xbootclasspath/p:${classpath}"/> 639 <compilerarg line="@{javac.extra.opts}"/> 640 <compilerarg line="@{javac.lint.opts}"/> 641 <compilerarg line="@{plugin.options}"/> 642 <src> 643 <path location="${src.dir}"/> 644 <path location="@{gensrc.dir}"/> 645 </src> 646 </javac> 647 <copy todir="@{classes.dir}" includeemptydirs="false"> 648 <fileset dir="${src.dir}" includes="@{includes}" excludes="@{excludes}"> 649 <exclude name="**/*.java"/> 650 <exclude name="**/*.properties"/> 651 <exclude name="**/*-template"/> 652 <exclude name="**/*.rej"/> 653 <exclude name="**/*.orig"/> 654 <exclude name="**/overview.html"/> 655 <exclude name="**/package.html"/> 656 </fileset> 657 </copy> 658 </sequential> 659 </macrodef> 660 <macrodef name="copy-module-classes"> 661 <attribute name="module.name"/> 662 <attribute name="compilation.kind" default=""/> 663 <attribute name="build.dir" default="${@{compilation.kind}build.dir}"/> 664 <attribute name="classes.dir" default="@{build.dir}/@{module.name}/classes"/> 665 <attribute name="java.home" default="${boot.java.home}"/> 666 <sequential> 667 <property name="classes.origin.dir" location="${target.java.home}/../../jdk/modules/@{module.name}"/> 668 <mkdir dir="@{classes.dir}"/> 669 <dumpclasses moduleName="@{module.name}" destDir="@{classes.dir}" /> 670 </sequential> 671 </macrodef> 672 </target> 673 674 <target name="-def-pparse"> 675 <mkdir dir="${build.toolclasses.dir}"/> 676 <copy todir="${build.toolclasses.dir}/propertiesparser" > 677 <fileset dir="make/tools/propertiesparser" includes="**/resources/**"/> 678 </copy> 679 <javac fork="true" 680 source="${boot.javac.source}" 681 target="${boot.javac.target}" 682 executable="${boot.java.home}/bin/javac" 683 srcdir="${make.tools.dir}" 684 includes="propertiesparser/* anttasks/PropertiesParser* anttasks/PathFileSet*" 685 destdir="${build.toolclasses.dir}/" 686 classpath="${ant.core.lib}" 687 bootclasspath="${boot.java.home}/jre/lib/rt.jar" 688 includeantruntime="false"> 689 <compilerarg line="${javac.lint.opts}"/> 690 </javac> 691 <taskdef name="pparse" 692 classname="anttasks.PropertiesParserTask" 693 classpath="${build.toolclasses.dir}/"/> 694 </target> 695 696 <target name="-def-cdumper"> 697 <mkdir dir="${build.toolclasses.dir}"/> 698 <javac fork="true" 699 source="${boot.javac.source}" 700 target="${boot.javac.target}" 701 executable="${boot.java.home}/bin/javac" 702 srcdir="${make.tools.dir}" 703 includes="anttasks/DumpClass*" 704 destdir="${build.toolclasses.dir}/" 705 classpath="${ant.core.lib}" 706 bootclasspath="${boot.java.home}/jre/lib/rt.jar" 707 includeantruntime="false"> 708 <compilerarg line="${javac.lint.opts}"/> 709 </javac> 710 <taskdef name="dumpclasses" 711 classname="anttasks.DumpClassesTask" 712 classpath="${build.toolclasses.dir}/:${target.java.home}/jrt-fs.jar"/> 713 </target> 714 715 <target name="-do-depend" if="do.depend"> 716 <depend srcdir="${src.dir}:${gensrc.dir}" destdir="${classes.dir}" classpath="${classpath}" 717 cache="${depcache.dir}"/> 718 </target> 719 720 <target name="-def-pcompile"> 721 <mkdir dir="${build.toolclasses.dir}"/> 722 <javac fork="true" 723 source="${boot.javac.source}" 724 target="${boot.javac.target}" 725 executable="${boot.java.home}/bin/javac" 726 srcdir="${make.tools.dir}" 727 includes="compileproperties/* anttasks/CompileProperties* anttasks/PathFileSet*" 728 destdir="${build.toolclasses.dir}/" 729 classpath="${ant.core.lib}" 730 bootclasspath="${boot.java.home}/jre/lib/rt.jar" 731 includeantruntime="false"> 732 <compilerarg line="${javac.lint.opts}"/> 733 </javac> 734 <taskdef name="pcompile" 735 classname="anttasks.CompilePropertiesTask" 736 classpath="${build.toolclasses.dir}/"/> 737 </target> 738 739 <target name="-def-javadoc-tool" depends="-check-target.java.home"> 740 <macrodef name="javadoc-tool"> 741 <attribute name="includes" default="${javac.includes}"/> 742 <attribute name="options" default=""/> 743 <attribute name="source" default="${javac.source}"/> 744 <sequential> 745 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> 746 <!-- Note: even with this default value, includes 747 from source directories get javadoc'd; see packageset below --> 748 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> 749 <javadoc 750 executable="${target.java.home}/bin/javadoc" 751 destdir="${build.javadoc.dir}" 752 source="@{source}" 753 windowtitle="UNOFFICIAL" 754 failonerror="true" 755 use="true" 756 author="false" 757 version="false" 758 packagenames="${javadoc.packagenames}" > 759 <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header> 760 <arg line="@{options}"/> 761 <bootclasspath> 762 <pathelement path="${langtools.classes}"/> 763 <path location="${target.java.home}/jre/lib/rt.jar"/> 764 </bootclasspath> 765 <sourcepath> 766 <pathelement path="${langtools.sources}"/> 767 </sourcepath> 768 <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> --> 769 <!-- means that {@link some.package} will not work, which is no good. --> 770 <!-- (It correctly skips excluded single classes, but not if packageset is also included, --> 771 <!-- which also causes duplicates in the class index for included files.) --> 772 <packageset dir="${basedir}/src/java.compiler/share/classes" includes="@{includes}"> 773 <or> 774 <filename name="javax/"/> 775 </or> 776 </packageset> 777 <packageset dir="${basedir}/src/jdk.compiler/share/classes" includes="@{includes}"> 778 <or> 779 <filename name="com/sun/source/"/> 780 </or> 781 </packageset> 782 <packageset dir="${basedir}/src/jdk.javadoc/share/classes" includes="@{includes}"> 783 <or> 784 <filename name="com/sun/javadoc/"/> 785 </or> 786 </packageset> 787 </javadoc> 788 </sequential> 789 </macrodef> 790 </target> 791 792 <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home"> 793 <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"> 794 <classpath> 795 <pathelement location="${jtreg.home}/lib/jtreg.jar"/> 796 <pathelement location="${jtreg.home}/lib/javatest.jar"/> 797 </classpath> 798 </taskdef> 799 <macrodef name="jtreg-tool"> 800 <attribute name="name"/> 801 <attribute name="tests"/> 802 <attribute name="langtools.classes" default="${langtools.classes}"/> 803 <attribute name="jdk" default="${target.java.home}"/> 804 <attribute name="samevm" default="true"/> 805 <attribute name="verbose" default="${default.jtreg.verbose}"/> 806 <attribute name="options" default="${other.jtreg.options}"/> 807 <attribute name="keywords" default="-keywords:!ignore"/> 808 <attribute name="jpda.jvmargs" default=""/> 809 <attribute name="extra.jvmargs" default=""/> 810 <attribute name="build.dir" default="${build.dir}"/> 811 <sequential> 812 <property name="coverage.options" value=""/> <!-- default --> 813 <property name="coverage.classpath" value=""/> <!-- default --> 814 <property name="default.jtreg.verbose" value="summary"/> <!-- default --> 815 <property name="other.jtreg.options" value=""/> <!-- default --> 816 <jtreg 817 dir="${test.dir}" 818 workDir="${build.jtreg.dir}/@{name}/work" 819 reportDir="${build.jtreg.dir}/@{name}/report" 820 jdk="@{jdk}" 821 samevm="@{samevm}" verbose="@{verbose}" 822 failonerror="false" resultproperty="jtreg.@{name}.result" 823 javacoptions="-g" 824 vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}${path.separator}@{langtools.classes} @{jpda.jvmargs} @{extra.jvmargs}"> 825 <arg line="@{keywords}"/> 826 <arg line="@{options}"/> 827 <arg line="@{tests}"/> 828 </jtreg> 829 <!-- the next two properties are for convenience, when only 830 a single instance of jtreg will be invoked. --> 831 <condition property="jtreg.passed"> 832 <equals arg1="${jtreg.@{name}.result}" arg2="0"/> 833 </condition> 834 <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/> 835 </sequential> 836 </macrodef> 837 <property name="jtreg.defined" value="true"/> 838 </target> 839 840 <target name="-def-checkstyle" unless="checkstyle.defined" depends="-check-checkstyle.home"> 841 <taskdef resource="checkstyletask.properties"> 842 <classpath> 843 <fileset dir="${checkstyle.home}"> 844 <include name="checkstyle-*-all.jar"/> 845 </fileset> 846 </classpath> 847 </taskdef> 848 <property name="checkstyle.defined" value="true"/> 849 </target> 850 851 <target name="-def-findbugs" unless="findbugs.defined" 852 depends="-check-findbugs.home,-check-target.java.home"> 853 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"> 854 <classpath> 855 <pathelement location="${findbugs.home}/lib/findbugs.jar"/> 856 </classpath> 857 </taskdef> 858 <macrodef name="findbugs-tool"> 859 <attribute name="name"/> 860 <attribute name="output" default="emacs"/> 861 <attribute name="outputFile" default=""/> 862 <attribute name="reportLevel" default="high"/> 863 <sequential> 864 <findbugs 865 home="${findbugs.home}" 866 output="@{output}" 867 outputFile="@{outputFile}" 868 reportLevel="@{reportLevel}" 869 failOnError="false" 870 errorProperty="findbugs.@{name}.errors" 871 warningsProperty="findbugs.@{name}.warnings" 872 jvm="${target.java.home}/bin/java" 873 jvmargs="-Xmx512M" > 874 <class location="${dist.dir}/lib/@{name}.jar"/> 875 <auxClasspath> 876 <pathelement location="${langtools.classes}"/> 877 </auxClasspath> 878 <sourcePath> 879 <path refid="src.dirs"/> 880 </sourcePath> 881 </findbugs> 882 </sequential> 883 </macrodef> 884 <property name="findbugs.defined" value="true"/> 885 </target> 886 887 <target name="-def-check"> 888 <macrodef name="check"> 889 <attribute name="name"/> 890 <attribute name="property"/> 891 <attribute name="marker" default=""/> 892 <sequential> 893 <fail message="Cannot locate @{name}: please set @{property} to its location"> 894 <condition> 895 <not> 896 <isset property="@{property}"/> 897 </not> 898 </condition> 899 </fail> 900 <fail message="@{name} is not installed in ${@{property}}"> 901 <condition> 902 <and> 903 <not> 904 <equals arg1="@{marker}" arg2=""/> 905 </not> 906 <not> 907 <available file="${@{property}}/@{marker}"/> 908 </not> 909 </and> 910 </condition> 911 </fail> 912 </sequential> 913 </macrodef> 914 </target> 915 916</project> 917 918