1 <!-- importing.xml -->
   2 <project name="jdk" basedir="..">
   3 
   4     <script language="javascript" classpath=".idea/classes">
   5         var JdkLogger = Java.type("idea.JdkIdeaAntLogger");
   6         new JdkLogger(project)
   7     </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     <property name="test.dir" value="${basedir}/jdk/test"/>
  20 
  21     <macrodef name="call-make">
  22             <attribute name="dir"/>
  23             <attribute name="args"/>
  24             <sequential>
  25                 <exec executable="make" dir="@{dir}" failonerror="true">
  26                     <arg line="@{args}"/>
  27                     <env key="CLASSPATH" value = ""/>
  28                 </exec>
  29             </sequential>
  30         </macrodef>
  31 
  32     <macrodef name="exec-target">
  33         <attribute name="antfile" default="${ant.file}" />
  34         <attribute name="target" />
  35         <sequential>
  36             <java classname="org.apache.tools.ant.Main" fork="true" spawn="true">
  37                 <arg value="-f"/>
  38                 <arg value="@{antfile}"/>  
  39                 <arg value="-Dboot.java.home=${boot.java.home}"/>
  40                 <arg value="-Dbuild.target.dir=${build.target.dir}"/>
  41                 <arg value="-Djtreg.home=${jtreg.home}"/>
  42                 <arg value="-Djtreg.tests=${jtreg.tests}"/>
  43                 <arg value="-Djtreg.jpda.jvmargs=${jtreg.jpda.jvmargs}"/>
  44                 <arg value="@{target}"/>
  45                 <classpath>           
  46                     <pathelement path="${java.class.path}"/>
  47                 </classpath>
  48             </java>
  49         </sequential>
  50     </macrodef>
  51 
  52     <target name="post-make" depends="build-module"/>
  53 
  54     <!--
  55         **** Global JDK Build Targets
  56     -->
  57 
  58     <target name="clean" depends="-do-configure">
  59         <echo message="base = ${basedir}"/>
  60         <call-make dir = "${build.target.dir}" args = "clean"/>
  61     </target>
  62     
  63     <target name="-do-configure">
  64         <echo message="base = ${basedir}"/>
  65         <fail message="Not part of a full JDK forest">
  66             <condition>
  67                 <not>
  68                     <available file="${basedir}/configure" />
  69                 </not>
  70             </condition>
  71         </fail>
  72         <exec executable="sh" dir="${basedir}" failonerror="true">
  73             <arg line="configure --with-boot-jdk=${boot.java.home}"/>
  74         </exec>
  75     </target>
  76 
  77     <target name="images">
  78         <call-make dir = "${build.target.dir}" args = "images"/>
  79     </target>
  80 
  81     <target name="jimages">
  82         <call-make dir = "${build.target.dir}" args = "jimages"/>
  83     </target>
  84 
  85     <target name="check-env">
  86         <exec executable="env" dir="${basedir}"/>
  87     </target>
  88 
  89     <target name="build-module">
  90         <call-make dir = "${build.target.dir}" args = "${module.name}"/>
  91     </target>
  92 
  93     <target name="-check-boot.java.home" depends="-def-check">
  94         <check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
  95     </target>
  96 
  97     <target name="-def-check">
  98         <macrodef name="check">
  99             <attribute name="name"/>
 100             <attribute name="property"/>
 101             <attribute name="marker" default=""/>
 102             <sequential>
 103                 <fail message="Cannot locate @{name}: please set @{property} to its location">
 104                     <condition>
 105                         <not>
 106                             <isset property="@{property}"/>
 107                         </not>
 108                     </condition>
 109                 </fail>
 110                 <fail message="@{name} is not installed in ${@{property}}">
 111                     <condition>
 112                         <and>
 113                             <not>
 114                                 <equals arg1="@{marker}" arg2=""/>
 115                             </not>
 116                             <not>
 117                                 <available file="${@{property}}/@{marker}"/>
 118                             </not>
 119                         </and>
 120                     </condition>
 121                 </fail>
 122             </sequential>
 123         </macrodef>
 124     </target>
 125 </project>
 126