build.xml revision 2088:1817ea79cbbf
1215207Sgnn<!-- importing.xml -->
2215207Sgnn<project name="jdk" basedir="..">
3215207Sgnn
4215207Sgnn    <script language="javascript" classpath=".idea/classes">
5215207Sgnn        var JdkLogger = Java.type("idea.JdkIdeaAntLogger");
6215207Sgnn        new JdkLogger(project)
7215207Sgnn    </script>
8
9     <!-- java.marker is set to a marker file to check for within a Java install dir.
10         The best file to check for across Solaris/Linux/Windows/MacOS is one of the
11         executables; regrettably, that is OS-specific. -->
12    <condition property="java.marker" value="bin/java">
13        <os family="unix"/>
14    </condition>
15    <condition property="java.marker" value="bin/java.exe">
16        <os family="windows"/>
17    </condition>
18
19    <target name="-check-jtreg.home" depends="-def-check">
20        <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
21    </target>
22
23    <property name="test.dir" value="${basedir}/jdk/test"/>
24
25    <macrodef name="call-make">
26            <attribute name="dir"/>
27            <attribute name="args"/>
28            <sequential>
29                <exec executable="make" dir="@{dir}" failonerror="true">
30                    <arg line="@{args}"/>
31                    <env key="CLASSPATH" value = ""/>
32                </exec>
33            </sequential>
34        </macrodef>
35
36    <target name="post-make" depends="build-module"/>
37
38    <!--
39        **** Global JDK Build Targets
40    -->
41
42    <target name="clean" depends="-do-configure">
43        <echo message="base = ${basedir}"/>
44        <call-make dir = "${build.target.dir}" args = "clean"/>
45    </target>
46
47    <target name="-do-configure">
48        <echo message="base = ${basedir}"/>
49        <fail message="Not part of a full JDK forest">
50            <condition>
51                <not>
52                    <available file="${basedir}/configure" />
53                </not>
54            </condition>
55        </fail>
56        <exec executable="sh" dir="${basedir}" failonerror="true">
57            <arg line="configure --with-boot-jdk=${boot.java.home}"/>
58        </exec>
59    </target>
60
61    <target name="images">
62        <call-make dir = "${build.target.dir}" args = "images"/>
63    </target>
64
65    <target name="jimages">
66        <call-make dir = "${build.target.dir}" args = "jimages"/>
67    </target>
68
69    <target name="check-env">
70        <exec executable="env" dir="${basedir}"/>
71    </target>
72
73    <target name="build-module">
74        <call-make dir = "${build.target.dir}" args = "${module.name}"/>
75    </target>
76
77    <target name="-check-boot.java.home" depends="-def-check">
78        <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
79    </target>
80
81    <target name="-def-check">
82        <macrodef name="check">
83            <attribute name="name"/>
84            <attribute name="property"/>
85            <attribute name="marker" default=""/>
86            <sequential>
87                <fail message="Cannot locate @{name}: please set @{property} to its location">
88                    <condition>
89                        <not>
90                            <isset property="@{property}"/>
91                        </not>
92                    </condition>
93                </fail>
94                <fail message="@{name} is not installed in ${@{property}}">
95                    <condition>
96                        <and>
97                            <not>
98                                <equals arg1="@{marker}" arg2=""/>
99                            </not>
100                            <not>
101                                <available file="${@{property}}/@{marker}"/>
102                            </not>
103                        </and>
104                    </condition>
105                </fail>
106            </sequential>
107        </macrodef>
108    </target>
109
110    <macrodef name="exec-target">
111        <attribute name="antfile" default="${ant.file}" />
112        <attribute name="target" />
113        <sequential>
114            <java classname="org.apache.tools.ant.Main" fork="true" spawn="true">
115                <arg value="-f"/>
116                <arg value="@{antfile}"/>
117                <arg value="-Dbuild.target.dir=${build.target.dir}"/>
118                <arg value="-Djtreg.home=${jtreg.home}"/>
119                <arg value="-Djtreg.tests=${jtreg.tests}"/>
120                <arg value="-Djtreg.jpda.jvmargs=${jtreg.jpda.jvmargs}"/>
121                <arg value="@{target}"/>
122                <classpath>
123                    <pathelement path="${java.class.path}"/>
124                </classpath>
125            </java>
126        </sequential>
127    </macrodef>
128
129    <target name="jtreg" depends="images,-def-jtreg">
130        <jtreg-tool name="all" tests="${jtreg.tests}"/>
131    </target>
132
133    <target name="-def-jtreg" unless="jtreg.defined" depends="-check-jtreg.home">
134        <taskdef name="jtreg" classname="com.sun.javatest.regtest.Main$$Ant">
135            <classpath>
136                <pathelement location="${jtreg.home}/lib/jtreg.jar"/>
137                <pathelement location="${jtreg.home}/lib/javatest.jar"/>
138            </classpath>
139        </taskdef>
140        <macrodef name="jtreg-tool">
141            <attribute name="name"/>
142            <attribute name="tests"/>
143            <attribute name="jdk" default="${build.target.dir}/images/jdk"/>
144            <attribute name="agentvm" default="true"/>
145            <attribute name="verbose" default="${default.jtreg.verbose}"/>
146            <attribute name="options" default="${other.jtreg.options}"/>
147            <attribute name="keywords" default="-keywords:!ignore"/>
148            <attribute name="jpda.jvmargs" default=""/>
149            <attribute name="extra.jvmargs" default=""/>
150            <attribute name="build.modules" default="${build.modules}"/>
151            <sequential>
152                <property name="coverage.options" value=""/>              <!-- default -->
153                <property name="coverage.classpath" value=""/>            <!-- default -->
154                <property name="default.jtreg.verbose" value="summary"/>  <!-- default -->
155                <property name="other.jtreg.options" value=""/>           <!-- default -->
156                <property name="jtreg.classfiles.to.modules" value="@{agentvm}"/>
157                <jtreg
158                    dir="${test.dir}"
159                    workDir="${build.target.dir}/idea/@{name}/work"
160                    reportDir="${build.target.dir}/idea/@{name}/report"
161                    jdk="@{jdk}"
162                    agentvm="@{agentvm}" verbose="@{verbose}"
163                    failonerror="false" resultproperty="jtreg.@{name}.result">
164                    <arg value="-debug:@{jpda.jvmargs}"/>
165                    <arg line="@{keywords}"/>
166                    <arg line="@{options}"/>
167                    <arg line="@{tests}"/>
168                </jtreg>
169            </sequential>
170        </macrodef>
171        <property name="jtreg.defined" value="true"/>
172    </target>
173</project>
174