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