Initial build script that allows us to play with modularizing JDK
authorJaroslav Tulach <jtulach@netbeans.org>
Tue, 16 Jun 2009 15:37:17 +0200
changeset 12373021779e58a1
parent 1235 f72c0dc047b9
child 1238 57914fd9382f
Initial build script that allows us to play with modularizing JDK
build.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build.xml	Tue Jun 16 15:37:17 2009 +0200
     1.3 @@ -0,0 +1,97 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<project name="modularize" default="all" basedir=".">
     1.6 +    <description>Scripts to build JDK Java sources in modularized way</description>
     1.7 +
     1.8 +    <target name="all">
     1.9 +        <antcall target="extract-base"/>
    1.10 +        <antcall target="beans"/>
    1.11 +        <antcall target="applet"/>
    1.12 +    </target>
    1.13 +    <!-- basic parameters -->
    1.14 +    <path id="src.path">
    1.15 +        <pathelement location="src/share/classes"/>
    1.16 +        <pathelement location="src/windows/classes"/>
    1.17 +        <pathelement location="src/solaris/classes"/>
    1.18 +    </path>
    1.19 +    <property name="build.dir" location="build/modularize"/>
    1.20 +
    1.21 +    <!-- this is the core of the separation - definition
    1.22 +      of what classes belong into what compilation group.
    1.23 +    -->
    1.24 +    <selector id="applet">
    1.25 +        <or>
    1.26 +            <filename name="java/applet/**"/>
    1.27 +            <filename name="sun/applet/**"/>
    1.28 +        </or>
    1.29 +    </selector>
    1.30 +    <selector id="beans">
    1.31 +        <or>
    1.32 +            <filename name="java/beans/**"/>
    1.33 +            <filename name="sun/beans/**"/>
    1.34 +            <filename name="com/sun/beans/**"/>
    1.35 +        </or>
    1.36 +    </selector>
    1.37 +
    1.38 +    <selector id="corba">
    1.39 +        <or>
    1.40 +            <filename name="org/omg/**"/>
    1.41 +            <filename name="com/sun/corba/**"/>
    1.42 +        </or>
    1.43 +    </selector>
    1.44 +    
    1.45 +    <selector id="base">
    1.46 +        <none>
    1.47 +            <selector refid="applet"/>
    1.48 +            <selector refid="beans"/>
    1.49 +            <selector refid="corba"/>
    1.50 +        </none>
    1.51 +    </selector>
    1.52 +
    1.53 +    <!-- individual compilation tasks -->
    1.54 +
    1.55 +    <target name="applet">
    1.56 +        <antcall target="-compile-one-module">
    1.57 +            <param name="module" value="applet"/>
    1.58 +        </antcall>
    1.59 +    </target>
    1.60 +    <target name="beans">
    1.61 +        <antcall target="-compile-one-module">
    1.62 +            <param name="module" value="beans"/>
    1.63 +        </antcall>
    1.64 +    </target>
    1.65 +    
    1.66 +
    1.67 +    <!-- as I am currently unable to build JDK myself, I'll start
    1.68 +      the modularization by extracting the base module from an existing
    1.69 +      classes
    1.70 +    -->
    1.71 +    <target name="extract-base">
    1.72 +        <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
    1.73 +        <fail message="Cannot find rt.jar, specify with -Drt.jar=...">
    1.74 +            <condition><not><available file="${rt.jar}"/></not></condition>
    1.75 +        </fail>
    1.76 +
    1.77 +        <mkdir dir="${build.dir}/rt"/>
    1.78 +        <unzip src="${rt.jar}" dest="${build.dir}/rt"/>
    1.79 +        <jar file="${build.dir}/base.jar">
    1.80 +            <fileset dir="${build.dir}/rt">
    1.81 +                <selector refid="base"/>
    1.82 +            </fileset>
    1.83 +        </jar>
    1.84 +    </target>
    1.85 +
    1.86 +    <!-- shared routine to compile one of the modules -->
    1.87 +    <target name="-compile-one-module">
    1.88 +        <mkdir dir="${build.dir}/classes/${module}"/>
    1.89 +        <javac bootclasspath="${build.dir}/base.jar" sourcepath="" destdir="${build.dir}/classes/${module}">
    1.90 +            <src refid="src.path"/>
    1.91 +            <selector refid="${module}"/>
    1.92 +        </javac>
    1.93 +        <jar basedir="${build.dir}/classes/${module}" destfile="${build.dir}/${module}.jar"/>
    1.94 +    </target>
    1.95 +
    1.96 +    <!-- clean everything -->
    1.97 +    <target name="clean">
    1.98 +        <delete dir="${build.dir}"/>
    1.99 +    </target>
   1.100 +</project>