build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Wed, 17 Jun 2009 15:11:07 +0200
changeset 1240 4b353465cd30
parent 1238 57914fd9382f
child 1241 e38683764572
permissions -rw-r--r--
In order to make javabeans module independent on applet and yet allow Beans class to have a method which references AppletInitializer, I am creating new module: deprecated7. This one shall consist of all the garbage identified in JDK7 development which has so many dependencies that it does not fit anywhere else. Beans class is moved there and instead of it, there is new BeanFactory class with the same methods (expect the one with AppletInitializer parameter).
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@1237
    11
    <!-- basic parameters -->
jtulach@1237
    12
    <path id="src.path">
jtulach@1237
    13
        <pathelement location="src/share/classes"/>
jtulach@1237
    14
        <pathelement location="src/windows/classes"/>
jtulach@1237
    15
        <pathelement location="src/solaris/classes"/>
jtulach@1237
    16
    </path>
jtulach@1237
    17
    <property name="build.dir" location="build/modularize"/>
jtulach@1237
    18
jtulach@1237
    19
    <!-- this is the core of the separation - definition
jtulach@1237
    20
      of what classes belong into what compilation group.
jtulach@1237
    21
    -->
jtulach@1237
    22
    <selector id="applet">
jtulach@1237
    23
        <or>
jtulach@1238
    24
            <filename name="java/beans/AppletInitializer*"/>
jtulach@1237
    25
            <filename name="java/applet/**"/>
jtulach@1237
    26
            <filename name="sun/applet/**"/>
jtulach@1238
    27
            <filename name="META-INF/services/sun.beans.AppletProxy"/>
jtulach@1237
    28
        </or>
jtulach@1237
    29
    </selector>
jtulach@1237
    30
    <selector id="beans">
jtulach@1238
    31
        <and>
jtulach@1238
    32
            <or>
jtulach@1238
    33
                <filename name="java/beans/**"/>
jtulach@1238
    34
                <filename name="sun/beans/**"/>
jtulach@1238
    35
                <filename name="com/sun/beans/**"/>
jtulach@1238
    36
            </or>
jtulach@1238
    37
            <none>
jtulach@1238
    38
                <selector refid="applet"/>
jtulach@1240
    39
                <selector refid="deprecated7"/>
jtulach@1238
    40
            </none>
jtulach@1238
    41
        </and>
jtulach@1237
    42
    </selector>
jtulach@1237
    43
jtulach@1240
    44
    <selector id="deprecated7">
jtulach@1240
    45
        <or>
jtulach@1240
    46
            <filename name="java/beans/Beans*"/>
jtulach@1240
    47
        </or>
jtulach@1240
    48
    </selector>
jtulach@1240
    49
jtulach@1237
    50
    <selector id="corba">
jtulach@1237
    51
        <or>
jtulach@1237
    52
            <filename name="org/omg/**"/>
jtulach@1237
    53
            <filename name="com/sun/corba/**"/>
jtulach@1237
    54
        </or>
jtulach@1237
    55
    </selector>
jtulach@1237
    56
    
jtulach@1237
    57
    <selector id="base">
jtulach@1237
    58
        <none>
jtulach@1237
    59
            <selector refid="applet"/>
jtulach@1237
    60
            <selector refid="beans"/>
jtulach@1237
    61
            <selector refid="corba"/>
jtulach@1240
    62
            <selector refid="deprecated7"/>
jtulach@1237
    63
        </none>
jtulach@1237
    64
    </selector>
jtulach@1237
    65
jtulach@1237
    66
    <!-- individual compilation tasks -->
jtulach@1237
    67
jtulach@1240
    68
    <target name="deprecated7">
jtulach@1240
    69
        <antcall target="-compile-one-module">
jtulach@1240
    70
            <param name="module" value="deprecated7"/>
jtulach@1240
    71
            <param name="depends" value="beans:applet"/>
jtulach@1240
    72
        </antcall>
jtulach@1240
    73
    </target>
jtulach@1237
    74
    <target name="applet">
jtulach@1237
    75
        <antcall target="-compile-one-module">
jtulach@1237
    76
            <param name="module" value="applet"/>
jtulach@1238
    77
            <param name="depends" value="beans"/>
jtulach@1237
    78
        </antcall>
jtulach@1237
    79
    </target>
jtulach@1237
    80
    <target name="beans">
jtulach@1237
    81
        <antcall target="-compile-one-module">
jtulach@1237
    82
            <param name="module" value="beans"/>
jtulach@1237
    83
        </antcall>
jtulach@1237
    84
    </target>
jtulach@1237
    85
    
jtulach@1237
    86
jtulach@1237
    87
    <!-- as I am currently unable to build JDK myself, I'll start
jtulach@1237
    88
      the modularization by extracting the base module from an existing
jtulach@1237
    89
      classes
jtulach@1237
    90
    -->
jtulach@1238
    91
    <target name="base">
jtulach@1237
    92
        <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
jtulach@1237
    93
        <fail message="Cannot find rt.jar, specify with -Drt.jar=...">
jtulach@1237
    94
            <condition><not><available file="${rt.jar}"/></not></condition>
jtulach@1237
    95
        </fail>
jtulach@1237
    96
jtulach@1237
    97
        <mkdir dir="${build.dir}/rt"/>
jtulach@1237
    98
        <unzip src="${rt.jar}" dest="${build.dir}/rt"/>
jtulach@1238
    99
        <jar file="${build.dir}/base.jar" compress="false">
jtulach@1237
   100
            <fileset dir="${build.dir}/rt">
jtulach@1237
   101
                <selector refid="base"/>
jtulach@1237
   102
            </fileset>
jtulach@1237
   103
        </jar>
jtulach@1237
   104
    </target>
jtulach@1237
   105
jtulach@1237
   106
    <!-- shared routine to compile one of the modules -->
jtulach@1237
   107
    <target name="-compile-one-module">
jtulach@1237
   108
        <mkdir dir="${build.dir}/classes/${module}"/>
jtulach@1240
   109
        <pathconvert pathsep=":"  property="module.cp">
jtulach@1238
   110
            <path path="${depends}"/>
jtulach@1238
   111
            <mapper type="regexp" from=".*[/\\]([^/\\]*)" to="${build.dir}/\1.jar"/>
jtulach@1238
   112
        </pathconvert>
jtulach@1238
   113
        <javac
jtulach@1238
   114
            bootclasspath="${build.dir}/base.jar"
jtulach@1238
   115
            sourcepath=""
jtulach@1238
   116
            destdir="${build.dir}/classes/${module}"
jtulach@1238
   117
            classpath="${module.cp}"
jtulach@1238
   118
            includejavaruntime="false"
jtulach@1238
   119
            includeantruntime="false"
jtulach@1238
   120
        >
jtulach@1237
   121
            <src refid="src.path"/>
jtulach@1237
   122
            <selector refid="${module}"/>
jtulach@1237
   123
        </javac>
jtulach@1238
   124
        <copy todir="${build.dir}/classes/${module}">
jtulach@1238
   125
            <fileset dir="src/share/classes">
jtulach@1238
   126
                <and>
jtulach@1238
   127
                    <selector refid="${module}"/>
jtulach@1238
   128
                    <not>
jtulach@1238
   129
                        <filename name="**/*.java"/>
jtulach@1238
   130
                    </not>
jtulach@1238
   131
                </and>
jtulach@1238
   132
            </fileset>
jtulach@1238
   133
        </copy>
jtulach@1238
   134
jtulach@1238
   135
        <jar 
jtulach@1238
   136
            basedir="${build.dir}/classes/${module}"
jtulach@1238
   137
            destfile="${build.dir}/${module}.jar"
jtulach@1238
   138
            compress="false"
jtulach@1238
   139
        />
jtulach@1237
   140
    </target>
jtulach@1237
   141
jtulach@1237
   142
    <!-- clean everything -->
jtulach@1237
   143
    <target name="clean">
jtulach@1237
   144
        <delete dir="${build.dir}"/>
jtulach@1237
   145
    </target>
jtulach@1237
   146
</project>