23 or visit www.oracle.com if you need additional information or have any |
23 or visit www.oracle.com if you need additional information or have any |
24 questions. |
24 questions. |
25 --> |
25 --> |
26 |
26 |
27 <!-- |
27 <!-- |
28 This is the main build file for the complete langtools workspace. |
28 This is the main build file for the complete langtools repository. |
29 It is used both when working on the tools in NetBeans, and when building |
29 It is used when building JDK (in which case it is invoked from the |
30 JDK itself, in which case it is invoked from the wrapper Makefile. |
30 Makefile), and it can be used when working on the tools themselves, |
|
31 in an IDE such as NetBeans. |
|
32 |
|
33 External dependencies are specified via properties. These can be given |
|
34 on the command line, or by providing a local build.properties file. |
|
35 (They can also be edited into make/build.properties, although that is not |
|
36 recommended.) At a minimum, boot.java.home must be set to the installed |
|
37 location of the version of JDK used to build this repository. Additional |
|
38 properties may be required, depending on the targets that are built. |
|
39 For example, to run any of the jtreg tests you must set jtreg.home, |
|
40 to run findbugs on the code you must set findbugs.home, and so on. |
|
41 |
|
42 For the most part, javac can be built using the previous version of JDK. |
|
43 However, a small number of javac files require access to the latest JDK, |
|
44 which may not yet have been compiled. To compile these files, you can do |
|
45 one of the following: |
|
46 - Set boot.java.home to a recent build of the latest version of JDK. |
|
47 - Set import.jdk to either a recent build (containing jre/lib/rt.jar) |
|
48 or to jdk source repository. In the latter case, stub files will |
|
49 automatically be generated and used for the required API, to avoid |
|
50 unnecessary compilation of the source repository. |
|
51 If you do neither, the relevant files will not be built. |
|
52 |
|
53 The main build happens in two phases: |
|
54 - First, javac and other tools as needed are built using ${boot.java.home}. |
|
55 (This implies a constraint on the source code that they can be compiled |
|
56 with the previous version of JDK. |
|
57 - Second, all required classes are compiled with the latest javac, created |
|
58 in the previous step. |
|
59 The first phase is called the bootstrap phase. All targets, properties and |
|
60 tasks that are specific to that phase have "bootstrap" in their name. |
|
61 |
|
62 For more details on the JDK build, see |
|
63 http://blogs.sun.com/kto/entry/anatomy_of_the_jdk_build |
|
64 http://openjdk.java.net/groups/build/ |
|
65 For more details on the stub generator, see |
|
66 http://blogs.sun.com/jjg/entry/building_javac_for_jdk7 |
|
67 |
|
68 Internal details ... |
|
69 |
|
70 Interim build products are created in the build/ directory. |
|
71 Final build products are created in the dist/ directory. |
|
72 When building JDK, the dist/directory will contain: |
|
73 - A bootstrap compiler suitable for running with ${boot.java.home} |
|
74 suitable for compiling downstream parts of JDK |
|
75 - Source files and class files for inclusion in the JDK being built |
|
76 When building standalone, the dist/directory will contain: |
|
77 - Separate jar files for each of the separate langtools components |
|
78 - Simple scripts to invoke the tools by executing the corresponding |
|
79 jar files. |
|
80 These jar files and scripts are "for developer use only". |
|
81 |
|
82 This file is organized into sections as follows: |
|
83 - global property definitions |
|
84 - general top level targets |
|
85 - general diagnostic/debugging targets |
|
86 - groups of targets for each tool: javac, javadoc, doclets, javah, javap, apt |
|
87 Within each group, the following targets are provided, where applicable |
|
88 build-bootstrap-TOOL build the bootstrap version of the tool |
|
89 build-classes-TOOL build the classes for the tool |
|
90 build-TOOL build the jar file and script for the tool |
|
91 jtreg-TOOL build the tool and run the appropriate tests |
|
92 findbugs-TOOL run findbugs on the tool's source oode |
|
93 TOOL build the tool, run the tests, and run findbugs |
|
94 - utility definitions |
31 --> |
95 --> |
32 |
96 |
33 <project name="langtools" default="build" basedir=".."> |
97 <project name="langtools" default="build" basedir=".."> |
|
98 <!-- |
|
99 **** Global property definitions. |
|
100 --> |
34 |
101 |
35 <!-- Force full debuginfo for javac if the debug.classfiles |
102 <!-- Force full debuginfo for javac if the debug.classfiles |
36 property is set. This must be BEFORE the include of |
103 property is set. This must be BEFORE the include of |
37 build.properties because it sets javac.debuglevel. --> |
104 build.properties because it sets javac.debuglevel. --> |
38 <condition property="javac.debuglevel" value="source,lines,vars"> |
105 <condition property="javac.debuglevel" value="source,lines,vars"> |
105 filepath="${import.jdk}/src/share/classes" file="java/nio/file/Path.java"/> |
172 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" |
173 <available property="import.jdk.jar" value="${import.jdk}/jre/lib/rt.jar" |
107 ignoresystemclasses="true" |
174 ignoresystemclasses="true" |
108 classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/> |
175 classpath="${import.jdk}/jre/lib/rt.jar" classname="java.nio.file.Path"/> |
109 |
176 |
110 <!-- Set the default value of the sourcepath used for javac. --> |
177 <!-- Set the default bootclasspath option used for javac. |
111 <condition property="javac.sourcepath" value="${build.genstubs.dir}" else=""> |
178 Note that different variants of the option are used, meaning we can't just |
112 <isset property="import.jdk.src.dir"/> |
179 define the value for the option. |
113 </condition> |
180 Note the explicit use of the standard property ${path.separator} in the following. |
114 |
181 This is because Ant is not clever enough to handle direct use of : or ; --> |
115 <!-- Set the default value of the classpath used for javac. --> |
|
116 <property name="javac.classpath" value=""/> |
|
117 |
|
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" |
182 <condition property="javac.bootclasspath.opt" |
124 value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}" |
183 value="-Xbootclasspath:${build.classes.dir}${path.separator}${import.jdk.jar}" |
125 else="-Xbootclasspath/p:${build.classes.dir}"> |
184 else="-Xbootclasspath/p:${build.classes.dir}"> |
126 <isset property="import.jdk.jar"/> |
185 <isset property="import.jdk.jar"/> |
127 </condition> |
186 </condition> |
128 |
187 |
129 <condition property="exclude.files" value="" else="${require.import.jdk.files}"> |
188 <condition property="boot.java.provides.latest.jdk"> |
130 <isset property="import.jdk"/> |
189 <available |
|
190 ignoresystemclasses="true" |
|
191 classpath="${boot.java.home}/jre/lib/rt.jar" classname="java.nio.file.Path"/> |
131 </condition> |
192 </condition> |
132 |
193 |
133 <!-- for debugging --> |
194 <condition property="bootstrap.exclude.files" value="" else="${require.latest.jdk.files}"> |
134 <target name="check-import.jdk"> |
195 <isset property="boot.java.provides.latest.jdk"/> |
135 <echo message="import.jdk: ${import.jdk}"/> |
196 </condition> |
136 <echo message="import.jdk.jar: ${import.jdk.jar}"/> |
197 |
137 <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/> |
198 <condition property="exclude.files" value="" else="${require.latest.jdk.files}"> |
138 </target> |
199 <or> |
139 |
200 <isset property="boot.java.provides.latest.jdk"/> |
140 <target name="vizant" depends="-def-vizant"> |
201 <isset property="import.jdk"/> |
141 <mkdir dir="${build.dir}"/> |
202 </or> |
142 <echo message="Generating ${build.dir}/build.dot"/> |
203 </condition> |
143 <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/> |
204 |
144 <echo message="Generating ${build.dir}/build.png"/> |
205 <condition property="require.import.jdk.stubs"> |
145 <exec executable="${dot}" > |
206 <and> |
146 <arg value="-Tpng"/> |
207 <not> |
147 <arg value="-o"/> |
208 <isset property="boot.java.provides.latest.jdk"/> |
148 <arg file="${build.dir}/build.png"/> |
209 </not> |
149 <arg file="${build.dir}/build.dot"/> |
210 <isset property="import.jdk.src.dir"/> |
150 </exec> |
211 </and> |
151 </target> |
212 </condition> |
|
213 |
|
214 <!-- Set the default value of the sourcepath used for javac. --> |
|
215 <condition property="javac.sourcepath" value="${build.genstubs.dir}" else=""> |
|
216 <isset property="require.import.jdk.stubs"/> |
|
217 </condition> |
|
218 |
|
219 <!-- Set the default value of the classpath used for javac. --> |
|
220 <property name="javac.classpath" value=""/> |
|
221 |
|
222 |
|
223 <!-- |
|
224 **** General top level targets. |
|
225 --> |
152 |
226 |
153 <!-- Standard target to build deliverables for JDK build. --> |
227 <!-- Standard target to build deliverables for JDK build. --> |
154 |
228 |
155 <target name="build" depends="build-bootstrap-tools,build-all-classes"> |
229 <target name="build" depends="build-bootstrap-tools,build-all-classes"> |
156 <copy todir="${dist.dir}/bootstrap"> |
230 <copy todir="${dist.dir}/bootstrap"> |
246 srcdir="${src.classes.dir}" |
320 srcdir="${src.classes.dir}" |
247 destdir="${dist.coverage.dir}" |
321 destdir="${dist.coverage.dir}" |
248 datafile="${build.coverage.dir}/cobertura.ser"/> |
322 datafile="${build.coverage.dir}/cobertura.ser"/> |
249 </target> |
323 </target> |
250 |
324 |
251 <!-- javac targets --> |
325 |
|
326 <!-- |
|
327 **** Debugging/diagnostic targets. |
|
328 --> |
|
329 |
|
330 <!-- standard JDK target --> |
|
331 <target name="sanity" |
|
332 description="display settings of configuration values"> |
|
333 <echo level="info">ant.home = ${ant.home}</echo> |
|
334 <echo level="info">boot.java.home = ${boot.java.home}</echo> |
|
335 <echo level="info">target.java.home = ${target.java.home}</echo> |
|
336 <echo level="info">jtreg.home = ${jtreg.home}</echo> |
|
337 <echo level="info">findbugs.home = ${findbugs.home}</echo> |
|
338 </target> |
|
339 |
|
340 <target name="post-sanity" depends="-def-jtreg,sanity,build" |
|
341 description="perform basic validation after a standard build"> |
|
342 <jtreg |
|
343 dir="make/test" |
|
344 workDir="${build.jtreg.dir}/post-sanity/work" |
|
345 reportDir="${build.jtreg.dir}/post-sanity/report" |
|
346 jdk="${target.java.home}" |
|
347 verbose="summary" |
|
348 failonerror="false" resultproperty="jtreg.post-sanity.result"> |
|
349 </jtreg> |
|
350 </target> |
|
351 |
|
352 <!-- use vizant tool to generate graphical image of this Ant file.--> |
|
353 <target name="vizant" depends="-def-vizant"> |
|
354 <mkdir dir="${build.dir}"/> |
|
355 <echo message="Generating ${build.dir}/build.dot"/> |
|
356 <vizant antfile="${make.dir}/build.xml" outfile="${build.dir}/build.dot"/> |
|
357 <echo message="Generating ${build.dir}/build.png"/> |
|
358 <exec executable="${dot}" > |
|
359 <arg value="-Tpng"/> |
|
360 <arg value="-o"/> |
|
361 <arg file="${build.dir}/build.png"/> |
|
362 <arg file="${build.dir}/build.dot"/> |
|
363 </exec> |
|
364 </target> |
|
365 |
|
366 <target name="check-import.jdk"> |
|
367 <echo message="import.jdk: ${import.jdk}"/> |
|
368 <echo message="import.jdk.jar: ${import.jdk.jar}"/> |
|
369 <echo message="import.jdk.src.dir: ${import.jdk.src.dir}"/> |
|
370 </target> |
|
371 |
|
372 <target name="diagnostics"> |
|
373 <diagnostics/> |
|
374 </target> |
|
375 |
|
376 |
|
377 <!-- |
|
378 **** javac targets. |
|
379 --> |
252 |
380 |
253 <target name="build-bootstrap-javac" |
381 <target name="build-bootstrap-javac" |
254 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> |
382 depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool"> |
255 <build-bootstrap-classes includes="${javac.includes}"/> |
383 <build-bootstrap-classes includes="${javac.includes}"/> |
256 <build-bootstrap-jar name="javac" includes="${javac.includes}"/> |
384 <build-bootstrap-jar name="javac" includes="${javac.includes}"/> |
437 <findbugs-tool name="apt"/> |
580 <findbugs-tool name="apt"/> |
438 </target> |
581 </target> |
439 |
582 |
440 <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/> |
583 <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/> |
441 |
584 |
442 <!-- Create import JDK stubs --> |
585 |
443 |
586 <!-- |
444 <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="import.jdk.src.dir"> |
587 **** Create import JDK stubs. |
|
588 --> |
|
589 |
|
590 <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs"> |
445 <mkdir dir="${build.genstubs.dir}"/> |
591 <mkdir dir="${build.genstubs.dir}"/> |
446 <genstubs |
592 <genstubs |
447 srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}" |
593 srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}" |
448 includes="${import.jdk.stub.files}" |
594 includes="${import.jdk.stub.files}" |
449 fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar" |
595 fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.home}/lib/ant.jar" |
450 /> |
596 /> |
451 </target> |
597 </target> |
452 |
598 |
453 <!-- Check targets --> |
599 |
|
600 <!-- |
|
601 **** Check targets. |
|
602 **** "-check-*" targets check that a required property is set, and set to a reasonable value. |
|
603 **** A user friendly message is generated if not, and the build exits. |
|
604 --> |
454 |
605 |
455 <target name="-check-boot.java.home" depends="-def-check"> |
606 <target name="-check-boot.java.home" depends="-def-check"> |
456 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> |
607 <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/> |
457 </target> |
608 </target> |
458 |
609 |
656 <attribute name="options" default=""/> |
810 <attribute name="options" default=""/> |
657 <attribute name="source" default="1.5"/> <!-- FIXME --> |
811 <attribute name="source" default="1.5"/> <!-- FIXME --> |
658 <sequential> |
812 <sequential> |
659 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> |
813 <property name="javadoc.options" value=""/> <!-- default, can be overridden per user or per project --> |
660 <!-- Note: even with this default value, includes |
814 <!-- Note: even with this default value, includes |
661 from src.classes.dir get javadoc'd; see packageset below --> |
815 from src.classes.dir get javadoc'd; see packageset below --> |
662 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> |
816 <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project --> |
663 <javadoc |
817 <javadoc |
664 executable="${target.java.home}/bin/javadoc" |
818 executable="${target.java.home}/bin/javadoc" |
665 destdir="${build.javadoc.dir}/@{name}" |
819 destdir="${build.javadoc.dir}/@{name}" |
666 source="@{source}" |
820 source="@{source}" |
802 </not> |
956 </not> |
803 </condition> |
957 </condition> |
804 </fail> |
958 </fail> |
805 <fail message="@{name} is not installed in ${@{property}}"> |
959 <fail message="@{name} is not installed in ${@{property}}"> |
806 <condition> |
960 <condition> |
807 <and> |
961 <and> |
808 <not> |
962 <not> |
809 <equals arg1="@{marker}" arg2=""/> |
963 <equals arg1="@{marker}" arg2=""/> |
810 </not> |
964 </not> |
811 <not> |
965 <not> |
812 <available file="${@{property}}/@{marker}"/> |
966 <available file="${@{property}}/@{marker}"/> |
813 </not> |
967 </not> |
814 </and> |
968 </and> |
815 </condition> |
969 </condition> |
816 </fail> |
970 </fail> |
817 </sequential> |
971 </sequential> |
818 </macrodef> |
972 </macrodef> |
819 </target> |
973 </target> |
820 |
974 |
821 <!-- standard JDK target --> |
|
822 <target name="sanity" |
|
823 description="display settings of configuration values"> |
|
824 <echo level="info">ant.home = ${ant.home}</echo> |
|
825 <echo level="info">boot.java.home = ${boot.java.home}</echo> |
|
826 <echo level="info">target.java.home = ${target.java.home}</echo> |
|
827 <echo level="info">jtreg.home = ${jtreg.home}</echo> |
|
828 <echo level="info">findbugs.home = ${findbugs.home}</echo> |
|
829 </target> |
|
830 |
|
831 <!-- useful debugging targets --> |
|
832 <target name="diagnostics"> |
|
833 <diagnostics/> |
|
834 </target> |
|
835 |
|
836 <target name="post-sanity" depends="-def-jtreg,sanity,build" |
|
837 description="perform basic validation after a standard build"> |
|
838 <jtreg |
|
839 dir="make/test" |
|
840 workDir="${build.jtreg.dir}/post-sanity/work" |
|
841 reportDir="${build.jtreg.dir}/post-sanity/report" |
|
842 jdk="${target.java.home}" |
|
843 verbose="summary" |
|
844 failonerror="false" resultproperty="jtreg.post-sanity.result"> |
|
845 </jtreg> |
|
846 |
|
847 </target> |
|
848 </project> |
975 </project> |
849 |
976 |