Wed, 02 Jun 2010 15:40:01 -0700
Merge
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.
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 -->
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 -->
33 <project name="langtools" default="build" basedir="..">
35 <!-- Force full debuginfo for javac if the debug.classfiles
36 property is set. This must be BEFORE the include of
37 build.properties because it sets javac.debuglevel. -->
38 <condition property="javac.debuglevel" value="source,lines,vars">
39 <equals arg1="${debug.classfiles}" arg2="true"/>
40 </condition>
42 <!-- The following locations can be used to override default property values. -->
44 <!-- Use this location for customizations specific to this instance of this workspace -->
45 <property file="build.properties"/>
47 <!-- Use this location for customizations common to all OpenJDK langtools workspaces -->
48 <property file="${user.home}/.openjdk/${ant.project.name}-build.properties"/>
50 <!-- Use this location for customizations common to all OpenJDK workspaces -->
51 <property file="${user.home}/.openjdk/build.properties"/>
53 <!-- Convenient shorthands for standard locations within the workspace. -->
54 <property name="build.dir" location="build"/>
55 <property name="build.bootstrap.dir" location="${build.dir}/bootstrap"/>
56 <property name="build.coverage.dir" location="${build.dir}/coverage"/>
57 <property name="build.classes.dir" location="${build.dir}/classes"/>
58 <property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
59 <property name="build.genstubs.dir" location="${build.dir}/genstubs"/>
60 <property name="build.javadoc.dir" location="${build.dir}/javadoc"/>
61 <property name="build.jtreg.dir" location="${build.dir}/jtreg"/>
62 <property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
63 <property name="dist.dir" location="dist"/>
64 <property name="dist.bin.dir" location="${dist.dir}/bin"/>
65 <property name="dist.coverage.dir" location="${dist.dir}/coverage"/>
66 <property name="dist.findbugs.dir" location="${dist.dir}/findbugs"/>
67 <property name="dist.lib.dir" location="${dist.dir}/lib"/>
68 <property name="make.dir" location="make"/>
69 <property name="make.tools.dir" location="${make.dir}/tools"/>
70 <property name="src.dir" location="src"/>
71 <property name="src.bin.dir" location="${src.dir}/share/bin"/>
72 <property name="src.classes.dir" location="${src.dir}/share/classes"/>
73 <property name="test.dir" location="test"/>
75 <!-- java.marker is set to a marker file to check for within a Java install dir.
76 The best file to check for across Solaris/Linux/Windows/MacOS is one of the
77 executables; regrettably, that is OS-specific. -->
78 <condition property="java.marker" value="bin/java">
79 <os family="unix"/>
80 </condition>
81 <condition property="java.marker" value="bin/java.exe">
82 <os family="windows"/>
83 </condition>
85 <!-- Standard property values, if not overriden by earlier settings. -->
86 <property file="${make.dir}/build.properties"/>
88 <!-- launcher.java is used in the launcher scripts provided to run
89 the tools' jar files. If it has not already been set, then
90 default it to use ${target.java.home}, if available, otherwise
91 quietly default to simply use "java". -->
92 <condition property="launcher.java"
93 value="${target.java.home}/bin/java" else="java">
94 <isset property="target.java.home"/>
95 </condition>
97 <!-- Logic for handling access import jdk classes, if available.
98 import.jdk should be unset, or set to jdk home (to use rt.jar)
99 or to jdk repo (to use src/share/classes).
100 Based on the value, if any, set up default values for javac's sourcepath,
101 classpath and bootclasspath. Note: the default values are overridden
102 in the build-bootstrap-classes macro. -->
104 <available property="import.jdk.src.dir" value="${import.jdk}/src/share/classes"
105 filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/>
106 <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar"
107 ignoresystemclasses="true"
108 classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/>
110 <!-- Set the default value of the sourcepath used for javac. -->
111 <condition property="javac.sourcepath" value="${build.genstubs.dir}" else="">
112 <isset property="import.jdk.src.dir"/>
113 </condition>
115 <!-- Set the default value of the classpath used for javac. -->
116 <property name="javac.classpath" value=""/>
118 <!-- Set the default bootclasspath option used for javac.
119 Note that different variants of the option are used, meaning we can't just
120 define the value for the option.
121 Note the explicit use of the standard property ${path.separator} in the following.
122 This is because Ant is not clever enough to handle direct use of : or ; -->
123 <condition property="javac.bootclasspath.opt"
124 value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}"
125 else="-Xbootclasspath/p:${build.classes.dir}">
126 <isset property="import.jdk.jar"/>
127 </condition>
129 <condition property="exclude.files" value="" else="${require.import.jdk.files}">
130 <isset property="import.jdk"/>
131 </condition>
133 <!-- for debugging -->
134 <target name="check-import.jdk">
135 <echo message="import.jdk: ${import.jdk}"/>
136 <echo message="import.jdk.jar: ${import.jdk.jar}"/>
137 <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/>
138 </target>
140 <!-- Standard target to build deliverables for JDK build. -->
142 <target name="build" depends="build-bootstrap-tools,build-all-classes">
143 <copy todir="${dist.dir}/bootstrap">
144 <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
145 </copy>
146 <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
147 <include name="*"/>
148 </chmod>
149 <mkdir dir="${dist.lib.dir}"/>
150 <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
151 <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
152 </target>
154 <target name="build-bootstrap-tools"
155 depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
156 />
158 <target name="build-all-tools"
159 depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"
160 />
162 <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
163 <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${apt.includes}"/>
164 </target>
166 <!-- clean -->
168 <target name="clean" description="Delete all generated files">
169 <delete dir="${build.dir}"/>
170 <delete dir="${dist.dir}"/>
171 </target>
173 <!-- Additional targets for running tools on the build -->
175 <target name="jtreg" depends="build-all-tools,-def-jtreg">
176 <jtreg-tool name="all" tests="${jtreg.tests}"/>
177 </target>
179 <target name="findbugs" depends="-def-findbugs,build-all-tools">
180 <property name="findbugs.reportLevel" value="medium"/>
181 <mkdir dir="${dist.findbugs.dir}"/>
182 <findbugs
183 home="${findbugs.home}"
184 projectName="JDK langtools ${full.version}"
185 output="xml"
186 outputFile="${dist.findbugs.dir}/findbugs.xml"
187 reportLevel="${findbugs.reportLevel}"
188 failOnError="false"
189 errorProperty="findbugs.all.errors"
190 warningsProperty="findbugs.all.warnings"
191 jvmargs="-Xmx512M">
192 <class location="${build.classes.dir}"/>
193 <sourcePath>
194 <pathelement location="${src.classes.dir}"/>
195 </sourcePath>
196 </findbugs>
197 <exec executable="sh">
198 <arg value="${findbugs.home}/bin/convertXmlToText"/>
199 <arg value="-longBugCodes"/>
200 <arg value="-html:${findbugs.home}/src/xsl/fancy.xsl"/>
201 <arg value="${dist.findbugs.dir}/findbugs.xml"/>
202 <redirector output="${dist.findbugs.dir}/findbugs.html"/>
203 </exec>
204 </target>
206 <target name="coverage" depends="-def-cobertura,build-all-classes,instrument-classes,jtreg,coverage-report"/>
208 <target name="instrument-classes" depends="-def-cobertura">
209 <!-- only define the following property when we want coverage info -->
210 <path id="coverage.classpath">
211 <pathelement location="${build.coverage.dir}/classes"/>
212 <path refid="cobertura.classpath"/>
213 </path>
214 <property name="coverage.options" value="-Dnet.sourceforge.cobertura.datafile=${build.coverage.dir}/cobertura.ser"/>
215 <property name="coverage.classpath" refid="coverage.classpath"/>
216 <mkdir dir="${build.coverage.dir}/classes"/>
217 <delete file="${build.coverage.dir}/cobertura.ser"/>
218 <cobertura-instrument todir="${build.coverage.dir}/classes"
219 datafile="${build.coverage.dir}/cobertura.ser">
220 <fileset dir="${build.classes.dir}"
221 includes="**/*.class" excludes="**/resources/*.class"/>
222 </cobertura-instrument>
223 </target>
225 <target name="coverage-report" depends="-def-cobertura">
226 <mkdir dir="${dist.coverage.dir}"/>
227 <cobertura-report
228 srcdir="${src.classes.dir}"
229 destdir="${dist.coverage.dir}"
230 datafile="${build.coverage.dir}/cobertura.ser"/>
231 <cobertura-report
232 format="xml"
233 srcdir="${src.classes.dir}"
234 destdir="${dist.coverage.dir}"
235 datafile="${build.coverage.dir}/cobertura.ser"/>
236 </target>
238 <!-- javac targets -->
240 <target name="build-bootstrap-javac"
241 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
242 <build-bootstrap-classes includes="${javac.includes}"/>
243 <build-bootstrap-jar name="javac" includes="${javac.includes}"/>
244 <build-bootstrap-tool name="javac"/>
245 </target>
247 <target name="build-classes-javac" depends="build-bootstrap-javac,-create-import-jdk-stubs">
248 <build-classes includes="${javac.includes}"/>
249 </target>
251 <target name="build-javac" depends="build-classes-javac">
252 <build-jar name="javac" includes="${javac.includes}"/>
253 <build-tool name="javac"/>
254 </target>
256 <target name="javadoc-javac" depends="build-javac,-def-javadoc-tool">
257 <javadoc-tool name="javac" includes="${javac.includes}" options="${javadoc.jls3.option}"/>
258 </target>
260 <target name="jtreg-javac" depends="build-javac,build-javap,-def-jtreg">
261 <jtreg-tool name="javac" tests="${javac.tests}"/>
262 </target>
264 <target name="findbugs-javac" depends="build-javac,-def-findbugs">
265 <findbugs-tool name="javac"/>
266 </target>
268 <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/>
270 <!-- javadoc targets -->
272 <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
273 <build-bootstrap-classes includes="${javadoc.includes}"/>
274 <build-bootstrap-jar name="javadoc" includes="${javadoc.includes}"
275 jarclasspath="javac.jar doclets.jar"/>
276 <build-bootstrap-tool name="javadoc"/>
277 </target>
279 <target name="build-classes-javadoc" depends="build-classes-javac">
280 <build-classes includes="${javadoc.includes}"/>
281 </target>
283 <target name="build-javadoc" depends="build-javac,build-classes-javadoc">
284 <build-jar name="javadoc" includes="${javadoc.includes}"
285 jarclasspath="javac.jar doclets.jar"/>
286 <build-tool name="javadoc"/>
287 </target>
289 <target name="javadoc-javadoc" depends="build-javadoc,-def-javadoc-tool">
290 <javadoc-tool name="javadoc" includes="${javadoc.includes}"/>
291 </target>
293 <target name="jtreg-javadoc" depends="build-javadoc,-def-jtreg">
294 <jtreg-tool name="javadoc" tests="${javadoc.tests}"/>
295 </target>
297 <target name="findbugs-javadoc" depends="build-javadoc,-def-findbugs">
298 <findbugs-tool name="javadoc"/>
299 </target>
301 <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
303 <!-- doclets targets -->
305 <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
306 <build-bootstrap-classes includes="${doclets.includes}"/>
307 <build-bootstrap-jar name="doclets" includes="${doclets.includes}"
308 jarmainclass="com.sun.tools.javadoc.Main"
309 jarclasspath="javadoc.jar"/>
310 </target>
312 <target name="build-classes-doclets" depends="build-classes-javadoc">
313 <build-classes includes="${doclets.includes}"/>
314 </target>
316 <target name="build-doclets" depends="build-javadoc,build-classes-doclets">
317 <!-- just jar, no bin for doclets -->
318 <build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
319 </target>
321 <!-- (no javadoc for doclets) -->
323 <target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
324 <jtreg-tool name="doclets" tests="${doclets.tests}"/>
325 </target>
327 <target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
328 <findbugs-tool name="doclets"/>
329 </target>
331 <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
333 <!-- javah targets -->
335 <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
336 <build-bootstrap-classes includes="${javah.includes}"/>
337 <build-bootstrap-jar name="javah" includes="${javah.includes}"
338 jarclasspath="javadoc.jar doclets.jar javac.jar"/>
339 <build-bootstrap-tool name="javah"/>
340 </target>
342 <target name="build-javah" depends="build-javac,build-classes-javah">
343 <build-jar name="javah" includes="${javah.includes}" jarclasspath="javac.jar"/>
344 <build-tool name="javah"/>
345 </target>
347 <target name="build-classes-javah" depends="build-classes-javadoc">
348 <build-classes includes="${javah.includes}"/>
349 </target>
351 <!-- (no javadoc for javah) -->
353 <target name="jtreg-javah" depends="build-javah,-def-jtreg">
354 <jtreg-tool name="javah" tests="${javah.tests}"/>
355 </target>
357 <target name="findbugs-javah" depends="build-javah,-def-findbugs">
358 <findbugs-tool name="javah"/>
359 </target>
361 <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/>
363 <!-- javap targets -->
365 <target name="build-bootstrap-javap"
366 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
367 <build-bootstrap-classes includes="${javap.includes}"/>
368 <build-bootstrap-jar name="javap" includes="${javap.includes}"
369 jarmainclass="sun.tools.javap.Main"/>
370 <build-bootstrap-tool name="javap"/>
371 </target>
373 <target name="build-classes-javap" depends="build-classes-javac">
374 <build-classes includes="${javap.includes}"/>
375 </target>
377 <target name="build-javap" depends="build-javac,build-classes-javap">
378 <build-jar name="javap" includes="${javap.includes}"
379 jarmainclass="com.sun.tools.javap.Main"
380 jarclasspath="javac.jar"/>
381 <build-tool name="javap"/>
382 </target>
384 <!-- (no javadoc for javap) -->
386 <target name="jtreg-javap" depends="build-javap,-def-jtreg">
387 <jtreg-tool name="javap" tests="${javap.tests}"/>
388 </target>
390 <target name="findbugs-javap" depends="build-javap,-def-findbugs">
391 <findbugs-tool name="javap"/>
392 </target>
394 <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
396 <!-- apt targets -->
398 <target name="build-bootstrap-apt" depends="build-bootstrap-javac">
399 <build-bootstrap-classes includes="${apt.includes}"/>
400 <build-bootstrap-jar name="apt" includes="${apt.includes}"
401 jarclasspath="javac.jar"/>
402 <build-bootstrap-tool name="apt"/>
403 </target>
405 <target name="build-apt" depends="build-javac,build-classes-apt">
406 <build-jar name="apt" includes="${apt.includes}" jarclasspath="javac.jar"/>
407 <build-tool name="apt"/>
408 </target>
410 <target name="build-classes-apt" depends="build-classes-javac">
411 <build-classes includes="${apt.includes}"/>
412 </target>
414 <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
415 <javadoc-tool name="apt" includes="${apt.includes}"/>
416 </target>
419 <target name="jtreg-apt" depends="build-apt,-def-jtreg">
420 <jtreg-tool name="apt" tests="${apt.tests}"/>
421 </target>
423 <target name="findbugs-apt" depends="build-apt,-def-findbugs">
424 <findbugs-tool name="apt"/>
425 </target>
427 <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
429 <!-- Create import JDK stubs -->
431 <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="import.jdk.src.dir">
432 <mkdir dir="${build.genstubs.dir}"/>
433 <genstubs
434 srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
435 includes="${import.jdk.stub.files}"
436 fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"
437 />
438 </target>
440 <!-- Check targets -->
442 <target name="-check-boot.java.home" depends="-def-check">
443 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
444 </target>
446 <target name="-check-target.java.home" depends="-def-check">
447 <check name="target java" property="target.java.home" marker="${java.marker}"/>
448 </target>
450 <target name="-check-cobertura.home" depends="-def-check">
451 <check name="cobertura" property="cobertura.home" marker="cobertura.jar"/>
452 </target>
454 <target name="-check-findbugs.home" depends="-def-check">
455 <check name="findbugs" property="findbugs.home" marker="lib/findbugs.jar"/>
456 </target>
458 <target name="-check-jtreg.home" depends="-def-check">
459 <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
460 </target>
462 <!-- Ant macro and preset defs -->
464 <target name="-def-build-tool">
465 <macrodef name="build-tool">
466 <attribute name="name"/>
467 <attribute name="bin.dir" default="${dist.bin.dir}"/>
468 <attribute name="java" default="${launcher.java}"/>
469 <sequential>
470 <mkdir dir="@{bin.dir}"/>
471 <copy file="${src.bin.dir}/launcher.sh-template" tofile="@{bin.dir}/@{name}">
472 <filterset begintoken="#" endtoken="#">
473 <filter token="PROGRAM" value="@{name}"/>
474 <filter token="TARGET_JAVA" value="@{java}"/>
475 </filterset>
476 </copy>
477 <chmod file="@{bin.dir}/@{name}" perm="ugo+rx"/>
478 </sequential>
479 </macrodef>
480 </target>
482 <target name="-def-build-jar">
483 <macrodef name="build-jar">
484 <attribute name="name"/>
485 <attribute name="includes"/>
486 <attribute name="classes.dir" default="${build.classes.dir}"/>
487 <attribute name="lib.dir" default="${dist.lib.dir}"/>
488 <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
489 <attribute name="jarclasspath" default=""/>
490 <sequential>
491 <mkdir dir="@{lib.dir}"/>
492 <jar destfile="@{lib.dir}/@{name}.jar"
493 basedir="@{classes.dir}"
494 includes="@{includes}">
495 <manifest>
496 <attribute name="Main-Class" value="@{jarmainclass}"/>
497 <attribute name="Class-Path" value="@{jarclasspath}"/>
498 </manifest>
499 </jar>
500 </sequential>
501 </macrodef>
502 </target>
504 <target name="-def-build-classes" depends="-def-pcompile">
505 <macrodef name="build-classes">
506 <attribute name="includes"/>
507 <attribute name="excludes" default="${exclude.files} **/package-info.java"/>
508 <attribute name="classes.dir" default="${build.classes.dir}"/>
509 <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
510 <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
511 <attribute name="bootclasspath.opt" default="${javac.bootclasspath.opt}"/>
512 <attribute name="classpath" default="${javac.classpath}"/>
513 <attribute name="sourcepath" default="${javac.sourcepath}"/>
514 <attribute name="java.home" default="${boot.java.home}"/>
515 <attribute name="source" default="${javac.source}"/>
516 <attribute name="target" default="${javac.target}"/>
517 <attribute name="release" default="${release}"/>
518 <attribute name="full.version" default="${full.version}"/>
519 <sequential>
520 <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
521 <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
522 <echo level="verbose" message="build-classes: classpath=@{classpath}"/>
523 <echo level="verbose" message="build-classes: sourcepath=@{sourcepath}"/>
524 <mkdir dir="@{gensrc.dir}"/>
525 <mkdir dir="@{classes.dir}"/>
526 <pcompile srcdir="${src.classes.dir}"
527 destdir="@{gensrc.dir}"
528 includes="@{includes}"/>
529 <copy todir="@{gensrc.dir}">
530 <fileset dir="${src.classes.dir}" includes="@{includes}"/>
531 <globmapper from="*.properties-template" to="*.properties"/>
532 <filterset begintoken="$(" endtoken=")">
533 <filter token="JDK_VERSION" value="${jdk.version}"/>
534 <filter token="RELEASE" value="@{release}"/>
535 <filter token="FULL_VERSION" value="@{full.version}"/>
536 </filterset>
537 </copy>
538 <pcompile srcdir="@{gensrc.dir}"
539 destdir="@{gensrc.dir}"
540 includes="**/*.properties"/>
541 <javac fork="true"
542 executable="@{java.home}/bin/javac"
543 srcdir="${src.classes.dir}:@{gensrc.dir}"
544 destdir="@{classes.dir}"
545 includes="@{includes}"
546 excludes="@{excludes}"
547 sourcepath="@{sourcepath}"
548 classpath="@{classpath}"
549 includeAntRuntime="no"
550 source="@{source}"
551 target="@{target}"
552 debug="${javac.debug}"
553 debuglevel="${javac.debuglevel}">
554 <compilerarg value="-implicit:none"/>
555 <compilerarg value="-Xprefer:source"/>
556 <compilerarg value="-J-Xbootclasspath/p:@{javac.bootclasspath}"/>
557 <compilerarg line="@{bootclasspath.opt}"/>
558 <compilerarg line="${javac.no.jdk.warnings}"/>
559 <compilerarg line="${javac.version.opt}"/>
560 <compilerarg line="${javac.lint.opts}"/>
561 </javac>
562 <copy todir="@{classes.dir}" includeemptydirs="false">
563 <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
564 <exclude name="**/*.java"/>
565 <exclude name="**/*.properties"/>
566 <exclude name="**/*-template"/>
567 <exclude name="**/package.html"/>
568 </fileset>
569 </copy>
570 </sequential>
571 </macrodef>
572 </target>
574 <target name="-def-build-bootstrap-tool" depends="-check-boot.java.home,-def-build-tool">
575 <presetdef name="build-bootstrap-tool">
576 <build-tool
577 bin.dir="${build.bootstrap.dir}/bin"
578 java="${boot.java}"/>
579 </presetdef>
580 </target>
582 <target name="-def-build-bootstrap-jar" depends="-def-build-jar">
583 <presetdef name="build-bootstrap-jar">
584 <build-jar
585 classes.dir="${build.bootstrap.dir}/classes"
586 lib.dir="${build.bootstrap.dir}/lib"/>
587 </presetdef>
588 </target>
590 <target name="-def-build-bootstrap-classes" depends="-def-build-classes">
591 <presetdef name="build-bootstrap-classes">
592 <build-classes
593 source="${boot.javac.source}"
594 target="${boot.javac.target}"
595 gensrc.dir="${build.bootstrap.dir}/gensrc"
596 classes.dir="${build.bootstrap.dir}/classes"
597 javac.bootclasspath=""
598 bootclasspath.opt="-Xbootclasspath/p:${build.bootstrap.dir}/classes"
599 sourcepath=""
600 release="${bootstrap.release}"
601 full.version="${bootstrap.full.version}"
602 excludes="${require.import.jdk.files} **/package-info.java"/>
603 </presetdef>
604 </target>
606 <target name="-def-pcompile">
607 <mkdir dir="${build.toolclasses.dir}"/>
608 <javac fork="true"
609 source="${boot.javac.source}"
610 target="${boot.javac.target}"
611 executable="${boot.java.home}/bin/javac"
612 srcdir="${make.tools.dir}/CompileProperties"
613 destdir="${build.toolclasses.dir}/"
614 classpath="${ant.home}/lib/ant.jar"/>
615 <taskdef name="pcompile"
616 classname="CompilePropertiesTask"
617 classpath="${build.toolclasses.dir}/"/>
618 </target>
620 <target name="-def-genstubs" depends="build-bootstrap-javac">
621 <mkdir dir="${build.toolclasses.dir}"/>
622 <javac fork="true"
623 source="${boot.javac.source}"
624 target="${boot.javac.target}"
625 executable="${boot.java.home}/bin/javac"
626 srcdir="${make.tools.dir}/GenStubs"
627 destdir="${build.toolclasses.dir}/"
628 classpath="${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar"/>
629 <taskdef name="genstubs"
630 classname="GenStubs$$Ant"
631 classpath="${build.toolclasses.dir}/"/>
632 </target>
634 <target name="-def-javadoc-tool" depends="-check-target.java.home">
635 <macrodef name="javadoc-tool">
636 <attribute name="name"/>
637 <attribute name="includes"/>
638 <attribute name="options" default=""/>
639 <attribute name="source" default="1.5"/> <!-- FIXME -->
640 <sequential>
641 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project -->
642 <!-- Note: even with this default value, includes
643 from src.classes.dir get javadoc'd; see packageset below -->
644 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
645 <javadoc
646 executable="${target.java.home}/bin/javadoc"
647 destdir="${build.javadoc.dir}/@{name}"
648 source="@{source}"
649 windowtitle="UNOFFICIAL"
650 failonerror="true"
651 use="true"
652 author="false"
653 version="false"
654 packagenames="${javadoc.packagenames}" >
655 <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
656 <arg line="@{options}"/>
657 <bootclasspath>
658 <path location="${build.classes.dir}"/>
659 <path location="${target.java.home}/jre/lib/rt.jar"/>
660 </bootclasspath>
661 <sourcepath>
662 <pathelement location="${src.classes.dir}"/>
663 </sourcepath>
664 <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
665 <!-- means that {@link some.package} will not work, which is no good. -->
666 <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
667 <!-- which also causes duplicates in the class index for included files.) -->
668 <packageset dir="${src.classes.dir}" includes="@{includes}">
669 <or>
670 <filename name="java/"/>
671 <filename name="javax/"/>
672 <filename name="com/sun/javadoc/"/>
673 <filename name="com/sun/mirror/"/>
674 <filename name="com/sun/source/"/>
675 </or>
676 </packageset>
677 </javadoc>
678 </sequential>
679 </macrodef>
680 </target>
682 <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
683 <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
684 <classpath>
685 <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
686 <pathelement location="${jtreg.home}/lib/javatest.jar"/>
687 </classpath>
688 </taskdef>
689 <macrodef name="jtreg-tool">
690 <attribute name="name"/>
691 <attribute name="tests"/>
692 <attribute name="jdk" default="${target.java.home}"/>
693 <attribute name="samevm" default="true"/>
694 <attribute name="verbose" default="summary"/>
695 <attribute name="options" default=""/>
696 <attribute name="keywords" default="-keywords:!ignore"/>
697 <attribute name="jpda.jvmargs" default=""/>
698 <sequential>
699 <property name="coverage.options" value=""/> <!-- default -->
700 <property name="coverage.classpath" value=""/> <!-- default -->
701 <jtreg
702 dir="${test.dir}"
703 workDir="${build.jtreg.dir}/@{name}/work"
704 reportDir="${build.jtreg.dir}/@{name}/report"
705 jdk="@{jdk}"
706 samevm="@{samevm}" verbose="@{verbose}"
707 failonerror="false" resultproperty="jtreg.@{name}.result"
708 javacoptions="-g"
709 vmoptions="${coverage.options} -Xbootclasspath/p:${coverage.classpath}:${build.classes.dir} @{jpda.jvmargs}">
710 <arg line="@{keywords}"/>
711 <arg line="@{options}"/>
712 <arg line="@{tests}"/>
713 </jtreg>
714 <!-- the next two properties are for convenience, when only
715 a single instance of jtreg will be invoked. -->
716 <condition property="jtreg.passed">
717 <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
718 </condition>
719 <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
720 </sequential>
721 </macrodef>
722 <property name="jtreg.defined" value="true"/>
723 </target>
725 <target name="-def-cobertura" depends="-check-cobertura.home">
726 <path id="cobertura.classpath">
727 <fileset dir="${cobertura.home}">
728 <include name="cobertura.jar"/>
729 <include name="lib/**/*.jar"/>
730 </fileset>
731 </path>
732 <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
733 </target>
735 <target name="-def-findbugs" unless="findbugs.defined" depends="-check-findbugs.home">
736 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
737 <classpath>
738 <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
739 </classpath>
740 </taskdef>
741 <macrodef name="findbugs-tool">
742 <attribute name="name"/>
743 <attribute name="output" default="emacs"/>
744 <attribute name="outputFile" default=""/>
745 <attribute name="reportLevel" default="high"/>
746 <sequential>
747 <findbugs
748 home="${findbugs.home}"
749 output="@{output}"
750 outputFile="@{outputFile}"
751 reportLevel="@{reportLevel}"
752 failOnError="false"
753 errorProperty="findbugs.@{name}.errors"
754 warningsProperty="findbugs.@{name}.warnings"
755 jvmargs="-Xmx512M" >
756 <class location="${dist.dir}/lib/@{name}.jar"/>
757 <auxClasspath>
758 <pathelement location="${build.classes.dir}"/>
759 </auxClasspath>
760 <sourcePath>
761 <pathelement location="${src.classes.dir}"/>
762 </sourcePath>
763 </findbugs>
764 </sequential>
765 </macrodef>
766 <property name="findbugs.defined" value="true"/>
767 </target>
769 <target name="-def-check">
770 <macrodef name="check">
771 <attribute name="name"/>
772 <attribute name="property"/>
773 <attribute name="marker"/>
774 <sequential>
775 <fail message="Cannot locate @{name}: please set @{property} to its location">
776 <condition>
777 <not>
778 <isset property="@{property}"/>
779 </not>
780 </condition>
781 </fail>
782 <fail message="@{name} is not installed in ${@{property}}">
783 <condition>
784 <not>
785 <available file="${@{property}}/@{marker}"/>
786 </not>
787 </condition>
788 </fail>
789 </sequential>
790 </macrodef>
791 </target>
793 <!-- standard JDK target -->
794 <target name="sanity"
795 description="display settings of configuration values">
796 <echo level="info">ant.home = ${ant.home}</echo>
797 <echo level="info">boot.java.home = ${boot.java.home}</echo>
798 <echo level="info">target.java.home = ${target.java.home}</echo>
799 <echo level="info">jtreg.home = ${jtreg.home}</echo>
800 <echo level="info">findbugs.home = ${findbugs.home}</echo>
801 </target>
803 <!-- useful debugging targets -->
804 <target name="diagnostics">
805 <diagnostics/>
806 </target>
808 <target name="post-sanity" depends="-def-jtreg,sanity,build"
809 description="perform basic validation after a standard build">
810 <jtreg
811 dir="make/test"
812 workDir="${build.jtreg.dir}/post-sanity/work"
813 reportDir="${build.jtreg.dir}/post-sanity/report"
814 jdk="${target.java.home}"
815 verbose="summary"
816 failonerror="false" resultproperty="jtreg.post-sanity.result">
817 </jtreg>
819 </target>
820 </project>