annotate make/build.xml @ 112:38d07d25ab65

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