build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Fri, 19 Jun 2009 15:33:12 +0200
changeset 1243 10e566202519
parent 1242 17fa6aaa52cb
child 1244 f2029f449786
permissions -rw-r--r--
all java sources compiles as a whole using ant
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@1243
    23
jtulach@1243
    24
    <target name="merge-sources"
jtulach@1243
    25
        description="Copies sources from all over the JDK tree into one place"
jtulach@1243
    26
    >
jtulach@1243
    27
        <mkdir dir="build/sources"/>
jtulach@1243
    28
        <copy todir="build/sources">
jtulach@1243
    29
            <fileset dir="${gensrc}"/>
jtulach@1243
    30
            <fileset dir="${gensrc}/../impsrc">
jtulach@1243
    31
                <exclude name="org/relaxng/datatype/**"/>
jtulach@1243
    32
            </fileset>
jtulach@1243
    33
            <fileset dir="../jaxp/src/share/classes/">
jtulach@1243
    34
                <exclude name="org/relaxng/datatype/**"/>
jtulach@1243
    35
            </fileset>
jtulach@1243
    36
            <fileset dir="../langtools/src/share/classes/">
jtulach@1243
    37
                <exclude name="org/relaxng/datatype/**"/>
jtulach@1243
    38
            </fileset>
jtulach@1243
    39
            <fileset dir="../jaxws/src/share/classes/">
jtulach@1243
    40
                <exclude name="org/relaxng/datatype/**"/>
jtulach@1243
    41
            </fileset>
jtulach@1243
    42
            <fileset dir="../corba/src/share/classes/"/>
jtulach@1243
    43
        </copy>
jtulach@1243
    44
    </target>
jtulach@1243
    45
jtulach@1242
    46
    <path id="src.path">
jtulach@1242
    47
        <pathelement location="src/share/classes"/>
jtulach@1243
    48
        <pathelement location="build/sources"/>
jtulach@1242
    49
        <pathelement location="src/solaris/classes"/>
jtulach@1242
    50
<!--        <pathelement location="src/windows/classes"/> -->
jtulach@1242
    51
    </path>
jtulach@1242
    52
    <property name="build.dir" location="build/modularize"/>
jtulach@1242
    53
jtulach@1242
    54
    <!-- this is the core of the separation - definition
jtulach@1242
    55
      of what classes belong into what compilation group.
jtulach@1242
    56
    -->
jtulach@1242
    57
    <selector id="applet">
jtulach@1242
    58
        <or>
jtulach@1242
    59
            <filename name="java/beans/AppletInitializer*"/>
jtulach@1242
    60
            <filename name="java/applet/**"/>
jtulach@1242
    61
            <filename name="sun/applet/**"/>
jtulach@1242
    62
            <filename name="META-INF/services/sun.beans.AppletProxy"/>
jtulach@1242
    63
        </or>
jtulach@1242
    64
    </selector>
jtulach@1242
    65
    <selector id="beans">
jtulach@1242
    66
        <and>
jtulach@1242
    67
            <or>
jtulach@1242
    68
                <filename name="java/beans/**"/>
jtulach@1242
    69
                <filename name="sun/beans/**"/>
jtulach@1242
    70
                <filename name="com/sun/beans/**"/>
jtulach@1242
    71
            </or>
jtulach@1242
    72
            <none>
jtulach@1242
    73
                <selector refid="applet"/>
jtulach@1242
    74
                <selector refid="deprecated7"/>
jtulach@1242
    75
            </none>
jtulach@1242
    76
        </and>
jtulach@1242
    77
    </selector>
jtulach@1242
    78
jtulach@1242
    79
    <selector id="deprecated7">
jtulach@1242
    80
        <or>
jtulach@1242
    81
            <filename name="java/beans/Beans*"/>
jtulach@1242
    82
        </or>
jtulach@1242
    83
    </selector>
jtulach@1242
    84
jtulach@1242
    85
    <selector id="base">
jtulach@1242
    86
        <!--
jtulach@1242
    87
            <selector refid="applet"/>
jtulach@1242
    88
            <selector refid="beans"/>
jtulach@1242
    89
            <selector refid="client"/>
jtulach@1242
    90
            <selector refid="enterprise"/>
jtulach@1242
    91
            <selector refid="deprecated7"/>
jtulach@1242
    92
            -->
jtulach@1242
    93
            <!-- exclude files that need pre-processing like
jtulach@1242
    94
                java/nio/ByteBufferAs-X-Buffer.java
jtulach@1242
    95
            -->
jtulach@1242
    96
jtulach@1242
    97
        <none>
jtulach@1242
    98
            <filename name="**/*-*"/>
jtulach@1242
    99
            <filename name="java/dyn/**"/>
jtulach@1242
   100
            <filename name="sun/dyn/**"/>
jtulach@1242
   101
jtulach@1242
   102
            <filename name="com/sun/script/javascript/**"/>
jtulach@1243
   103
            <filename name="sun/dc/**"/>
jtulach@1243
   104
            <filename name="sun/nio/fs/Solaris**"/>
jtulach@1243
   105
            <filename name="sun/tracing/**"/>
jtulach@1243
   106
            <filename name="com/sun/tracing/ProviderFactory*"/>
jtulach@1242
   107
        </none>
jtulach@1242
   108
    </selector>
jtulach@1242
   109
jtulach@1242
   110
    <!-- individual compilation tasks -->
jtulach@1242
   111
jtulach@1242
   112
    <target name="deprecated7">
jtulach@1242
   113
        <antcall target="-compile-one-module">
jtulach@1242
   114
            <param name="module" value="deprecated7"/>
jtulach@1242
   115
            <param name="depends" value="beans:applet"/>
jtulach@1242
   116
        </antcall>
jtulach@1242
   117
    </target>
jtulach@1242
   118
    <target name="applet">
jtulach@1242
   119
        <antcall target="-compile-one-module">
jtulach@1242
   120
            <param name="module" value="applet"/>
jtulach@1242
   121
            <param name="depends" value="beans"/>
jtulach@1242
   122
        </antcall>
jtulach@1242
   123
    </target>
jtulach@1242
   124
    <target name="beans">
jtulach@1242
   125
        <antcall target="-compile-one-module">
jtulach@1242
   126
            <param name="module" value="beans"/>
jtulach@1242
   127
        </antcall>
jtulach@1242
   128
    </target>
jtulach@1242
   129
jtulach@1242
   130
jtulach@1242
   131
    <target name="base">
jtulach@1242
   132
        <antcall target="-compile-one-module">
jtulach@1242
   133
            <param name="module" value="base"/>
jtulach@1242
   134
        </antcall>
jtulach@1242
   135
    </target>
jtulach@1242
   136
jtulach@1242
   137
    <!-- shared routine to compile one of the modules -->
jtulach@1242
   138
    <target name="-compile-one-module">
jtulach@1242
   139
        <mkdir dir="${build.dir}/classes/${module}"/>
jtulach@1242
   140
        <pathconvert pathsep=":"  property="module.cp">
jtulach@1242
   141
            <path path="${depends}"/>
jtulach@1242
   142
            <mapper type="regexp" from=".*[/\\]([^/\\]*)" to="${build.dir}/\1.jar"/>
jtulach@1242
   143
        </pathconvert>
jtulach@1242
   144
        <jar
jtulach@1242
   145
            basedir="${build.dir}/classes/${module}"
jtulach@1242
   146
            destfile="${build.dir}/empty.jar"
jtulach@1242
   147
            compress="false"
jtulach@1242
   148
        >
jtulach@1242
   149
            <exclude name="**"/>
jtulach@1242
   150
        </jar>
jtulach@1242
   151
        <javac
jtulach@1242
   152
            bootclasspath="${build.dir}/empty.jar"
jtulach@1242
   153
            sourcepath=""
jtulach@1242
   154
            destdir="${build.dir}/classes/${module}"
jtulach@1242
   155
            includejavaruntime="false"
jtulach@1242
   156
            includeantruntime="false"
jtulach@1242
   157
            classpath="${module.cp}:${plugs}/jre/lib/rt-closed.jar"
jtulach@1242
   158
        >
jtulach@1242
   159
            <src refid="src.path"/>
jtulach@1242
   160
            <selector refid="${module}"/>
jtulach@1242
   161
        </javac>
jtulach@1242
   162
        <copy todir="${build.dir}/classes/${module}">
jtulach@1242
   163
            <fileset dir="src/share/classes">
jtulach@1242
   164
                <and>
jtulach@1242
   165
                    <selector refid="${module}"/>
jtulach@1242
   166
                    <not>
jtulach@1242
   167
                        <filename name="**/*.java"/>
jtulach@1242
   168
                    </not>
jtulach@1242
   169
                </and>
jtulach@1242
   170
            </fileset>
jtulach@1242
   171
        </copy>
jtulach@1242
   172
jtulach@1242
   173
        <jar 
jtulach@1242
   174
            basedir="${build.dir}/classes/${module}"
jtulach@1242
   175
            destfile="${build.dir}/${module}.jar"
jtulach@1242
   176
            compress="false"
jtulach@1242
   177
        />
jtulach@1242
   178
    </target>
jtulach@1242
   179
jtulach@1242
   180
    <!-- clean everything -->
jtulach@1242
   181
    <target name="clean">
jtulach@1242
   182
        <delete dir="${build.dir}"/>
jtulach@1242
   183
    </target>
jtulach@1242
   184
</project>