build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Thu, 18 Jun 2009 17:48:58 +0200
changeset 1241 e38683764572
parent 1240 4b353465cd30
child 1244 f2029f449786
permissions -rw-r--r--
Invoking 'ant clean base' after the JDK is compiled via 'make all' now compiles everything into build/modularize/base.jar
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@1238
     6
        <antcall target="base"/>
jtulach@1237
     7
        <antcall target="beans"/>
jtulach@1237
     8
        <antcall target="applet"/>
jtulach@1240
     9
        <antcall target="deprecated7"/>
jtulach@1237
    10
    </target>
jtulach@1241
    11
jtulach@1237
    12
    <!-- basic parameters -->
jtulach@1241
    13
    <pathconvert property="gensrc">
jtulach@1241
    14
        <path><dirset dir="../build"><include name="*/gensrc"/></dirset></path>
jtulach@1241
    15
    </pathconvert>
jtulach@1241
    16
    <pathconvert property="javacompiler">
jtulach@1241
    17
        <path><dirset dir="../build"><include name="*/langtools/build/classes"/></dirset></path>
jtulach@1241
    18
    </pathconvert>
jtulach@1241
    19
    <fail message="You need to provide location of JDK's generated sources via -Dgensrc=...">
jtulach@1241
    20
        <condition><not><available file="${gensrc}"/></not></condition>
jtulach@1241
    21
    </fail>
jtulach@1241
    22
    <fail message="Javacompiler build is missing">
jtulach@1241
    23
        <condition><not><available file="${javacompiler}"/></not></condition>
jtulach@1241
    24
    </fail>
jtulach@1237
    25
    <path id="src.path">
jtulach@1237
    26
        <pathelement location="src/share/classes"/>
jtulach@1241
    27
        <pathelement location="${gensrc}"/>
jtulach@1237
    28
        <pathelement location="src/windows/classes"/>
jtulach@1241
    29
        <!--
jtulach@1237
    30
        <pathelement location="src/solaris/classes"/>
jtulach@1241
    31
        -->
jtulach@1237
    32
    </path>
jtulach@1237
    33
    <property name="build.dir" location="build/modularize"/>
jtulach@1237
    34
jtulach@1237
    35
    <!-- this is the core of the separation - definition
jtulach@1237
    36
      of what classes belong into what compilation group.
jtulach@1237
    37
    -->
jtulach@1237
    38
    <selector id="applet">
jtulach@1237
    39
        <or>
jtulach@1238
    40
            <filename name="java/beans/AppletInitializer*"/>
jtulach@1237
    41
            <filename name="java/applet/**"/>
jtulach@1237
    42
            <filename name="sun/applet/**"/>
jtulach@1238
    43
            <filename name="META-INF/services/sun.beans.AppletProxy"/>
jtulach@1237
    44
        </or>
jtulach@1237
    45
    </selector>
jtulach@1237
    46
    <selector id="beans">
jtulach@1238
    47
        <and>
jtulach@1238
    48
            <or>
jtulach@1238
    49
                <filename name="java/beans/**"/>
jtulach@1238
    50
                <filename name="sun/beans/**"/>
jtulach@1238
    51
                <filename name="com/sun/beans/**"/>
jtulach@1238
    52
            </or>
jtulach@1238
    53
            <none>
jtulach@1238
    54
                <selector refid="applet"/>
jtulach@1240
    55
                <selector refid="deprecated7"/>
jtulach@1238
    56
            </none>
jtulach@1238
    57
        </and>
jtulach@1237
    58
    </selector>
jtulach@1237
    59
jtulach@1240
    60
    <selector id="deprecated7">
jtulach@1240
    61
        <or>
jtulach@1240
    62
            <filename name="java/beans/Beans*"/>
jtulach@1240
    63
        </or>
jtulach@1240
    64
    </selector>
jtulach@1240
    65
jtulach@1237
    66
    <selector id="base">
jtulach@1241
    67
        <!--
jtulach@1237
    68
            <selector refid="applet"/>
jtulach@1237
    69
            <selector refid="beans"/>
jtulach@1241
    70
            <selector refid="client"/>
jtulach@1241
    71
            <selector refid="enterprise"/>
jtulach@1240
    72
            <selector refid="deprecated7"/>
jtulach@1241
    73
            -->
jtulach@1241
    74
            <!-- exclude files that need pre-processing like
jtulach@1241
    75
                java/nio/ByteBufferAs-X-Buffer.java
jtulach@1241
    76
            -->
jtulach@1241
    77
jtulach@1241
    78
        <none>
jtulach@1241
    79
            <filename name="**/*-*"/>
jtulach@1241
    80
            <filename name="java/dyn/**"/>
jtulach@1241
    81
            <filename name="sun/dyn/**"/>
jtulach@1241
    82
            <filename name="javax/management/remote/rmi/RMIConnector*"/>
jtulach@1241
    83
            <filename name="sun/tracing/**"/>
jtulach@1241
    84
            <filename name="com/sun/tracing/**"/>
jtulach@1241
    85
            <filename name="com/sun/java/swing/plaf/gtk/**"/>
jtulach@1241
    86
            
jtulach@1241
    87
<!--            <filename name="javax/management/**"/> -->
jtulach@1241
    88
<!--            <filename name="sun/nio/fs/**"/> -->
jtulach@1241
    89
<!--            <filename name="com/sun/jmx/**"/> -->
jtulach@1241
    90
jtulach@1241
    91
            <!-- exclude corba related stuff -->
jtulach@1241
    92
            <filename name="com/sun/jndi/cosnaming/**"/>
jtulach@1241
    93
            <filename name="com/sun/jndi/toolkit/corba/**"/>
jtulach@1241
    94
jtulach@1241
    95
            <filename name="com/sun/script/javascript/**"/>
jtulach@1237
    96
        </none>
jtulach@1237
    97
    </selector>
jtulach@1237
    98
jtulach@1237
    99
    <!-- individual compilation tasks -->
jtulach@1237
   100
jtulach@1240
   101
    <target name="deprecated7">
jtulach@1240
   102
        <antcall target="-compile-one-module">
jtulach@1240
   103
            <param name="module" value="deprecated7"/>
jtulach@1240
   104
            <param name="depends" value="beans:applet"/>
jtulach@1240
   105
        </antcall>
jtulach@1240
   106
    </target>
jtulach@1237
   107
    <target name="applet">
jtulach@1237
   108
        <antcall target="-compile-one-module">
jtulach@1237
   109
            <param name="module" value="applet"/>
jtulach@1238
   110
            <param name="depends" value="beans"/>
jtulach@1237
   111
        </antcall>
jtulach@1237
   112
    </target>
jtulach@1237
   113
    <target name="beans">
jtulach@1237
   114
        <antcall target="-compile-one-module">
jtulach@1237
   115
            <param name="module" value="beans"/>
jtulach@1237
   116
        </antcall>
jtulach@1237
   117
    </target>
jtulach@1237
   118
jtulach@1241
   119
jtulach@1238
   120
    <target name="base">
jtulach@1241
   121
        <antcall target="-compile-one-module">
jtulach@1241
   122
            <param name="module" value="base"/>
jtulach@1241
   123
        </antcall>
jtulach@1237
   124
    </target>
jtulach@1237
   125
jtulach@1237
   126
    <!-- shared routine to compile one of the modules -->
jtulach@1237
   127
    <target name="-compile-one-module">
jtulach@1237
   128
        <mkdir dir="${build.dir}/classes/${module}"/>
jtulach@1240
   129
        <pathconvert pathsep=":"  property="module.cp">
jtulach@1238
   130
            <path path="${depends}"/>
jtulach@1238
   131
            <mapper type="regexp" from=".*[/\\]([^/\\]*)" to="${build.dir}/\1.jar"/>
jtulach@1238
   132
        </pathconvert>
jtulach@1238
   133
        <javac
jtulach@1238
   134
            bootclasspath="${build.dir}/base.jar"
jtulach@1238
   135
            sourcepath=""
jtulach@1238
   136
            destdir="${build.dir}/classes/${module}"
jtulach@1238
   137
            includejavaruntime="false"
jtulach@1238
   138
            includeantruntime="false"
jtulach@1238
   139
        >
jtulach@1241
   140
            <classpath>
jtulach@1241
   141
                <path path="${module.cp}"/>
jtulach@1241
   142
                <pathelement location="${javacompiler}"/>
jtulach@1241
   143
            </classpath>
jtulach@1237
   144
            <src refid="src.path"/>
jtulach@1237
   145
            <selector refid="${module}"/>
jtulach@1237
   146
        </javac>
jtulach@1238
   147
        <copy todir="${build.dir}/classes/${module}">
jtulach@1238
   148
            <fileset dir="src/share/classes">
jtulach@1238
   149
                <and>
jtulach@1238
   150
                    <selector refid="${module}"/>
jtulach@1238
   151
                    <not>
jtulach@1238
   152
                        <filename name="**/*.java"/>
jtulach@1238
   153
                    </not>
jtulach@1238
   154
                </and>
jtulach@1238
   155
            </fileset>
jtulach@1238
   156
        </copy>
jtulach@1238
   157
jtulach@1238
   158
        <jar 
jtulach@1238
   159
            basedir="${build.dir}/classes/${module}"
jtulach@1238
   160
            destfile="${build.dir}/${module}.jar"
jtulach@1238
   161
            compress="false"
jtulach@1238
   162
        />
jtulach@1237
   163
    </target>
jtulach@1237
   164
jtulach@1237
   165
    <!-- clean everything -->
jtulach@1237
   166
    <target name="clean">
jtulach@1237
   167
        <delete dir="${build.dir}"/>
jtulach@1237
   168
    </target>
jtulach@1237
   169
</project>