Separatelly compiling Beans and Applet modules. Using 'code injection' to allow Beans class to perform its Applet related functionality if Applet module is around.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="modularize" default="all" basedir=".">
3 <description>Scripts to build JDK Java sources in modularized way</description>
6 <antcall target="base"/>
7 <antcall target="beans"/>
8 <antcall target="applet"/>
10 <!-- basic parameters -->
12 <pathelement location="src/share/classes"/>
13 <pathelement location="src/windows/classes"/>
14 <pathelement location="src/solaris/classes"/>
16 <property name="build.dir" location="build/modularize"/>
18 <!-- this is the core of the separation - definition
19 of what classes belong into what compilation group.
21 <selector id="applet">
23 <filename name="java/beans/AppletInitializer*"/>
24 <filename name="java/applet/**"/>
25 <filename name="sun/applet/**"/>
26 <filename name="META-INF/services/sun.beans.AppletProxy"/>
32 <filename name="java/beans/**"/>
33 <filename name="sun/beans/**"/>
34 <filename name="com/sun/beans/**"/>
37 <selector refid="applet"/>
44 <filename name="org/omg/**"/>
45 <filename name="com/sun/corba/**"/>
51 <selector refid="applet"/>
52 <selector refid="beans"/>
53 <selector refid="corba"/>
57 <!-- individual compilation tasks -->
59 <target name="applet">
60 <antcall target="-compile-one-module">
61 <param name="module" value="applet"/>
62 <param name="depends" value="beans"/>
66 <antcall target="-compile-one-module">
67 <param name="module" value="beans"/>
72 <!-- as I am currently unable to build JDK myself, I'll start
73 the modularization by extracting the base module from an existing
77 <property name="rt.jar" location="${java.home}/lib/rt.jar"/>
78 <fail message="Cannot find rt.jar, specify with -Drt.jar=...">
79 <condition><not><available file="${rt.jar}"/></not></condition>
82 <mkdir dir="${build.dir}/rt"/>
83 <unzip src="${rt.jar}" dest="${build.dir}/rt"/>
84 <jar file="${build.dir}/base.jar" compress="false">
85 <fileset dir="${build.dir}/rt">
86 <selector refid="base"/>
91 <!-- shared routine to compile one of the modules -->
92 <target name="-compile-one-module">
93 <mkdir dir="${build.dir}/classes/${module}"/>
94 <pathconvert pathsep="," property="module.cp">
95 <path path="${depends}"/>
96 <mapper type="regexp" from=".*[/\\]([^/\\]*)" to="${build.dir}/\1.jar"/>
99 bootclasspath="${build.dir}/base.jar"
101 destdir="${build.dir}/classes/${module}"
102 classpath="${module.cp}"
103 includejavaruntime="false"
104 includeantruntime="false"
106 <src refid="src.path"/>
107 <selector refid="${module}"/>
109 <copy todir="${build.dir}/classes/${module}">
110 <fileset dir="src/share/classes">
112 <selector refid="${module}"/>
114 <filename name="**/*.java"/>
121 basedir="${build.dir}/classes/${module}"
122 destfile="${build.dir}/${module}.jar"
127 <!-- clean everything -->
128 <target name="clean">
129 <delete dir="${build.dir}"/>