build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Wed, 17 Jun 2009 15:11:07 +0200
changeset 1240 4b353465cd30
parent 1238 57914fd9382f
child 1241 e38683764572
permissions -rw-r--r--
In order to make javabeans module independent on applet and yet allow Beans class to have a method which references AppletInitializer, I am creating new module: deprecated7. This one shall consist of all the garbage identified in JDK7 development which has so many dependencies that it does not fit anywhere else. Beans class is moved there and instead of it, there is new BeanFactory class with the same methods (expect the one with AppletInitializer parameter).
     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     <!-- basic parameters -->
    12     <path id="src.path">
    13         <pathelement location="src/share/classes"/>
    14         <pathelement location="src/windows/classes"/>
    15         <pathelement location="src/solaris/classes"/>
    16     </path>
    17     <property name="build.dir" location="build/modularize"/>
    18 
    19     <!-- this is the core of the separation - definition
    20       of what classes belong into what compilation group.
    21     -->
    22     <selector id="applet">
    23         <or>
    24             <filename name="java/beans/AppletInitializer*"/>
    25             <filename name="java/applet/**"/>
    26             <filename name="sun/applet/**"/>
    27             <filename name="META-INF/services/sun.beans.AppletProxy"/>
    28         </or>
    29     </selector>
    30     <selector id="beans">
    31         <and>
    32             <or>
    33                 <filename name="java/beans/**"/>
    34                 <filename name="sun/beans/**"/>
    35                 <filename name="com/sun/beans/**"/>
    36             </or>
    37             <none>
    38                 <selector refid="applet"/>
    39                 <selector refid="deprecated7"/>
    40             </none>
    41         </and>
    42     </selector>
    43 
    44     <selector id="deprecated7">
    45         <or>
    46             <filename name="java/beans/Beans*"/>
    47         </or>
    48     </selector>
    49 
    50     <selector id="corba">
    51         <or>
    52             <filename name="org/omg/**"/>
    53             <filename name="com/sun/corba/**"/>
    54         </or>
    55     </selector>
    56     
    57     <selector id="base">
    58         <none>
    59             <selector refid="applet"/>
    60             <selector refid="beans"/>
    61             <selector refid="corba"/>
    62             <selector refid="deprecated7"/>
    63         </none>
    64     </selector>
    65 
    66     <!-- individual compilation tasks -->
    67 
    68     <target name="deprecated7">
    69         <antcall target="-compile-one-module">
    70             <param name="module" value="deprecated7"/>
    71             <param name="depends" value="beans:applet"/>
    72         </antcall>
    73     </target>
    74     <target name="applet">
    75         <antcall target="-compile-one-module">
    76             <param name="module" value="applet"/>
    77             <param name="depends" value="beans"/>
    78         </antcall>
    79     </target>
    80     <target name="beans">
    81         <antcall target="-compile-one-module">
    82             <param name="module" value="beans"/>
    83         </antcall>
    84     </target>
    85     
    86 
    87     <!-- as I am currently unable to build JDK myself, I'll start
    88       the modularization by extracting the base module from an existing
    89       classes
    90     -->
    91     <target name="base">
    92         <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
    93         <fail message="Cannot find rt.jar, specify with -Drt.jar=...">
    94             <condition><not><available file="${rt.jar}"/></not></condition>
    95         </fail>
    96 
    97         <mkdir dir="${build.dir}/rt"/>
    98         <unzip src="${rt.jar}" dest="${build.dir}/rt"/>
    99         <jar file="${build.dir}/base.jar" compress="false">
   100             <fileset dir="${build.dir}/rt">
   101                 <selector refid="base"/>
   102             </fileset>
   103         </jar>
   104     </target>
   105 
   106     <!-- shared routine to compile one of the modules -->
   107     <target name="-compile-one-module">
   108         <mkdir dir="${build.dir}/classes/${module}"/>
   109         <pathconvert pathsep=":"  property="module.cp">
   110             <path path="${depends}"/>
   111             <mapper type="regexp" from=".*[/\\]([^/\\]*)" to="${build.dir}/\1.jar"/>
   112         </pathconvert>
   113         <javac
   114             bootclasspath="${build.dir}/base.jar"
   115             sourcepath=""
   116             destdir="${build.dir}/classes/${module}"
   117             classpath="${module.cp}"
   118             includejavaruntime="false"
   119             includeantruntime="false"
   120         >
   121             <src refid="src.path"/>
   122             <selector refid="${module}"/>
   123         </javac>
   124         <copy todir="${build.dir}/classes/${module}">
   125             <fileset dir="src/share/classes">
   126                 <and>
   127                     <selector refid="${module}"/>
   128                     <not>
   129                         <filename name="**/*.java"/>
   130                     </not>
   131                 </and>
   132             </fileset>
   133         </copy>
   134 
   135         <jar 
   136             basedir="${build.dir}/classes/${module}"
   137             destfile="${build.dir}/${module}.jar"
   138             compress="false"
   139         />
   140     </target>
   141 
   142     <!-- clean everything -->
   143     <target name="clean">
   144         <delete dir="${build.dir}"/>
   145     </target>
   146 </project>