build.xml revision 53:eaf608c64fec
1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this 9 particular file as subject to the "Classpath" exception as provided 10 by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23 CA 95054 USA or visit www.sun.com if you need additional information or 24 have any questions. 25--> 26 27<!-- 28 This is the main build file for the complete langtools workspace. 29 It is used both when working on the tools in NetBeans, and when building 30 JDK itself, in which case it is invoked from the wrapper Makefile. 31 --> 32 33<project name="langtools" default="build" basedir=".."> 34 35 <!-- The following locations can be used to override default property values. --> 36 37 <!-- Use this location for customizations specific to this instance of this workspace --> 38 <property file="build.properties"/> 39 40 <!-- Use this location for customizations common to all OpenJDK langtools workspaces --> 41 <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/> 42 43 <!-- Use this location for customizations common to all OpenJDK workspaces --> 44 <property file="${user.home}/.openjdk/build.properties"/> 45 46 <!-- Convenient shorthands for standard locations within the workspace. --> 47 <property name="build.dir" location="build"/> 48 <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/> 49 <property name="build.coverage.dir" location="${build.dir}/coverage"/> 50 <property name="build.classes.dir" location="${build.dir}/classes"/> 51 <property name="build.gensrc.dir" location="${build.dir}/gensrc"/> 52 <property name="build.javadoc.dir" location="${build.dir}/javadoc"/> 53 <property name="build.jtreg.dir" location="${build.dir}/jtreg"/> 54 <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/> 55 <property name="dist.dir" location="dist"/> 56 <property name="dist.bin.dir" location="${dist.dir}/bin"/> 57 <property name="dist.coverage.dir" location="${dist.dir}/coverage"/> 58 <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/> 59 <property name="dist.lib.dir" location="${dist.dir}/lib"/> 60 <property name="make.dir" location="make"/> 61 <property name="make.tools.dir" location="${make.dir}/tools"/> 62 <property name="src.dir" location="src"/> 63 <property name="src.bin.dir" location="${src.dir}/share/bin"/> 64 <property name="src.classes.dir" location="${src.dir}/share/classes"/> 65 <property name="test.dir" location="test"/> 66 67 <!-- java.marker is set to a marker file to check for within a Java install dir. 68 The best file to check for across Solaris/Linux/Windows/MacOS is one of the 69 executables; regrettably, that is OS-specific. --> 70 <condition property="java.marker" value="bin/java"> 71 <os family="unix"/> 72 </condition> 73 <condition property="java.marker" value="bin/java.exe"> 74 <os family="windows"/> 75 </condition> 76 77 <!-- Standard property values, if not overriden by earlier settings. --> 78 <property file="${make.dir}/build.properties"/> 79 80 <!-- Standard target to build deliverables for JDK build. --> 81 82 <target name="build" depends="build-bootstrap-tools,build-all-classes"> 83 <copy todir="${dist.dir}/bootstrap"> 84 <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/> 85 </copy> 86 <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx"> 87 <include name="*"/> 88 </chmod> 89 <mkdir dir="${dist.lib.dir}"/> 90 <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/> 91 <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/> 92 </target> 93 94 <target name="build-bootstrap-tools" depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"/> 95 96 <target name="build-all-tools" depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"/> 97 98 <target name="build-all-classes" depends="build-classes-javac,build-classes-javadoc,build-classes-doclets,build-classes-javah,build-classes-javap,build-classes-apt"/> 99 100 <!-- clean --> 101 102 <target name="clean" description="Delete all generated files"> 103 <delete dir="${build.dir}"/> 104 <delete dir="${dist.dir}"/> 105 </target> 106 107 <!-- Additional targets for running tools on the build --> 108 109 <!-- An alternative for the following would be to do a single jtreg run for all tests. 110 However, that would currently be slower, since we would have to run all the tests 111 with samevm="false", since not all test directories currently support samevm="true". --> 112 113 <target name="jtreg" depends="jtreg-javac,jtreg-javadoc,jtreg-doclets,jtreg-javah,jtreg-javap,jtreg-apt"/> 114 115 <target name="findbugs" depends="-def-findbugs,build-all-tools"> 116 <property name="findbugs.reportLevel" value="medium"/> 117 <mkdir dir="${dist.findbugs.dir}"/> 118 <findbugs 119 home="${findbugs.home}" 120 projectName="JDK langtools ${full.version}" 121 output="xml" 122 outputFile="${dist.findbugs.dir}/findbugs.xml" 123 reportLevel="${findbugs.reportLevel}" 124 failOnError="false" 125 errorProperty="findbugs.all.errors" 126 warningsProperty="findbugs.all.warnings" 127 jvmargs="-Xmx512M"> 128 <class location="${build.classes.dir}"/> 129 <sourcePath> 130 <pathelement location="${src.classes.dir}"/> 131 </sourcePath> 132 </findbugs> 133 <exec executable="sh"> 134 <arg value="${findbugs.home}/bin/convertXmlToText"/> 135 <arg value="-longBugCodes"/> 136 <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/> 137 <arg value="${dist.findbugs.dir}/findbugs.xml"/> 138 <redirector output="${dist.findbugs.dir}/findbugs.html"/> 139 </exec> 140 </target> 141 142 <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/> 143 144 <target name="instrument-classes" depends="-def-cobertura"> 145 <!-- only define the following property when we want coverage info --> 146 <path id="coverage.classpath"> 147 <pathelement location="${build.coverage.dir}/classes"/> 148 <path refid="cobertura.classpath"/> 149 </path> 150 <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/> 151 <property name="coverage.classpath" refid="coverage.classpath"/> 152 <mkdir dir="${build.coverage.dir}/classes"/> 153 <delete file="${build.coverage.dir}/cobertura.ser"/> 154 <cobertura-instrument todir="${build.coverage.dir}/classes" 155 datafile="${build.coverage.dir}/cobertura.ser"> 156 <fileset dir="${build.classes.dir}" 157 includes="**/*.class" excludes="**/resources/*.class"/> 158 </cobertura-instrument> 159 </target> 160 161 <target name="coverage-report" depends="-def-cobertura"> 162 <mkdir dir="${dist.coverage.dir}"/> 163 <cobertura-report 164 srcdir="${src.classes.dir}" 165 destdir="${dist.coverage.dir}" 166 datafile="${build.coverage.dir}/cobertura.ser"/> 167 <cobertura-report 168 format="xml" 169 srcdir="${src.classes.dir}" 170 destdir="${dist.coverage.dir}" 171 datafile="${build.coverage.dir}/cobertura.ser"/> 172 </target> 173 174 <!-- javac targets --> 175 176 <target name="build-bootstrap-javac" depends="-def-build-bootstrap-tool"> 177 <build-bootstrap-tool name="javac" includes="${javac.includes}"/> 178 </target> 179 180 <target name="build-classes-javac" depends="build-bootstrap-javac"> 181 <build-classes name="javac" includes="${javac.includes}"/> 182 </target> 183 184 <target name="build-javac" depends="build-bootstrap-javac"> 185 <build-tool name="javac" includes="${javac.includes}"/> 186 </target> 187 188 <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool"> 189 <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls3.option}"/> 190 </target> 191 192 <target name="jtreg-javac" depends="build-javac,-def-jtreg"> 193 <jtreg-tool name="javac" samevm="true" tests="${javac.tests}"/> 194 </target> 195 196 <target name="findbugs-javac" depends="build-javac,-def-findbugs"> 197 <findbugs-tool name="javac"/> 198 </target> 199 200 <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/> 201 202 <!-- javadoc targets --> 203 204 <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac"> 205 <build-bootstrap-tool name="javadoc" 206 includes="${javadoc.includes}" 207 jarclasspath="javac.jar doclets.jar"/> 208 </target> 209 210 <target name="build-classes-javadoc" depends="build-classes-javac"> 211 <build-classes name="javadoc" includes="${javadoc.includes}"/> 212 </target> 213 214 <target name="build-javadoc" depends="build-javac"> 215 <build-tool name="javadoc" 216 includes="${javadoc.includes}" 217 jarclasspath="javac.jar doclets.jar"/> 218 </target> 219 220 <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool"> 221 <javadoc-tool name="javadoc" includes="${javadoc.includes}"/> 222 </target> 223 224 <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg"> 225 <jtreg-tool name="javadoc" samevm="false" tests="${javadoc.tests}"/> 226 </target> 227 228 <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs"> 229 <findbugs-tool name="javadoc"/> 230 </target> 231 232 <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/> 233 234 <!-- doclets targets --> 235 236 <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar"> 237 <build-bootstrap-jar name="doclets" 238 includes="${doclets.includes}" 239 jarmainclass="com.sun.tools.javadoc.Main" 240 jarclasspath="javadoc.jar"/> 241 </target> 242 243 <target name="build-classes-doclets" depends="build-classes-javadoc"> 244 <build-classes name="doclets" includes="${doclets.includes}"/> 245 </target> 246 247 <target name="build-doclets" depends="build-javadoc"> 248 <!-- just jar, no bin for doclets --> 249 <build-jar name="doclets" 250 includes="${doclets.includes}" 251 jarclasspath="javadoc.jar"/> 252 </target> 253 254 <!-- (no javadoc for doclets) --> 255 256 <target name="jtreg-doclets" depends="build-doclets,-def-jtreg"> 257 <jtreg-tool name="doclets" samevm="false" tests="${doclets.tests}"/> 258 </target> 259 260 <target name="findbugs-doclets" depends="build-doclets,-def-findbugs"> 261 <findbugs-tool name="doclets"/> 262 </target> 263 264 <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/> 265 266 <!-- javah targets --> 267 268 <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc"> 269 <build-bootstrap-tool name="javah" 270 includes="${javah.includes}" 271 jarclasspath="javadoc.jar doclets.jar javac.jar"/> 272 </target> 273 274 <target name="build-javah" depends="build-javadoc"> 275 <build-tool name="javah" 276 includes="${javah.includes}" 277 jarclasspath="javadoc.jar doclets.jar javac.jar"/> 278 </target> 279 280 <target name="build-classes-javah" depends="build-classes-javadoc"> 281 <build-classes name="javah" includes="${javah.includes}"/> 282 </target> 283 284 <!-- (no javadoc for javah) --> 285 286 <target name="jtreg-javah" depends="build-javah,-def-jtreg"> 287 <jtreg-tool name="javah" samevm="true" tests="${javah.tests}"/> 288 </target> 289 290 <target name="findbugs-javah" depends="build-javah,-def-findbugs"> 291 <findbugs-tool name="javah"/> 292 </target> 293 294 <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/> 295 296 <!-- javap targets --> 297 298 <target name="build-bootstrap-javap" depends="-def-build-bootstrap-tool"> 299 <build-bootstrap-tool name="javap" 300 includes="${javap.includes}" 301 jarmainclass="sun.tools.javap.Main"/> 302 </target> 303 304 <target name="build-classes-javap" depends="build-classes-javac"> 305 <build-classes name="javap" includes="${javap.includes}"/> 306 </target> 307 308 <target name="build-javap" depends="build-javac"> 309 <build-tool name="javap" 310 includes="${javap.includes}" 311 jarmainclass="sun.tools.javap.Main" 312 jarclasspath="javac.jar"/> 313 </target> 314 315 <!-- (no javadoc for javap) --> 316 317 <target name="jtreg-javap" depends="build-javap,-def-jtreg"> 318 <jtreg-tool name="javap" samevm="true" tests="${javap.tests}"/> 319 </target> 320 321 <target name="findbugs-javap" depends="build-javap,-def-findbugs"> 322 <findbugs-tool name="javap"/> 323 </target> 324 325 <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/> 326 327 <!-- apt targets --> 328 329 <target name="build-bootstrap-apt" depends="build-bootstrap-javac"> 330 <build-bootstrap-tool name="apt" 331 includes="${apt.includes}" 332 jarclasspath="javac.jar"/> 333 </target> 334 335 <target name="build-apt" depends="build-javac"> 336 <build-tool name="apt" 337 includes="${apt.includes}" 338 jarclasspath="javac.jar"/> 339 </target> 340 341 <target name="build-classes-apt" depends="build-classes-javac"> 342 <build-classes name="apt" includes="${apt.includes}"/> 343 </target> 344 345 <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool"> 346 <javadoc-tool name="apt" includes="${apt.includes}"/> 347 </target> 348 349 350 <target name="jtreg-apt" depends="build-apt,-def-jtreg"> 351 <jtreg-tool name="apt" samevm="true" tests="${apt.tests}"/> 352 </target> 353 354 <target name="findbugs-apt" depends="build-apt,-def-findbugs"> 355 <findbugs-tool name="apt"/> 356 </target> 357 358 <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/> 359 360 <!-- Check targets --> 361 362 <target name="-check-boot.java.home" depends="-def-check"> 363 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> 364 </target> 365 366 <target name="-check-target.java.home" depends="-def-check"> 367 <check name="target java" property="target.java.home" marker="${java.marker}"/> 368 </target> 369 370 <target name="-check-cobertura.home" depends="-def-check"> 371 <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/> 372 </target> 373 374 <target name="-check-findbugs.home" depends="-def-check"> 375 <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/> 376 </target> 377 378 <target name="-check-jtreg.home" depends="-def-check"> 379 <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/> 380 </target> 381 382 <!-- Ant macro and preset defs --> 383 384 <target name="-def-build-tool" depends="-def-build-jar"> 385 <macrodef name="build-tool"> 386 <attribute name="name"/> 387 <attribute name="includes"/> 388 <attribute name="excludes" default="**/package-info.java"/> 389 <attribute name="bin.dir" default="${dist.bin.dir}"/> 390 <attribute name="classes.dir" default="${build.classes.dir}"/> 391 <attribute name="gensrc.dir" default="${build.gensrc.dir}"/> 392 <attribute name="lib.dir" default="${dist.lib.dir}"/> 393 <attribute name="java" default="java"/> 394 <attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> 395 <attribute name="javac.target" default="${javac.target}"/> 396 <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/> 397 <attribute name="jarclasspath" default=""/> 398 <attribute name="release" default="${release}"/> 399 <attribute name="full.version" default="${full.version}"/> 400 <sequential> 401 <build-jar 402 name="@{name}" 403 gensrc.dir="@{gensrc.dir}" 404 classes.dir="@{classes.dir}" 405 lib.dir="@{lib.dir}" 406 includes="@{includes}" 407 excludes="@{excludes}" 408 jarmainclass="@{jarmainclass}" 409 jarclasspath="@{jarclasspath}" 410 release="@{release}" 411 full.version="@{full.version}" 412 javac.bootclasspath="@{javac.bootclasspath}" 413 javac.target="@{javac.target}" 414 /> 415 <mkdir dir="@{bin.dir}"/> 416 <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}"> 417 <filterset begintoken="#" endtoken="#"> 418 <filter token="PROGRAM" value="@{name}"/> 419 <filter token="TARGET_JAVA" value="@{java}"/> 420 </filterset> 421 </copy> 422 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/> 423 </sequential> 424 </macrodef> 425 </target> 426 427 <target name="-def-build-jar" depends="-def-build-classes"> 428 <macrodef name="build-jar"> 429 <attribute name="name"/> 430 <attribute name="includes"/> 431 <attribute name="excludes" default="**/package-info.java"/> 432 <attribute name="classes.dir" default="${build.classes.dir}"/> 433 <attribute name="gensrc.dir" default="${build.gensrc.dir}"/> 434 <attribute name="lib.dir" default="${dist.lib.dir}"/> 435 <attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> 436 <attribute name="javac.target" default="${javac.target}"/> 437 <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/> 438 <attribute name="jarclasspath" default=""/> 439 <attribute name="release" default="${release}"/> 440 <attribute name="full.version" default="${full.version}"/> 441 <sequential> 442 <build-classes 443 name="@{name}" 444 gensrc.dir="@{gensrc.dir}" 445 classes.dir="@{classes.dir}" 446 includes="@{includes}" 447 excludes="@{excludes}" 448 release="@{release}" 449 full.version="@{full.version}" 450 javac.bootclasspath="@{javac.bootclasspath}" 451 javac.target="@{javac.target}" 452 /> 453 <mkdir dir="@{lib.dir}"/> 454 <jar destfile="@{lib.dir}/@{name}.jar" 455 basedir="@{classes.dir}" 456 includes="@{includes}"> 457 <manifest> 458 <attribute name="Main-Class" value="@{jarmainclass}"/> 459 <attribute name="Class-Path" value="@{jarclasspath}"/> 460 </manifest> 461 </jar> 462 </sequential> 463 </macrodef> 464 </target> 465 466 <target name="-def-build-classes" depends="-def-pcompile"> 467 <macrodef name="build-classes"> 468 <attribute name="name"/> 469 <attribute name="includes"/> 470 <attribute name="excludes" default="**/package-info.java"/> 471 <attribute name="classes.dir" default="${build.classes.dir}"/> 472 <attribute name="gensrc.dir" default="${build.gensrc.dir}"/> 473 <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/> 474 <attribute name="javac.target" default="${javac.target}"/> 475 <attribute name="release" default="${release}"/> 476 <attribute name="full.version" default="${full.version}"/> 477 <sequential> 478 <mkdir dir="@{gensrc.dir}"/> 479 <mkdir dir="@{classes.dir}"/> 480 <pcompile srcdir="${src.classes.dir}" 481 destdir="@{gensrc.dir}" 482 includes="@{includes}"/> 483 <copy todir="@{gensrc.dir}"> 484 <fileset dir="${src.classes.dir}" includes="@{includes}"/> 485 <globmapper from="*.properties-template" to="*.properties"/> 486 <filterset begintoken="$(" endtoken=")"> 487 <filter token="JDK_VERSION" value="${jdk.version}"/> 488 <filter token="RELEASE" value="@{release}"/> 489 <filter token="FULL_VERSION" value="@{full.version}"/> 490 </filterset> 491 </copy> 492 <pcompile srcdir="@{gensrc.dir}" 493 destdir="@{gensrc.dir}" 494 includes="**/*.properties"/> 495 <javac fork="true" 496 srcdir="@{gensrc.dir}" 497 destdir="@{classes.dir}" 498 includes="@{includes}" 499 sourcepath="" 500 includeAntRuntime="no" 501 target="@{javac.target}"> 502 <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/> 503 <compilerarg line="${javac.version.opt}"/> 504 <compilerarg line="-Xlint"/> 505 </javac> 506 <javac fork="true" 507 srcdir="${src.classes.dir}" 508 destdir="@{classes.dir}" 509 includes="@{includes}" 510 excludes="@{excludes}" 511 sourcepath="" 512 includeAntRuntime="no" 513 target="@{javac.target}" 514 debug="${javac.debug}" 515 debuglevel="${javac.debuglevel}"> 516 <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/> 517 <compilerarg value="-Xbootclasspath/p:@{classes.dir}"/> 518 <compilerarg line="${javac.no.jdk.warnings}"/> 519 <compilerarg line="${javac.version.opt}"/> 520 <compilerarg line="${javac.lint.opts}"/> 521 </javac> 522 <copy todir="@{classes.dir}"> 523 <fileset dir="${src.classes.dir}"> 524 <include name="@{includes}"/> 525 <exclude name="**/*.java"/> 526 <exclude name="**/*.properties"/> 527 <exclude name="**/*-template"/> 528 <exclude name="**/package.html"/> 529 </fileset> 530 </copy> 531 </sequential> 532 </macrodef> 533 </target> 534 535 <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool"> 536 <presetdef name="build-bootstrap-tool"> 537 <build-tool 538 javac.target="${boot.javac.target}" 539 gensrc.dir="${build.bootstrap.dir}/gensrc" 540 classes.dir="${build.bootstrap.dir}/classes" 541 bin.dir="${build.bootstrap.dir}/bin" 542 lib.dir="${build.bootstrap.dir}/lib" 543 java="${boot.java}" 544 javac.bootclasspath="" 545 release="${bootstrap.release}" 546 full.version="${bootstrap.full.version}"/> 547 </presetdef> 548 </target> 549 550 <target name="-def-build-bootstrap-jar" depends="-def-build-jar"> 551 <presetdef name="build-bootstrap-jar"> 552 <build-jar 553 javac.target="${boot.javac.target}" 554 gensrc.dir="${build.bootstrap.dir}/gensrc" 555 classes.dir="${build.bootstrap.dir}/classes" 556 lib.dir="${build.bootstrap.dir}/lib" 557 javac.bootclasspath="" 558 release="${bootstrap.release}" 559 full.version="${bootstrap.full.version}"/> 560 </presetdef> 561 </target> 562 563 <target name="-def-pcompile"> 564 <mkdir dir="${build.toolclasses.dir}"/> 565 <javac srcdir="${make.tools.dir}/CompileProperties" 566 destdir="${build.toolclasses.dir}/" 567 classpath="${ant.home}/lib/ant.jar"/> 568 <taskdef name="pcompile" 569 classname="CompilePropertiesTask" 570 classpath="${build.toolclasses.dir}/"/> 571 </target> 572 573 <target name="-def-javadoc-tool" depends="-check-target.java.home"> 574 <macrodef name="javadoc-tool"> 575 <attribute name="name"/> 576 <attribute name="includes"/> 577 <attribute name="options" default=""/> 578 <attribute name="source" default="1.5"/> <!-- FIXME --> 579 <sequential> 580 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> 581 <!-- Note: even with this default value, includes 582 from src.classes.dir get javadoc'd; see packageset below --> 583 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> 584 <javadoc 585 executable="${target.java.home}/bin/javadoc" 586 destdir="${build.javadoc.dir}/@{name}" 587 source="@{source}" 588 windowtitle="UNOFFICIAL" 589 failonerror="true" 590 use="true" 591 author="false" 592 version="false" 593 packagenames="${javadoc.packagenames}" > 594 <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header> 595 <arg line="@{options}"/> 596 <bootclasspath> 597 <path location="${build.classes.dir}"/> 598 <path location="${target.java.home}/jre/lib/rt.jar"/> 599 </bootclasspath> 600 <sourcepath> 601 <pathelement location="${src.classes.dir}"/> 602 </sourcepath> 603 <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> --> 604 <!-- means that {@link some.package} will not work, which is no good. --> 605 <!-- (It correctly skips excluded single classes, but not if packageset is also included, --> 606 <!-- which also causes duplicates in the class index for included files.) --> 607 <packageset dir="${src.classes.dir}" includes="@{includes}"> 608 <or> 609 <filename name="java/"/> 610 <filename name="javax/"/> 611 <filename name="com/sun/javadoc/"/> 612 <filename name="com/sun/mirror/"/> 613 <filename name="com/sun/source/"/> 614 </or> 615 </packageset> 616 </javadoc> 617 </sequential> 618 </macrodef> 619 </target> 620 621 <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home"> 622 <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant"> 623 <classpath> 624 <pathelement location="${jtreg.home}/lib/jtreg.jar"/> 625 <pathelement location="${jtreg.home}/lib/javatest.jar"/> 626 </classpath> 627 </taskdef> 628 <macrodef name="jtreg-tool"> 629 <attribute name="name"/> 630 <attribute name="tests"/> 631 <attribute name="jdk" default="${target.java.home}"/> 632 <attribute name="samevm" default="false"/> 633 <attribute name="verbose" default="summary"/> 634 <attribute name="options" default=""/> 635 <attribute name="keywords" default="-keywords:!ignore"/> 636 <attribute name="jpda.jvmargs" default=""/> 637 <sequential> 638 <property name="coverage.options" value=""/> <!-- default --> 639 <property name="coverage.classpath" value=""/> <!-- default --> 640 <jtreg 641 dir="${test.dir}" 642 workDir="${build.jtreg.dir}/@{name}/work" 643 reportDir="${build.jtreg.dir}/@{name}/report" 644 jdk="@{jdk}" 645 samevm="@{samevm}" verbose="@{verbose}" 646 failonerror="false" resultproperty="jtreg.@{name}.result" 647 javacoptions="-g" 648 vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}:${build.classes.dir} @{jpda.jvmargs}"> 649 <arg line="@{keywords}"/> 650 <arg line="@{options}"/> 651 <arg line="@{tests}"/> 652 </jtreg> 653 <!-- the next two properties are for convenience, when only 654 a single instance of jtreg will be invoked. --> 655 <condition property="jtreg.passed"> 656 <equals arg1="${jtreg.javac.result}" arg2="0"/> 657 </condition> 658 <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/> 659 </sequential> 660 </macrodef> 661 <property name="jtreg.defined" value="true"/> 662 </target> 663 664 <target name="-def-cobertura" depends="-check-cobertura.home"> 665 <path id="cobertura.classpath"> 666 <fileset dir="${cobertura.home}"> 667 <include name="cobertura.jar"/> 668 <include name="lib/**/*.jar"/> 669 </fileset> 670 </path> 671 <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/> 672 </target> 673 674 <target name="-def-findbugs" unless="findbugs.defined" depends="-check-findbugs.home"> 675 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"> 676 <classpath> 677 <pathelement location="${findbugs.home}/lib/findbugs.jar"/> 678 </classpath> 679 </taskdef> 680 <macrodef name="findbugs-tool"> 681 <attribute name="name"/> 682 <attribute name="output" default="emacs"/> 683 <attribute name="outputFile" default=""/> 684 <attribute name="reportLevel" default="high"/> 685 <sequential> 686 <findbugs 687 home="${findbugs.home}" 688 output="@{output}" 689 outputFile="@{outputFile}" 690 reportLevel="@{reportLevel}" 691 failOnError="false" 692 errorProperty="findbugs.@{name}.errors" 693 warningsProperty="findbugs.@{name}.warnings" 694 jvmargs="-Xmx512M" > 695 <class location="${dist.dir}/lib/@{name}.jar"/> 696 <auxClasspath> 697 <pathelement location="${build.classes.dir}"/> 698 </auxClasspath> 699 <sourcePath> 700 <pathelement location="${src.classes.dir}"/> 701 </sourcePath> 702 </findbugs> 703 </sequential> 704 </macrodef> 705 <property name="findbugs.defined" value="true"/> 706 </target> 707 708 <target name="-def-check"> 709 <macrodef name="check"> 710 <attribute name="name"/> 711 <attribute name="property"/> 712 <attribute name="marker"/> 713 <sequential> 714 <fail message="Cannot locate @{name}: please set @{property} to its location"> 715 <condition> 716 <not> 717 <isset property="@{property}"/> 718 </not> 719 </condition> 720 </fail> 721 <fail message="@{name} is not installed in ${@{property}}"> 722 <condition> 723 <not> 724 <available file="${@{property}}/@{marker}"/> 725 </not> 726 </condition> 727 </fail> 728 </sequential> 729 </macrodef> 730 </target> 731 732 <!-- standard JDK target --> 733 <target name="sanity" 734 description="display settings of congiguration values"> 735 <echo level="info">ant.home = ${ant.home}</echo> 736 <echo level="info">boot.java.home = ${boot.java.home}</echo> 737 <echo level="info">target.java.home = ${target.java.home}</echo> 738 <echo level="info">jtreg.home = ${jtreg.home}</echo> 739 <echo level="info">findbugs.home = ${findbugs.home}</echo> 740 </target> 741 742 <!-- useful debugging targets --> 743 <target name="diagnostics"> 744 <diagnostics/> 745 </target> 746 747 <target name="post-sanity" depends="-def-jtreg,sanity,build" 748 description="perform basic validation after a standard build"> 749 <jtreg 750 dir="make/test" 751 workDir="${build.jtreg.dir}/post-sanity/work" 752 reportDir="${build.jtreg.dir}/post-sanity/report" 753 jdk="${target.java.home}" 754 verbose="summary" 755 failonerror="false" resultproperty="jtreg.post-sanity.result"> 756 </jtreg> 757 758 </target> 759</project> 760 761