blob: dd92c9b1e8df8ae5bb53ff6ead8579e1d7937deb [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Tools Build" default="build" basedir=".">
<description>Build for Tools component</description>
<!-- import common properties -->
<property name="tests.build.output" location="../../build/tests" />
<import file="${basedir}/../../make/properties.xml" />
<property name="tests.output" location="../../build/test_report" />
<!-- set global properties for this build. -->
<xmlproperty file="make/hyproperties.xml" semanticAttributes="true" />
<!-- filename for tests exclude list -->
<property name="tools.exclude.file" location="${hy.hdk}/build/jdktools.tools.exclude" />
<fileset id="classes" dir="${hy.build}">
<or>
<present targetdir="${hy.tools.src.main.java}" />
<present targetdir="${hy.tools.src.main.java}">
<mapper type="regexp"
from="^(.*?)(\$$[^/\\\.]*)?\.class$$"
to="\1.java"/>
</present>
</or>
</fileset>
<target name="check-depends">
<check-one-file src="${jdt.jdi.jar.url}"
dest="${jdt.jdi.jar}" />
<check-one-file src="${jdt.jdimodel.jar.url}"
dest="${jdt.jdimodel.jar}" />
<check-one-file src="${icu.url}" dest="${icu.jar}" />
<check-one-file src="${ecj.jar.url}" dest="${ecj.jar}" />
</target>
<target name="fetch-depends">
<fetch dep="jdt.jdi.jar"/>
<fetch dep="jdt.jdimodel.jar"/>
</target>
<target name="build" depends="check-depends, build-java, copy-resources, build-jar" />
<target name="build-java" depends="compile-java, copy-resources, build-jar" />
<target name="build-native" />
<target name="clean" depends="clean-java" />
<target name="clean-native" />
<target name="test" depends="test-module">
<fail message="Some tests failed">
<condition>
<or>
<isset property="test.failures" />
<isset property="test.errors" />
</or>
</condition>
</fail>
</target>
<!-- internal target for local and global test run sequence -->
<target name="test-module" depends="build-tests, prepare-exclude, run-tests" />
<target name="clean-java">
<echo message="Cleaning TOOLS classes" />
<delete file="${jdktools.deploy.dir}/lib/tools.jar" />
<delete file="${jdktools.deploy.dir}/lib/tools-src.jar" />
<delete includeemptydirs="true" failonerror="false">
<!--fileset refid="classes" /-->
<fileset dir="${hy.build}" />
<fileset dir="${tests.build.output}/classes" />
</delete>
</target>
<target name="compile-java">
<echo message="Compiling TOOLS classes" />
<ensure-javac/>
<mkdir dir="${hy.build}" />
<hy.javac sourcepath=""
srcdir="${hy.tools.src.main.java}"
destdir="${hy.build}">
<bootclasspath>
<fileset dir="${hy.hdk}/jdk/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
<fileset dir="${hy.hdk}/lib">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
<classpath>
<pathelement path="${jdt.jdi.jar}"/>
<pathelement path="${ecj.jar}" />
</classpath>
</hy.javac>
</target>
<target name="copy-resources">
<mkdir dir="${hy.build}" />
<copy todir="${hy.build}" includeemptydirs="false">
<fileset dir="${hy.tools.src.main.java}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build-jar" depends="svn-info">
<mkdir dir="${jdktools.deploy.dir}/lib" />
<jar destfile="${jdktools.deploy.dir}/lib/tools.jar"
manifest="${hy.tools}/META-INF/MANIFEST.MF">
<fileset refid="classes" />
<zipfileset src="${jdt.jdi.jar}">
<exclude name="com/sun/jdi/Bootstrap.class"/>
<exclude name="META-INF/*"/>
</zipfileset>
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
<metainf file="${hy.hdk}/NOTICE"/>
<metainf file="${hy.hdk}/LICENSE"/>
</jar>
<jar destfile="${jdktools.deploy.dir}/lib/tools-src.jar">
<fileset dir="${hy.tools.src.main.java}" />
<manifest>
<attribute name="Implementation-Version" value="${svn.info}"/>
</manifest>
<metainf file="${hy.hdk}/NOTICE"/>
<metainf file="${hy.hdk}/LICENSE"/>
</jar>
</target>
<target name="build-tests">
<echo message="Compiling TOOLS tests" />
<ensure-javac/>
<mkdir dir="${tests.build.output}/classes" />
<hy.javac srcdir="${hy.tools.src.test.java}"
destdir="${tests.build.output}/classes"
sourcepath=""
debug="on">
<bootclasspath>
<fileset dir="${hy.hdk}/jdk/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
<classpath>
<pathelement path="${jdktools.deploy.dir}/lib/tools.jar"/>
<pathelement path="${junit.jar}"/>
</classpath>
<classpath location="${tests.build.output}/classes" />
<!-- temporarely exclude one test that breaks compilation -->
<exclude name="**/javah/Test02.java"/>
</hy.javac>
</target>
<target name="prepare-exclude">
<echo message="TOOLS exclude list: ${tools.exclude.file}" />
<prepare-exclude-list moduleName="tools" dir="./make"
result="${tools.exclude.file}" />
</target>
<target name="run-tests" depends="build-tests, prepare-exclude">
<property name="test.jre.home" value="${jdktools.deploy.dir}/jre" />
<echo message="Running TOOLS tests" />
<echo message="test.jre.home=${test.jre.home}" />
<mkdir dir="${tests.output}" />
<junit fork="yes"
forkmode="${hy.test.forkmode}"
timeout="${hy.test.timeout}"
printsummary="withOutAndErr"
errorproperty="test.errors"
failureproperty="test.failures"
showoutput="on"
dir="${tests.output}"
jvm="${test.jre.home}/bin/java">
<jvmarg line="${hy.test.vmargs}" />
<classpath>
<pathelement path="${tests.build.output}/classes"/>
<pathelement path="${jdktools.deploy.dir}/lib/tools.jar"/>
</classpath>
<formatter type="xml" />
<test name="${test.case}" todir="${tests.output}"
if="test.case" />
<batchtest todir="${tests.output}" haltonfailure="no"
unless="test.case">
<fileset dir="${hy.tools.src.test.java}">
<!-- if ${test.case} -->
<include name="${converted.tc}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.java" unless="test.case" />
<excludesfile name="${tools.exclude.file}" unless="test.case" />
</fileset>
</batchtest>
</junit>
<antcall target="touch-failures-file" />
<antcall target="touch-errors-file" />
</target>
<target name="touch-failures-file" if="test.failures">
<echo file="${tests.output}/test.failures"
append="true">tools${line.separator}</echo>
</target>
<target name="touch-errors-file" if="test.errors">
<echo file="${tests.output}/test.errors"
append="true">tools${line.separator}</echo>
</target>
</project>