build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Thu, 18 Jun 2009 17:48:58 +0200
changeset 1241 e38683764572
parent 1240 4b353465cd30
child 1244 f2029f449786
permissions -rw-r--r--
Invoking 'ant clean base' after the JDK is compiled via 'make all' now compiles everything into build/modularize/base.jar
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <project name="modularize" default="all" basedir=".">
     3     <description>Scripts to build JDK Java sources in modularized way</description>
     4 
     5     <target name="all">
     6         <antcall target="base"/>
     7         <antcall target="beans"/>
     8         <antcall target="applet"/>
     9         <antcall target="deprecated7"/>
    10     </target>
    11 
    12     <!-- basic parameters -->
    13     <pathconvert property="gensrc">
    14         <path><dirset dir="../build"><include name="*/gensrc"/></dirset></path>
    15     </pathconvert>
    16     <pathconvert property="javacompiler">
    17         <path><dirset dir="../build"><include name="*/langtools/build/classes"/></dirset></path>
    18     </pathconvert>
    19     <fail message="You need to provide location of JDK's generated sources via -Dgensrc=...">
    20         <condition><not><available file="${gensrc}"/></not></condition>
    21     </fail>
    22     <fail message="Javacompiler build is missing">
    23         <condition><not><available file="${javacompiler}"/></not></condition>
    24     </fail>
    25     <path id="src.path">
    26         <pathelement location="src/share/classes"/>
    27         <pathelement location="${gensrc}"/>
    28         <pathelement location="src/windows/classes"/>
    29         <!--
    30         <pathelement location="src/solaris/classes"/>
    31         -->
    32     </path>
    33     <property name="build.dir" location="build/modularize"/>
    34 
    35     <!-- this is the core of the separation - definition
    36       of what classes belong into what compilation group.
    37     -->
    38     <selector id="applet">
    39         <or>
    40             <filename name="java/beans/AppletInitializer*"/>
    41             <filename name="java/applet/**"/>
    42             <filename name="sun/applet/**"/>
    43             <filename name="META-INF/services/sun.beans.AppletProxy"/>
    44         </or>
    45     </selector>
    46     <selector id="beans">
    47         <and>
    48             <or>
    49                 <filename name="java/beans/**"/>
    50                 <filename name="sun/beans/**"/>
    51                 <filename name="com/sun/beans/**"/>
    52             </or>
    53             <none>
    54                 <selector refid="applet"/>
    55                 <selector refid="deprecated7"/>
    56             </none>
    57         </and>
    58     </selector>
    59 
    60     <selector id="deprecated7">
    61         <or>
    62             <filename name="java/beans/Beans*"/>
    63         </or>
    64     </selector>
    65 
    66     <selector id="base">
    67         <!--
    68             <selector refid="applet"/>
    69             <selector refid="beans"/>
    70             <selector refid="client"/>
    71             <selector refid="enterprise"/>
    72             <selector refid="deprecated7"/>
    73             -->
    74             <!-- exclude files that need pre-processing like
    75                 java/nio/ByteBufferAs-X-Buffer.java
    76             -->
    77 
    78         <none>
    79             <filename name="**/*-*"/>
    80             <filename name="java/dyn/**"/>
    81             <filename name="sun/dyn/**"/>
    82             <filename name="javax/management/remote/rmi/RMIConnector*"/>
    83             <filename name="sun/tracing/**"/>
    84             <filename name="com/sun/tracing/**"/>
    85             <filename name="com/sun/java/swing/plaf/gtk/**"/>
    86             
    87 <!--            <filename name="javax/management/**"/> -->
    88 <!--            <filename name="sun/nio/fs/**"/> -->
    89 <!--            <filename name="com/sun/jmx/**"/> -->
    90 
    91             <!-- exclude corba related stuff -->
    92             <filename name="com/sun/jndi/cosnaming/**"/>
    93             <filename name="com/sun/jndi/toolkit/corba/**"/>
    94 
    95             <filename name="com/sun/script/javascript/**"/>
    96         </none>
    97     </selector>
    98 
    99     <!-- individual compilation tasks -->
   100 
   101     <target name="deprecated7">
   102         <antcall target="-compile-one-module">
   103             <param name="module" value="deprecated7"/>
   104             <param name="depends" value="beans:applet"/>
   105         </antcall>
   106     </target>
   107     <target name="applet">
   108         <antcall target="-compile-one-module">
   109             <param name="module" value="applet"/>
   110             <param name="depends" value="beans"/>
   111         </antcall>
   112     </target>
   113     <target name="beans">
   114         <antcall target="-compile-one-module">
   115             <param name="module" value="beans"/>
   116         </antcall>
   117     </target>
   118 
   119 
   120     <target name="base">
   121         <antcall target="-compile-one-module">
   122             <param name="module" value="base"/>
   123         </antcall>
   124     </target>
   125 
   126     <!-- shared routine to compile one of the modules -->
   127     <target name="-compile-one-module">
   128         <mkdir dir="${build.dir}/classes/${module}"/>
   129         <pathconvert pathsep=":"  property="module.cp">
   130             <path path="${depends}"/>
   131             <mapper type="regexp" from=".*[/\\]([^/\\]*)" to="${build.dir}/\1.jar"/>
   132         </pathconvert>
   133         <javac
   134             bootclasspath="${build.dir}/base.jar"
   135             sourcepath=""
   136             destdir="${build.dir}/classes/${module}"
   137             includejavaruntime="false"
   138             includeantruntime="false"
   139         >
   140             <classpath>
   141                 <path path="${module.cp}"/>
   142                 <pathelement location="${javacompiler}"/>
   143             </classpath>
   144             <src refid="src.path"/>
   145             <selector refid="${module}"/>
   146         </javac>
   147         <copy todir="${build.dir}/classes/${module}">
   148             <fileset dir="src/share/classes">
   149                 <and>
   150                     <selector refid="${module}"/>
   151                     <not>
   152                         <filename name="**/*.java"/>
   153                     </not>
   154                 </and>
   155             </fileset>
   156         </copy>
   157 
   158         <jar 
   159             basedir="${build.dir}/classes/${module}"
   160             destfile="${build.dir}/${module}.jar"
   161             compress="false"
   162         />
   163     </target>
   164 
   165     <!-- clean everything -->
   166     <target name="clean">
   167         <delete dir="${build.dir}"/>
   168     </target>
   169 </project>