build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Tue, 16 Jun 2009 15:37:17 +0200
changeset 1237 3021779e58a1
child 1238 57914fd9382f
permissions -rw-r--r--
Initial build script that allows us to play with modularizing JDK
jtulach@1237
     1
<?xml version="1.0" encoding="UTF-8"?>
jtulach@1237
     2
<project name="modularize" default="all" basedir=".">
jtulach@1237
     3
    <description>Scripts to build JDK Java sources in modularized way</description>
jtulach@1237
     4
jtulach@1237
     5
    <target name="all">
jtulach@1237
     6
        <antcall target="extract-base"/>
jtulach@1237
     7
        <antcall target="beans"/>
jtulach@1237
     8
        <antcall target="applet"/>
jtulach@1237
     9
    </target>
jtulach@1237
    10
    <!-- basic parameters -->
jtulach@1237
    11
    <path id="src.path">
jtulach@1237
    12
        <pathelement location="src/share/classes"/>
jtulach@1237
    13
        <pathelement location="src/windows/classes"/>
jtulach@1237
    14
        <pathelement location="src/solaris/classes"/>
jtulach@1237
    15
    </path>
jtulach@1237
    16
    <property name="build.dir" location="build/modularize"/>
jtulach@1237
    17
jtulach@1237
    18
    <!-- this is the core of the separation - definition
jtulach@1237
    19
      of what classes belong into what compilation group.
jtulach@1237
    20
    -->
jtulach@1237
    21
    <selector id="applet">
jtulach@1237
    22
        <or>
jtulach@1237
    23
            <filename name="java/applet/**"/>
jtulach@1237
    24
            <filename name="sun/applet/**"/>
jtulach@1237
    25
        </or>
jtulach@1237
    26
    </selector>
jtulach@1237
    27
    <selector id="beans">
jtulach@1237
    28
        <or>
jtulach@1237
    29
            <filename name="java/beans/**"/>
jtulach@1237
    30
            <filename name="sun/beans/**"/>
jtulach@1237
    31
            <filename name="com/sun/beans/**"/>
jtulach@1237
    32
        </or>
jtulach@1237
    33
    </selector>
jtulach@1237
    34
jtulach@1237
    35
    <selector id="corba">
jtulach@1237
    36
        <or>
jtulach@1237
    37
            <filename name="org/omg/**"/>
jtulach@1237
    38
            <filename name="com/sun/corba/**"/>
jtulach@1237
    39
        </or>
jtulach@1237
    40
    </selector>
jtulach@1237
    41
    
jtulach@1237
    42
    <selector id="base">
jtulach@1237
    43
        <none>
jtulach@1237
    44
            <selector refid="applet"/>
jtulach@1237
    45
            <selector refid="beans"/>
jtulach@1237
    46
            <selector refid="corba"/>
jtulach@1237
    47
        </none>
jtulach@1237
    48
    </selector>
jtulach@1237
    49
jtulach@1237
    50
    <!-- individual compilation tasks -->
jtulach@1237
    51
jtulach@1237
    52
    <target name="applet">
jtulach@1237
    53
        <antcall target="-compile-one-module">
jtulach@1237
    54
            <param name="module" value="applet"/>
jtulach@1237
    55
        </antcall>
jtulach@1237
    56
    </target>
jtulach@1237
    57
    <target name="beans">
jtulach@1237
    58
        <antcall target="-compile-one-module">
jtulach@1237
    59
            <param name="module" value="beans"/>
jtulach@1237
    60
        </antcall>
jtulach@1237
    61
    </target>
jtulach@1237
    62
    
jtulach@1237
    63
jtulach@1237
    64
    <!-- as I am currently unable to build JDK myself, I'll start
jtulach@1237
    65
      the modularization by extracting the base module from an existing
jtulach@1237
    66
      classes
jtulach@1237
    67
    -->
jtulach@1237
    68
    <target name="extract-base">
jtulach@1237
    69
        <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
jtulach@1237
    70
        <fail message="Cannot find rt.jar, specify with -Drt.jar=...">
jtulach@1237
    71
            <condition><not><available file="${rt.jar}"/></not></condition>
jtulach@1237
    72
        </fail>
jtulach@1237
    73
jtulach@1237
    74
        <mkdir dir="${build.dir}/rt"/>
jtulach@1237
    75
        <unzip src="${rt.jar}" dest="${build.dir}/rt"/>
jtulach@1237
    76
        <jar file="${build.dir}/base.jar">
jtulach@1237
    77
            <fileset dir="${build.dir}/rt">
jtulach@1237
    78
                <selector refid="base"/>
jtulach@1237
    79
            </fileset>
jtulach@1237
    80
        </jar>
jtulach@1237
    81
    </target>
jtulach@1237
    82
jtulach@1237
    83
    <!-- shared routine to compile one of the modules -->
jtulach@1237
    84
    <target name="-compile-one-module">
jtulach@1237
    85
        <mkdir dir="${build.dir}/classes/${module}"/>
jtulach@1237
    86
        <javac bootclasspath="${build.dir}/base.jar" sourcepath="" destdir="${build.dir}/classes/${module}">
jtulach@1237
    87
            <src refid="src.path"/>
jtulach@1237
    88
            <selector refid="${module}"/>
jtulach@1237
    89
        </javac>
jtulach@1237
    90
        <jar basedir="${build.dir}/classes/${module}" destfile="${build.dir}/${module}.jar"/>
jtulach@1237
    91
    </target>
jtulach@1237
    92
jtulach@1237
    93
    <!-- clean everything -->
jtulach@1237
    94
    <target name="clean">
jtulach@1237
    95
        <delete dir="${build.dir}"/>
jtulach@1237
    96
    </target>
jtulach@1237
    97
</project>