Fri, 04 Jun 2010 17:33:25 -0700
6958802: cleanup and doc langtools build.xml file
Reviewed-by: ohair
make/build.properties | file | annotate | diff | comparison | revisions | |
make/build.xml | file | annotate | diff | comparison | revisions |
1.1 --- a/make/build.properties Fri Jun 04 14:54:54 2010 -0700 1.2 +++ b/make/build.properties Fri Jun 04 17:33:25 2010 -0700 1.3 @@ -158,12 +158,14 @@ 1.4 1.5 # 1.6 1.7 -# The following files require the import JDK to be available 1.8 -require.import.jdk.files = \ 1.9 +# The following files require the latest JDK to be available. 1.10 +# The API can be provided by using a suitable boot.java.home 1.11 +# or by setting import.jdk 1.12 +require.latest.jdk.files = \ 1.13 com/sun/tools/javac/nio/*.java 1.14 1.15 # The following files in the import jdk source directory are required 1.16 -# in order to compile the files defined in ${require.import.jdk.files} 1.17 +# in order to compile the files defined in ${require.latest.jdk.files} 1.18 # 1.19 # For NIO, the list of stub files is defined by the contents of the primary 1.20 # API packages, together with such types that may be required in order to
2.1 --- a/make/build.xml Fri Jun 04 14:54:54 2010 -0700 2.2 +++ b/make/build.xml Fri Jun 04 17:33:25 2010 -0700 2.3 @@ -25,12 +25,79 @@ 2.4 --> 2.5 2.6 <!-- 2.7 - This is the main build file for the complete langtools workspace. 2.8 - It is used both when working on the tools in NetBeans, and when building 2.9 - JDK itself, in which case it is invoked from the wrapper Makefile. 2.10 + This is the main build file for the complete langtools repository. 2.11 + It is used when building JDK (in which case it is invoked from the 2.12 + Makefile), and it can be used when working on the tools themselves, 2.13 + in an IDE such as NetBeans. 2.14 + 2.15 + External dependencies are specified via properties. These can be given 2.16 + on the command line, or by providing a local build.properties file. 2.17 + (They can also be edited into make/build.properties, although that is not 2.18 + recommended.) At a minimum, boot.java.home must be set to the installed 2.19 + location of the version of JDK used to build this repository. Additional 2.20 + properties may be required, depending on the targets that are built. 2.21 + For example, to run any of the jtreg tests you must set jtreg.home, 2.22 + to run findbugs on the code you must set findbugs.home, and so on. 2.23 + 2.24 + For the most part, javac can be built using the previous version of JDK. 2.25 + However, a small number of javac files require access to the latest JDK, 2.26 + which may not yet have been compiled. To compile these files, you can do 2.27 + one of the following: 2.28 + - Set boot.java.home to a recent build of the latest version of JDK. 2.29 + - Set import.jdk to either a recent build (containing jre/lib/rt.jar) 2.30 + or to jdk source repository. In the latter case, stub files will 2.31 + automatically be generated and used for the required API, to avoid 2.32 + unnecessary compilation of the source repository. 2.33 + If you do neither, the relevant files will not be built. 2.34 + 2.35 + The main build happens in two phases: 2.36 + - First, javac and other tools as needed are built using ${boot.java.home}. 2.37 + (This implies a constraint on the source code that they can be compiled 2.38 + with the previous version of JDK. 2.39 + - Second, all required classes are compiled with the latest javac, created 2.40 + in the previous step. 2.41 + The first phase is called the bootstrap phase. All targets, properties and 2.42 + tasks that are specific to that phase have "bootstrap" in their name. 2.43 + 2.44 + For more details on the JDK build, see 2.45 + http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build 2.46 + http://openjdk.java.net/groups/build/ 2.47 + For more details on the stub generator, see 2.48 + http://blogs.sun.com/jjg/entry/building_javac_for_jdk7 2.49 + 2.50 + Internal details ... 2.51 + 2.52 + Interim build products are created in the build/ directory. 2.53 + Final build products are created in the dist/ directory. 2.54 + When building JDK, the dist/directory will contain: 2.55 + - A bootstrap compiler suitable for running with ${boot.java.home} 2.56 + suitable for compiling downstream parts of JDK 2.57 + - Source files and class files for inclusion in the JDK being built 2.58 + When building standalone, the dist/directory will contain: 2.59 + - Separate jar files for each of the separate langtools components 2.60 + - Simple scripts to invoke the tools by executing the corresponding 2.61 + jar files. 2.62 + These jar files and scripts are "for developer use only". 2.63 + 2.64 + This file is organized into sections as follows: 2.65 + - global property definitions 2.66 + - general top level targets 2.67 + - general diagnostic/debugging targets 2.68 + - groups of targets for each tool: javac, javadoc, doclets, javah, javap, apt 2.69 + Within each group, the following targets are provided, where applicable 2.70 + build-bootstrap-TOOL build the bootstrap version of the tool 2.71 + build-classes-TOOL build the classes for the tool 2.72 + build-TOOL build the jar file and script for the tool 2.73 + jtreg-TOOL build the tool and run the appropriate tests 2.74 + findbugs-TOOL run findbugs on the tool's source oode 2.75 + TOOL build the tool, run the tests, and run findbugs 2.76 + - utility definitions 2.77 --> 2.78 2.79 <project name="langtools" default="build" basedir=".."> 2.80 + <!-- 2.81 + **** Global property definitions. 2.82 + --> 2.83 2.84 <!-- Force full debuginfo for javac if the debug.classfiles 2.85 property is set. This must be BEFORE the include of 2.86 @@ -107,48 +174,55 @@ 2.87 ignoresystemclasses="true" 2.88 classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/> 2.89 2.90 - <!-- Set the default value of the sourcepath used for javac. --> 2.91 - <condition property="javac.sourcepath" value="${build.genstubs.dir}" else=""> 2.92 - <isset property="import.jdk.src.dir"/> 2.93 - </condition> 2.94 - 2.95 - <!-- Set the default value of the classpath used for javac. --> 2.96 - <property name="javac.classpath" value=""/> 2.97 - 2.98 - <!-- Set the default bootclasspath option used for javac. 2.99 - Note that different variants of the option are used, meaning we can't just 2.100 - define the value for the option. 2.101 - Note the explicit use of the standard property ${path.separator} in the following. 2.102 - This is because Ant is not clever enough to handle direct use of : or ; --> 2.103 + <!-- Set the default bootclasspath option used for javac. 2.104 + Note that different variants of the option are used, meaning we can't just 2.105 + define the value for the option. 2.106 + Note the explicit use of the standard property ${path.separator} in the following. 2.107 + This is because Ant is not clever enough to handle direct use of : or ; --> 2.108 <condition property="javac.bootclasspath.opt" 2.109 value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}" 2.110 else="-Xbootclasspath/p:${build.classes.dir}"> 2.111 <isset property="import.jdk.jar"/> 2.112 </condition> 2.113 2.114 - <condition property="exclude.files" value="" else="${require.import.jdk.files}"> 2.115 - <isset property="import.jdk"/> 2.116 + <condition property="boot.java.provides.latest.jdk"> 2.117 + <available 2.118 + ignoresystemclasses="true" 2.119 + classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/> 2.120 </condition> 2.121 2.122 - <!-- for debugging --> 2.123 - <target name="check-import.jdk"> 2.124 - <echo message="import.jdk: ${import.jdk}"/> 2.125 - <echo message="import.jdk.jar: ${import.jdk.jar}"/> 2.126 - <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/> 2.127 - </target> 2.128 - 2.129 - <target name="vizant" depends="-def-vizant"> 2.130 - <mkdir dir="${build.dir}"/> 2.131 - <echo message="Generating ${build.dir}/build.dot"/> 2.132 - <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/> 2.133 - <echo message="Generating ${build.dir}/build.png"/> 2.134 - <exec executable="${dot}" > 2.135 - <arg value="-Tpng"/> 2.136 - <arg value="-o"/> 2.137 - <arg file="${build.dir}/build.png"/> 2.138 - <arg file="${build.dir}/build.dot"/> 2.139 - </exec> 2.140 - </target> 2.141 + <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}"> 2.142 + <isset property="boot.java.provides.latest.jdk"/> 2.143 + </condition> 2.144 + 2.145 + <condition property="exclude.files" value="" else="${require.latest.jdk.files}"> 2.146 + <or> 2.147 + <isset property="boot.java.provides.latest.jdk"/> 2.148 + <isset property="import.jdk"/> 2.149 + </or> 2.150 + </condition> 2.151 + 2.152 + <condition property="require.import.jdk.stubs"> 2.153 + <and> 2.154 + <not> 2.155 + <isset property="boot.java.provides.latest.jdk"/> 2.156 + </not> 2.157 + <isset property="import.jdk.src.dir"/> 2.158 + </and> 2.159 + </condition> 2.160 + 2.161 + <!-- Set the default value of the sourcepath used for javac. --> 2.162 + <condition property="javac.sourcepath" value="${build.genstubs.dir}" else=""> 2.163 + <isset property="require.import.jdk.stubs"/> 2.164 + </condition> 2.165 + 2.166 + <!-- Set the default value of the classpath used for javac. --> 2.167 + <property name="javac.classpath" value=""/> 2.168 + 2.169 + 2.170 + <!-- 2.171 + **** General top level targets. 2.172 + --> 2.173 2.174 <!-- Standard target to build deliverables for JDK build. --> 2.175 2.176 @@ -248,7 +322,61 @@ 2.177 datafile="${build.coverage.dir}/cobertura.ser"/> 2.178 </target> 2.179 2.180 - <!-- javac targets --> 2.181 + 2.182 + <!-- 2.183 + **** Debugging/diagnostic targets. 2.184 + --> 2.185 + 2.186 + <!-- standard JDK target --> 2.187 + <target name="sanity" 2.188 + description="display settings of configuration values"> 2.189 + <echo level="info">ant.home = ${ant.home}</echo> 2.190 + <echo level="info">boot.java.home = ${boot.java.home}</echo> 2.191 + <echo level="info">target.java.home = ${target.java.home}</echo> 2.192 + <echo level="info">jtreg.home = ${jtreg.home}</echo> 2.193 + <echo level="info">findbugs.home = ${findbugs.home}</echo> 2.194 + </target> 2.195 + 2.196 + <target name="post-sanity" depends="-def-jtreg,sanity,build" 2.197 + description="perform basic validation after a standard build"> 2.198 + <jtreg 2.199 + dir="make/test" 2.200 + workDir="${build.jtreg.dir}/post-sanity/work" 2.201 + reportDir="${build.jtreg.dir}/post-sanity/report" 2.202 + jdk="${target.java.home}" 2.203 + verbose="summary" 2.204 + failonerror="false" resultproperty="jtreg.post-sanity.result"> 2.205 + </jtreg> 2.206 + </target> 2.207 + 2.208 + <!-- use vizant tool to generate graphical image of this Ant file.--> 2.209 + <target name="vizant" depends="-def-vizant"> 2.210 + <mkdir dir="${build.dir}"/> 2.211 + <echo message="Generating ${build.dir}/build.dot"/> 2.212 + <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/> 2.213 + <echo message="Generating ${build.dir}/build.png"/> 2.214 + <exec executable="${dot}" > 2.215 + <arg value="-Tpng"/> 2.216 + <arg value="-o"/> 2.217 + <arg file="${build.dir}/build.png"/> 2.218 + <arg file="${build.dir}/build.dot"/> 2.219 + </exec> 2.220 + </target> 2.221 + 2.222 + <target name="check-import.jdk"> 2.223 + <echo message="import.jdk: ${import.jdk}"/> 2.224 + <echo message="import.jdk.jar: ${import.jdk.jar}"/> 2.225 + <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/> 2.226 + </target> 2.227 + 2.228 + <target name="diagnostics"> 2.229 + <diagnostics/> 2.230 + </target> 2.231 + 2.232 + 2.233 + <!-- 2.234 + **** javac targets. 2.235 + --> 2.236 2.237 <target name="build-bootstrap-javac" 2.238 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> 2.239 @@ -280,7 +408,10 @@ 2.240 2.241 <target name="javac" depends="build-javac,jtreg-javac,findbugs-javac"/> 2.242 2.243 - <!-- javadoc targets --> 2.244 + 2.245 + <!-- 2.246 + **** javadoc targets. 2.247 + --> 2.248 2.249 <target name="build-bootstrap-javadoc" depends="build-bootstrap-javac"> 2.250 <build-bootstrap-classes includes="${javadoc.includes}"/> 2.251 @@ -313,7 +444,10 @@ 2.252 2.253 <target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/> 2.254 2.255 - <!-- doclets targets --> 2.256 + 2.257 + <!-- 2.258 + **** doclets targets. 2.259 + --> 2.260 2.261 <target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar"> 2.262 <build-bootstrap-classes includes="${doclets.includes}"/> 2.263 @@ -343,7 +477,10 @@ 2.264 2.265 <target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/> 2.266 2.267 - <!-- javah targets --> 2.268 + 2.269 + <!-- 2.270 + **** javah targets. 2.271 + --> 2.272 2.273 <target name="build-bootstrap-javah" depends="build-bootstrap-javadoc"> 2.274 <build-bootstrap-classes includes="${javah.includes}"/> 2.275 @@ -373,7 +510,10 @@ 2.276 2.277 <target name="javah" depends="build-javah,jtreg-javah,findbugs-javah"/> 2.278 2.279 - <!-- javap targets --> 2.280 + 2.281 + <!-- 2.282 + **** javap targets. 2.283 + --> 2.284 2.285 <target name="build-bootstrap-javap" 2.286 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> 2.287 @@ -406,7 +546,10 @@ 2.288 2.289 <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/> 2.290 2.291 - <!-- apt targets --> 2.292 + 2.293 + <!-- 2.294 + **** apt targets. 2.295 + --> 2.296 2.297 <target name="build-bootstrap-apt" depends="build-bootstrap-javac"> 2.298 <build-bootstrap-classes includes="${apt.includes}"/> 2.299 @@ -439,9 +582,12 @@ 2.300 2.301 <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/> 2.302 2.303 - <!-- Create import JDK stubs --> 2.304 2.305 - <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="import.jdk.src.dir"> 2.306 + <!-- 2.307 + **** Create import JDK stubs. 2.308 + --> 2.309 + 2.310 + <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs"> 2.311 <mkdir dir="${build.genstubs.dir}"/> 2.312 <genstubs 2.313 srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}" 2.314 @@ -450,7 +596,12 @@ 2.315 /> 2.316 </target> 2.317 2.318 - <!-- Check targets --> 2.319 + 2.320 + <!-- 2.321 + **** Check targets. 2.322 + **** "-check-*" targets check that a required property is set, and set to a reasonable value. 2.323 + **** A user friendly message is generated if not, and the build exits. 2.324 + --> 2.325 2.326 <target name="-check-boot.java.home" depends="-def-check"> 2.327 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> 2.328 @@ -477,7 +628,10 @@ 2.329 <check name="dot" property="dot"/> 2.330 </target> 2.331 2.332 - <!-- Ant macro and preset defs --> 2.333 + 2.334 + <!-- 2.335 + **** Targets for Ant macro and task definitions. 2.336 + --> 2.337 2.338 <target name="-def-build-tool"> 2.339 <macrodef name="build-tool"> 2.340 @@ -617,7 +771,7 @@ 2.341 sourcepath="" 2.342 release="${bootstrap.release}" 2.343 full.version="${bootstrap.full.version}" 2.344 - excludes="${require.import.jdk.files} **/package-info.java"/> 2.345 + excludes="${bootstrap.exclude.files} **/package-info.java"/> 2.346 </presetdef> 2.347 </target> 2.348 2.349 @@ -635,7 +789,7 @@ 2.350 classpath="${build.toolclasses.dir}/"/> 2.351 </target> 2.352 2.353 - <target name="-def-genstubs" depends="build-bootstrap-javac"> 2.354 + <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs"> 2.355 <mkdir dir="${build.toolclasses.dir}"/> 2.356 <javac fork="true" 2.357 source="${boot.javac.source}" 2.358 @@ -658,7 +812,7 @@ 2.359 <sequential> 2.360 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> 2.361 <!-- Note: even with this default value, includes 2.362 - from src.classes.dir get javadoc'd; see packageset below --> 2.363 + from src.classes.dir get javadoc'd; see packageset below --> 2.364 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> 2.365 <javadoc 2.366 executable="${target.java.home}/bin/javadoc" 2.367 @@ -783,9 +937,9 @@ 2.368 </macrodef> 2.369 <property name="findbugs.defined" value="true"/> 2.370 </target> 2.371 - 2.372 + 2.373 <target name="-def-vizant" unless="vizant.defined" depends="-check-vizant"> 2.374 - <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/> 2.375 + <taskdef name="vizant" classname="net.sourceforge.vizant.Vizant" classpath="${vizant.jar}"/> 2.376 <property name="vizant.defined" value="true"/> 2.377 </target> 2.378 2.379 @@ -804,46 +958,19 @@ 2.380 </fail> 2.381 <fail message="@{name} is not installed in ${@{property}}"> 2.382 <condition> 2.383 - <and> 2.384 - <not> 2.385 - <equals arg1="@{marker}" arg2=""/> 2.386 - </not> 2.387 + <and> 2.388 + <not> 2.389 + <equals arg1="@{marker}" arg2=""/> 2.390 + </not> 2.391 <not> 2.392 <available file="${@{property}}/@{marker}"/> 2.393 </not> 2.394 - </and> 2.395 + </and> 2.396 </condition> 2.397 </fail> 2.398 </sequential> 2.399 </macrodef> 2.400 </target> 2.401 2.402 - <!-- standard JDK target --> 2.403 - <target name="sanity" 2.404 - description="display settings of configuration values"> 2.405 - <echo level="info">ant.home = ${ant.home}</echo> 2.406 - <echo level="info">boot.java.home = ${boot.java.home}</echo> 2.407 - <echo level="info">target.java.home = ${target.java.home}</echo> 2.408 - <echo level="info">jtreg.home = ${jtreg.home}</echo> 2.409 - <echo level="info">findbugs.home = ${findbugs.home}</echo> 2.410 - </target> 2.411 - 2.412 - <!-- useful debugging targets --> 2.413 - <target name="diagnostics"> 2.414 - <diagnostics/> 2.415 - </target> 2.416 - 2.417 - <target name="post-sanity" depends="-def-jtreg,sanity,build" 2.418 - description="perform basic validation after a standard build"> 2.419 - <jtreg 2.420 - dir="make/test" 2.421 - workDir="${build.jtreg.dir}/post-sanity/work" 2.422 - reportDir="${build.jtreg.dir}/post-sanity/report" 2.423 - jdk="${target.java.home}" 2.424 - verbose="summary" 2.425 - failonerror="false" resultproperty="jtreg.post-sanity.result"> 2.426 - </jtreg> 2.427 - 2.428 - </target> 2.429 </project> 2.430