make/build.xml

Print this page




  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
  95  -->
  96 
  97 <project name="langtools" default="build" basedir="..">
  98     <!--
  99     **** Global property definitions.
 100     -->
 101 
 102     <!-- Force full debuginfo for javac if the debug.classfiles
 103     property is set.  This must be BEFORE the include of
 104     build.properties because it sets javac.debuglevel.  -->
 105     <condition property="javac.debuglevel" value="source,lines,vars">
 106         <equals arg1="${debug.classfiles}" arg2="true"/>


 228 
 229     <!-- Standard target to build deliverables for JDK build. -->
 230 
 231     <target name="build" depends="build-bootstrap-tools,build-all-classes">
 232         <copy todir="${dist.dir}/bootstrap">
 233             <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
 234         </copy>
 235         <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
 236             <include name="*"/>
 237         </chmod>
 238         <mkdir dir="${dist.lib.dir}"/>
 239         <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
 240         <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
 241     </target>
 242 
 243     <target name="build-bootstrap-tools"
 244         depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
 245     />
 246 
 247     <target name="build-all-tools"
 248         depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-apt"
 249     />
 250 
 251     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
 252         <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${apt.includes}"/>
 253     </target>
 254 
 255     <!-- clean -->
 256 
 257     <target name="clean" description="Delete all generated files">
 258         <delete dir="${build.dir}"/>
 259         <delete dir="${dist.dir}"/>
 260     </target>
 261 
 262     <!-- Additional targets for running tools on the build -->
 263 
 264     <target name="jtreg" depends="build-all-tools,-def-jtreg">
 265         <jtreg-tool name="all" tests="${jtreg.tests}"/>
 266     </target>
 267 
 268     <target name="checkstyle" depends="-def-checkstyle"
 269         description="Generates reports for code convention violations.">
 270         <mkdir dir="${dist.checkstyle.dir}"/>
 271         <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"
 272               failureProperty="checkstyle.failure"


 640         <build-jar  name="javap" includes="${javap.includes}"
 641                     jarmainclass="com.sun.tools.javap.Main"
 642                     jarclasspath="javac.jar"/>
 643         <build-tool name="javap"/>
 644     </target>
 645 
 646     <!-- (no javadoc for javap) -->
 647 
 648     <target name="jtreg-javap" depends="build-javap,-def-jtreg">
 649         <jtreg-tool name="javap" tests="${javap.tests}"/>
 650     </target>
 651 
 652     <target name="findbugs-javap" depends="build-javap,-def-findbugs">
 653         <findbugs-tool name="javap"/>
 654     </target>
 655 
 656     <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
 657 
 658 
 659     <!--
 660     **** apt targets.
 661     -->
 662 
 663     <target name="build-bootstrap-apt" depends="build-bootstrap-javac">
 664         <build-bootstrap-classes includes="${apt.includes}"/>
 665         <build-bootstrap-jar     name="apt" includes="${apt.includes}"
 666                                  jarclasspath="javac.jar"/>
 667         <build-bootstrap-tool    name="apt"/>
 668     </target>
 669 
 670     <target name="build-apt" depends="build-javac,build-classes-apt">
 671         <build-jar  name="apt" includes="${apt.includes}" jarclasspath="javac.jar"/>
 672         <build-tool name="apt"/>
 673     </target>
 674 
 675     <target name="build-classes-apt" depends="build-classes-javac">
 676         <build-classes includes="${apt.includes}"/>
 677     </target>
 678 
 679     <target name="javadoc-apt" depends="build-apt,-def-javadoc-tool">
 680         <javadoc-tool name="apt" includes="${apt.includes}"/>
 681     </target>
 682 
 683 
 684     <target name="jtreg-apt" depends="build-apt,-def-jtreg">
 685         <jtreg-tool name="apt" tests="${apt.tests}"/>
 686     </target>
 687 
 688     <target name="findbugs-apt" depends="build-apt,-def-findbugs">
 689         <findbugs-tool name="apt"/>
 690     </target>
 691 
 692     <target name="apt" depends="build-apt,jtreg-apt,findbugs-apt"/>
 693 
 694 
 695     <!--
 696     **** Create import JDK stubs.
 697     -->
 698 
 699     <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
 700         <mkdir dir="${build.genstubs.dir}"/>
 701         <genstubs
 702             srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
 703             includes="${import.jdk.stub.files}"
 704             fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"
 705         />
 706     </target>
 707 
 708 
 709     <!--
 710     **** Check targets.
 711     **** "-check-*" targets check that a required property is set, and set to a reasonable value.
 712     **** A user friendly message is generated if not, and the build exits.
 713     -->
 714 
 715     <target name="-check-boot.java.home" depends="-def-check">


 950                     version="false"
 951                     packagenames="${javadoc.packagenames}" >
 952                     <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
 953                     <arg line="@{options}"/>
 954                     <bootclasspath>
 955                         <path location="${build.classes.dir}"/>
 956                         <path location="${target.java.home}/jre/lib/rt.jar"/>
 957                     </bootclasspath>
 958                     <sourcepath>
 959                         <pathelement location="${src.classes.dir}"/>
 960                     </sourcepath>
 961                     <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
 962                     <!-- means that {@link some.package} will not work, which is no good. -->
 963                     <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
 964                     <!-- which also causes duplicates in the class index for included files.) -->
 965                     <packageset dir="${src.classes.dir}" includes="@{includes}">
 966                         <or>
 967                             <filename name="java/"/>
 968                             <filename name="javax/"/>
 969                             <filename name="com/sun/javadoc/"/>
 970                             <filename name="com/sun/mirror/"/>
 971                             <filename name="com/sun/source/"/>
 972                         </or>
 973                     </packageset>
 974                 </javadoc>
 975             </sequential>
 976         </macrodef>
 977     </target>
 978 
 979     <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
 980         <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
 981             <classpath>
 982                 <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
 983                 <pathelement location="${jtreg.home}/lib/javatest.jar"/>
 984             </classpath>
 985         </taskdef>
 986         <macrodef name="jtreg-tool">
 987             <attribute name="name"/>
 988             <attribute name="tests"/>
 989             <attribute name="jdk" default="${target.java.home}"/>
 990             <attribute name="samevm" default="true"/>




  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
  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
  95  -->
  96 
  97 <project name="langtools" default="build" basedir="..">
  98     <!--
  99     **** Global property definitions.
 100     -->
 101 
 102     <!-- Force full debuginfo for javac if the debug.classfiles
 103     property is set.  This must be BEFORE the include of
 104     build.properties because it sets javac.debuglevel.  -->
 105     <condition property="javac.debuglevel" value="source,lines,vars">
 106         <equals arg1="${debug.classfiles}" arg2="true"/>


 228 
 229     <!-- Standard target to build deliverables for JDK build. -->
 230 
 231     <target name="build" depends="build-bootstrap-tools,build-all-classes">
 232         <copy todir="${dist.dir}/bootstrap">
 233             <fileset dir="${build.bootstrap.dir}" includes="bin/,lib/"/>
 234         </copy>
 235         <chmod dir="${dist.dir}/bootstrap/bin" perm="ugo+rx">
 236             <include name="*"/>
 237         </chmod>
 238         <mkdir dir="${dist.lib.dir}"/>
 239         <jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
 240         <zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
 241     </target>
 242 
 243     <target name="build-bootstrap-tools"
 244         depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
 245     />
 246 
 247     <target name="build-all-tools"
 248         depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap"
 249     />
 250 
 251     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
 252         <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes}"/>
 253     </target>
 254 
 255     <!-- clean -->
 256 
 257     <target name="clean" description="Delete all generated files">
 258         <delete dir="${build.dir}"/>
 259         <delete dir="${dist.dir}"/>
 260     </target>
 261 
 262     <!-- Additional targets for running tools on the build -->
 263 
 264     <target name="jtreg" depends="build-all-tools,-def-jtreg">
 265         <jtreg-tool name="all" tests="${jtreg.tests}"/>
 266     </target>
 267 
 268     <target name="checkstyle" depends="-def-checkstyle"
 269         description="Generates reports for code convention violations.">
 270         <mkdir dir="${dist.checkstyle.dir}"/>
 271         <checkstyle config="${make.conf.dir}/checkstyle-langtools.xml"
 272               failureProperty="checkstyle.failure"


 640         <build-jar  name="javap" includes="${javap.includes}"
 641                     jarmainclass="com.sun.tools.javap.Main"
 642                     jarclasspath="javac.jar"/>
 643         <build-tool name="javap"/>
 644     </target>
 645 
 646     <!-- (no javadoc for javap) -->
 647 
 648     <target name="jtreg-javap" depends="build-javap,-def-jtreg">
 649         <jtreg-tool name="javap" tests="${javap.tests}"/>
 650     </target>
 651 
 652     <target name="findbugs-javap" depends="build-javap,-def-findbugs">
 653         <findbugs-tool name="javap"/>
 654     </target>
 655 
 656     <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
 657 
 658 
 659     <!--




































 660     **** Create import JDK stubs.
 661     -->
 662 
 663     <target name="-create-import-jdk-stubs" depends="-def-genstubs" if="require.import.jdk.stubs">
 664         <mkdir dir="${build.genstubs.dir}"/>
 665         <genstubs
 666             srcdir="${import.jdk.src.dir}" destdir="${build.genstubs.dir}"
 667             includes="${import.jdk.stub.files}"
 668             fork="true" classpath="${build.toolclasses.dir}:${build.bootstrap.dir}/classes:${ant.core.lib}"
 669         />
 670     </target>
 671 
 672 
 673     <!--
 674     **** Check targets.
 675     **** "-check-*" targets check that a required property is set, and set to a reasonable value.
 676     **** A user friendly message is generated if not, and the build exits.
 677     -->
 678 
 679     <target name="-check-boot.java.home" depends="-def-check">


 914                     version="false"
 915                     packagenames="${javadoc.packagenames}" >
 916                     <header><![CDATA[<strong>Unofficial Javadoc</strong> generated from developer sources for preview purposes only]]></header>
 917                     <arg line="@{options}"/>
 918                     <bootclasspath>
 919                         <path location="${build.classes.dir}"/>
 920                         <path location="${target.java.home}/jre/lib/rt.jar"/>
 921                     </bootclasspath>
 922                     <sourcepath>
 923                         <pathelement location="${src.classes.dir}"/>
 924                     </sourcepath>
 925                     <!-- XXX just <fileset> (restricted further to **/*.java) and no <packageset> -->
 926                     <!-- means that {@link some.package} will not work, which is no good. -->
 927                     <!-- (It correctly skips excluded single classes, but not if packageset is also included, -->
 928                     <!-- which also causes duplicates in the class index for included files.) -->
 929                     <packageset dir="${src.classes.dir}" includes="@{includes}">
 930                         <or>
 931                             <filename name="java/"/>
 932                             <filename name="javax/"/>
 933                             <filename name="com/sun/javadoc/"/>

 934                             <filename name="com/sun/source/"/>
 935                         </or>
 936                     </packageset>
 937                 </javadoc>
 938             </sequential>
 939         </macrodef>
 940     </target>
 941 
 942     <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home,-check-target.java.home">
 943         <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
 944             <classpath>
 945                 <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
 946                 <pathelement location="${jtreg.home}/lib/javatest.jar"/>
 947             </classpath>
 948         </taskdef>
 949         <macrodef name="jtreg-tool">
 950             <attribute name="name"/>
 951             <attribute name="tests"/>
 952             <attribute name="jdk" default="${target.java.home}"/>
 953             <attribute name="samevm" default="true"/>