blob: c29f64b94a63efbf55dd025245318bb7a8f25469 [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="Common property definitions" default="echo">
<description>
Ant file of common properties to be imported by other ant files
</description>
<property file="${user.home}/.harmony.properties" />
<dirname property="common.basedir"
file="${ant.file.Common property definitions}"/>
<import file="${common.basedir}/platform.xml"/>
<import file="${common.basedir}/svn.xml"/>
<fail message="Property 'hy.target' is not defined">
<condition>
<not><isset property="hy.target" /></not>
</condition>
</fail>
<fail message="Property 'hy.component' is not defined">
<condition>
<not><isset property="hy.component" /></not>
</condition>
</fail>
<fail message="Property 'hy.module' is not defined">
<condition>
<not><isset property="hy.module" /></not>
</condition>
</fail>
<property name="hy.hdk" location="${hy.target}/hdk" />
<property name="hy.jdk" location="${hy.hdk}/jdk" />
<property name="hy.jre" location="${hy.jdk}/jre" />
<property name="hy.build.root" location="${hy.target}/build" />
<property name="hy.build" location="${hy.build.root}/${hy.component}" />
<property name="hy.build.top" location="${hy.build}/toplevel" />
<property name="hy.build.mod" location="${hy.build}/${hy.module}" />
<!-- Root directory of the common dependency pool -->
<property name="hy.depends" location="${hy.target}/depends" />
<!-- Debug or release version -->
<property name="hy.cfg" value="debug" />
<property name="hy.specification.version" value="1.5" />
<!-- Javac properties -->
<!-- Explicitly set to ECJ as the default compiler. -->
<property name="hy.javac.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter" />
<property name="hy.javac.source" value="1.5" />
<property name="hy.javac.target" value="1.5" />
<property name="hy.javac.maxmem" value="384M" />
<property name="build.compilerarg" value="-nowarn" />
<!-- Temporarily always include class file debug info -->
<condition property="hy.javac.debug" value="on" else="on">
<equals arg1="${hy.cfg}" arg2="debug" />
</condition>
<!-- Include only stack trace information into release build -->
<condition property="hy.javac.debuglevel" value="lines,vars,source"
else="lines,source">
<equals arg1="${hy.cfg}" arg2="debug" />
</condition>
<property name="hy.jar.compress" value="true" />
<!-- During packaging, these files must be copied into the meta-inf dir -->
<fileset id="hy.required.metainf-files" dir="${hy.hdk}">
<include name="NOTICE" />
<include name="LICENSE" />
</fileset>
<!-- Test run property -->
<property name="hy.test.forkmode" value="once" />
<property name="hy.test.timeout" value="900000" />
<property name="hy.test.vmargs" value="" />
<condition property="hy.run.impl.tests" value="true">
<istrue value="${hy.test.impl}" />
</condition>
<condition property="png.home" value="/usr/local">
<isset property="is.freebsd"/>
</condition>
<condition property="png.home" value="/opt/local">
<isset property="is.macosx"/>
</condition>
<property name="png.home" value="/usr" />
<condition property="lcms.home" value="/usr/local">
<isset property="is.freebsd"/>
</condition>
<condition property="lcms.home" value="/opt/local">
<isset property="is.macosx"/>
</condition>
<property name="lcms.home" value="/usr" />
<condition property="jpeg.home" value="/usr/local">
<isset property="is.freebsd"/>
</condition>
<condition property="jpeg.home" value="/opt/local">
<isset property="is.macosx"/>
</condition>
<property name="jpeg.home" value="/usr" />
<condition property="is.select" value="true">
<istrue value="${hy.select}" />
</condition>
<condition property="is.not.select" value="true">
<not><istrue value="${hy.select}" /></not>
</condition>
<!-- default property for poll-modules macro - i.e. all modules -->
<property name="build.module" value="*" />
<condition property="exclude.module"
value="accessibility,applet,awt,imageio,orb,print,rmi,sound,swing">
<istrue value="${hy.select}" />
</condition>
<property name="exclude.module" value="nothing" />
<property name="build.java" value="true" />
<property name="build.native" value="true" />
<property name="build.test" value="true" />
<condition property="skip.java.build" value="true">
<equals arg1="${build.java}" arg2="false" />
</condition>
<condition property="skip.native.build" value="true">
<equals arg1="${build.native}" arg2="false" />
</condition>
<condition property="skip.test.build" value="true">
<equals arg1="${build.test}" arg2="false" />
</condition>
<!-- flags -->
<property name="hy.no.thr" value="false" />
<condition property="hy.skip.thr" value="true">
<istrue value="${hy.no.thr}" />
</condition>
<property name="hy.thr.no.deploy" value="false" />
<condition property="hy.thr.deploy" value="true">
<equals arg1="${hy.thr.no.deploy}" arg2="false" />
</condition>
<property name="hy.local.zlib" value="false" />
<condition property="hy.skip.zlib" value="true">
<istrue value="${hy.local.zlib}" />
</condition>
<property name="hy.zip.api" value="false" />
<condition property="hy.skip.zip.api" value="true">
<isfalse value="${hy.zip.api}" />
</condition>
<condition property="hy.portlib.stubs" value="true">
<or>
<equals arg1="${hy.os}" arg2="aix" />
<equals arg1="${hy.os}" arg2="zos" />
</or>
</condition>
<property name="hy.portlib.stubs" value="false" />
<condition property="hy.platform.suffix" value=".libstdc++5">
<isset property="use.libstdc++5"/>
</condition>
<condition property="hy.platform.suffix" value=".8x">
<!-- matches would be better but debian stable has ant 1.6.5
and matches was only added to 1.7.0 and above -->
<and>
<equals arg1="FreeBSD" arg2="${os.name}" casesensitive="false" />
<contains substring="8." string="${os.version}"/>
</and>
</condition>
<condition property="hy.platform.suffix" value=".7x">
<!-- matches would be better but debian stable has ant 1.6.5
and matches was only added to 1.7.0 and above -->
<and>
<equals arg1="FreeBSD" arg2="${os.name}" casesensitive="false" />
<contains substring="7." string="${os.version}"/>
</and>
</condition>
<property name="hy.platform.suffix" value="" />
<property name="hy.platform.variant"
value="${hy.platform}${hy.platform.suffix}" />
<!-- fileset to represent classes built by a module. -->
<fileset id="classes" dir="${hy.build.top}/java">
<includesfile name="${hy.hdk}/build/ant/patternsets/${hy.module}.txt" />
</fileset>
<!-- fileset for resources of a module. -->
<fileset id="resources" dir="src/main/java">
<exclude name="**/*.java" />
</fileset>
<!-- fileset for resources of a module with platform-dependent code. -->
<fileset id="common.resources" dir="src/main/java/common">
<exclude name="**/*.java" />
</fileset>
<!-- test properties -->
<property name="tests.output" location="../../build/test_report" />
<property name="tests.hdk.dir" value="${hy.hdk}/build/test/${hy.module}" />
<property name="tests.excludes.hdk.dir" value="${tests.hdk.dir}/excludes" />
<property name="tests.resources.hdk.dir"
value="${tests.hdk.dir}/resources" />
<property name="findBugs.report" location="../../build/findbugs_report" />
<propertyset id="module.props">
<propertyref name="hy.component" />
<propertyref name="hy.cfg" />
<propertyref name="hy.test.vm.name" />
<propertyref name="svn.revision" />
<propertyref name="svn.info" />
<propertyref name="hy.no.thr" />
<propertyref name="hy.zip.api" />
<propertyref name="hy.select" />
</propertyset>
<target name="echo" depends="-svn-info, test-jre-vm-info"
description="Display the properties defined by this ant file" >
<echo>
Harmony release configuration property:
hy.cfg = ${hy.cfg}
Harmony javac properties:
hy.javac.compiler = ${hy.javac.compiler}
hy.javac.target = ${hy.javac.target}
hy.javac.source = ${hy.javac.source}
hy.javac.debug = ${hy.javac.debug}
hy.javac.maxmem = ${hy.javac.maxmem}
build.compilerarg = ${build.compilerarg}
Harmony test properties:
hy.test.forkmode = ${hy.test.forkmode}
hy.test.timeout = ${hy.test.timeout}
hy.test.vm.name = ${hy.test.vm.name}
hy.test.vmargs = ${hy.test.vmargs}
findbugs.available = ${findbugs.available}
Harmony platform properties:
hy.os = ${hy.os}
hy.os.family = ${hy.os.family}
hy.arch = ${hy.arch}
hy.bits = ${hy.bits}
hy.platform = ${hy.platform}
hy.platform.path = ${hy.platform.path}
is.windows = ${is.windows}
is.unix = ${is.unix}
is.linux = ${is.linux}
is.freebsd = ${is.freebsd}
is.macosx = ${is.macosx}
is.aix = ${is.aix}
is.zos = ${is.zos}
is.32bit = ${is.32bit}
is.64bit = ${is.64bit}
is.x86 = ${is.x86}
is.x86_64 = ${is.x86_64}
is.ia64 = ${is.ia64}
is.ppc32 = ${is.ppc32}
is.ppc64 = ${is.ppc64}
is.s390 = ${is.s390}
is.s390x = ${is.s390x}
exe.suffix = ${exe.suffix}
shlib.prefix = ${shlib.prefix}
shlib.suffix = ${shlib.suffix}
make.command = ${make.command}
hy.hdk = ${hy.hdk}
hy.jdk = ${hy.jdk}
hy.jre = ${hy.jre}
The following properties are only set if the "-svn-info" target has been
called:
svn.revision = ${svn.revision}
svn.info = ${svn.info}
Ant native properties, for information, but please use Harmony
properties in preference to these:
os.name = ${os.name}
os.arch = ${os.arch}
</echo>
</target>
<target name="test-jre-vm-info" depends="-get-test-vm-output">
<!-- Add other runtime names here -->
<condition property="hy.test.vm.name" value="ri" >
<contains string="${test.vm.info.tmp}" substring="HotSpot"/>
</condition>
<condition property="hy.test.vm.name" value="jr" >
<contains string="${test.vm.info.tmp}" substring="JRockit"/>
</condition>
<!-- FIXME current behavior relies on the fact that J9 VM doesn't
support -version parameter -->
<condition property="hy.test.vm.name" value="ibm" else="drl" >
<contains string="${test.vm.info.tmp}" substring="IBM" casesensitive="false" />
</condition>
<echo level="info" message="hy.test.vm.name = ${hy.test.vm.name}" />
</target>
<target name="-get-test-vm-output">
<condition property="test.jre.home" value="${hy.jre}">
<not><isset property="test.jre.home" /></not>
</condition>
<exec executable="${test.jre.home}/bin/java" failifexecutionfails="false">
<arg value="-version" />
<redirector outputproperty="test.vm.info.tmp"/>
</exec>
</target>
<macrodef name="poll-modules"
description="directory-based macros for polling sub-builds">
<attribute name="target" />
<attribute name="dir" default="modules" />
<attribute name="includes" default="${build.module}"/>
<attribute name="excludes" default="${exclude.module}"/>
<attribute name="antfile" default="*.xml"/>
<sequential>
<!-- convert dirset pattern to fileset pattern-->
<property name="@{dir}.loc" location="@{dir}"/>
<pathconvert property="list.@{dir}.@{target}"
pathsep="${file.separator}@{antfile}," setonempty="no">
<path>
<dirset dir="@{dir}"
includes="@{includes}"
excludes="@{excludes}">
<exclude name=".*" />
</dirset>
</path>
<map from="${@{dir}.loc}${file.separator}" to=""/>
</pathconvert>
<!-- append antfile suffix to last item in the list, if any -->
<condition property="poll.@{dir}.@{target}"
value="${list.@{dir}.@{target}}${file.separator}@{antfile}"
else="">
<isset property="list.@{dir}.@{target}"/>
</condition>
<poll-build target="@{target}" dir="@{dir}"
includes="${poll.@{dir}.@{target}}"/>
</sequential>
</macrodef>
<macrodef name="poll-build"
description="plain-filter macros for polling sub-builds">
<attribute name="target" />
<attribute name="dir" />
<attribute name="includes" default="**/*.xml"/>
<attribute name="excludes" default=""/>
<sequential>
<echo message="polling @{includes}"/>
<subant target="@{target}">
<!-- TODO: modules probably need to work these properties
out for themselves in order to reduce coupling -->
<property name="hy.target" location="${hy.target}"/>
<propertyset refid="module.props" />
<fileset dir="@{dir}" includes="@{includes}" excludes="@{excludes}">
<containsregexp expression="&lt;target[^&gt;]*name=&quot;@{target}&quot;"/>
</fileset>
</subant>
</sequential>
</macrodef>
<macrodef name="make">
<attribute name="dir" />
<attribute name="target" default="" />
<element name="make-elements" optional="true" />
<sequential>
<echo>Making "@{target}" in @{dir}</echo>
<echo file="${hy.hdk}/build/make/properties.${make.suffix}">
HY_ZIP_API=${hy.zip.api}
HY_PORTLIB_STUBS=${hy.portlib.stubs}
HY_CFG=${hy.cfg}
HY_ARCH=${hy.arch}
HY_ARCH_FAMILY=${hy.arch.family}
HY_OS=${hy.os}
HY_PLATFORM=${hy.platform}
HY_NO_THR=${hy.no.thr}
HY_THR_NO_DEPLOY=${hy.thr.no.deploy}
HY_LOCAL_ZLIB=${hy.local.zlib}
HY_SHLIB_SUFFIX=${shlib.suffix}
HY_LINKLIB_SUFFIX=${linklib.suffix}
</echo>
<exec failonerror="true"
executable="${make.command}"
dir="@{dir}">
<env key="HY_HDK" value="${hy.hdk}" />
<env key="HY_TARGET" value="${hy.target}" />
<arg line="${make.arg}" />
<arg line="@{target}" />
<make-elements />
</exec>
</sequential>
</macrodef>
<!-- To use with -Dtest.case=... option -->
<!-- if ${test.case} is provided in package+class form -->
<!-- it is converted to dir+filename form -->
<macrodef name="convert-test">
<attribute name="from"/>
<attribute name="to"/>
<sequential>
<pathconvert property="@{to}" setonempty="no">
<path path="${@{from}}"/>
<chainedmapper>
<filtermapper>
<replaceregex pattern="\.java$$"/>
</filtermapper>
<unpackagemapper from="${basedir}${file.separator}*" to="*.java"/>
</chainedmapper>
</pathconvert>
</sequential>
</macrodef>
<convert-test from="test.case" to="converted.tc" />
<!-- names of exclude lists, used by prepare-exclude-list macro -->
<property name="common.exclude.file" value="exclude.common" />
<property name="common.exclude.interm" value="exclude.interm" />
<property name="platform.exclude.file"
value="exclude.${hy.platform}.${hy.test.vm.name}" />
<property name="platform.exclude.interm"
value="exclude.${hy.platform}.${hy.test.vm.name}.interm" />
<!-- Concatenate several exclude lists into single list -->
<macrodef name="prepare-exclude-list">
<attribute name="moduleName"/>
<!-- directory with exclude lists for the module -->
<attribute name="dir"/>
<!-- name of concatenated list, should be an absolute pathname -->
<attribute name="result"/>
<sequential>
<dirname file="@{result}" property="@{result}.dir" />
<mkdir dir="${@{result}.dir}" />
<echo message="" file="@{result}"/>
<concat destfile="@{result}" force="yes" fixlastline="yes" append="true">
<fileset dir="@{dir}">
<include name="${common.exclude.file}"/>
<include name="${platform.exclude.file}"/>
<include name="${common.exclude.interm}" if="exclude.interm" />
<include name="${platform.exclude.interm}" if="exclude.interm" />
<size value="0" when="more"/>
</fileset>
</concat>
</sequential>
</macrodef>
<macrodef name="ensure-javac">
<sequential>
<fail>
<condition>
<and>
<equals arg1="${hy.javac.compiler}" arg2="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<not>
<available classname="${hy.javac.compiler}"/>
</not>
</and>
</condition>
The Eclipse compiler class for Ant could not be found. Please place the ECJ JAR in ANT_HOME/lib.
The JAR can be downloaded directly from eclipse.org or copied from target/depends/jars/ecj_3.x folder after the fetch-depends target for jdktools has been run.
Alternatively, you can switch to another compiler, e.g. specify '-Dhy.javac.compiler=modern' for classic javac.
</fail>
</sequential>
</macrodef>
<presetdef name="hy.javac">
<javac compiler="${hy.javac.compiler}"
memoryMaximumSize="${hy.javac.maxmem}"
source="${hy.javac.source}"
target="${hy.javac.target}"
debug="${hy.javac.debug}"
debuglevel="${hy.javac.debuglevel}"
includeantruntime="false">
<compilerarg line="${build.compilerarg}" />
</javac>
</presetdef>
<presetdef name="hy.jar.bin">
<jar compress="${hy.jar.compress}">
<manifest>
<attribute name="Implementation-Title" value="Apache Harmony"/>
<attribute name="Implementation-Vendor"
value="The Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id"
value="org.apache.harmony"/>
<attribute name="Implementation-URL"
value="http://harmony.apache.org"/>
<attribute name="Implementation-Version" value="${svn.info}"/>
<attribute name="Specification-Vendor"
value="Sun Microsystems, Inc." />
<attribute name="Specification-Title"
value="Java Platform API Specification" />
<attribute name="Specification-Version"
value="${hy.specification.version}" />
<attribute name="X-Compile-Source-JDK"
value="${hy.javac.source}"/>
<attribute name="X-Compile-Target-JDK"
value="${hy.javac.target}"/>
</manifest>
<metainf refid="hy.required.metainf-files"/>
</jar>
</presetdef>
<presetdef name="hy.jar.src">
<jar compress="${hy.jar.compress}">
<manifest>
<attribute name="Implementation-Title" value="Apache Harmony"/>
<attribute name="Implementation-Vendor"
value="The Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id"
value="org.apache.harmony"/>
<attribute name="Implementation-URL"
value="http://harmony.apache.org"/>
<attribute name="Implementation-Version" value="${svn.info}"/>
<attribute name="Specification-Vendor"
value="Sun Microsystems, Inc." />
<attribute name="Specification-Title"
value="Java Platform API Specification" />
<attribute name="Specification-Version"
value="${hy.specification.version}" />
</manifest>
<metainf refid="hy.required.metainf-files"/>
</jar>
</presetdef>
<macrodef name="compile-classes">
<attribute name="description" default="" />
<attribute name="destdir" default="${hy.build.top}/java" />
<element name="javac-elements" />
<sequential>
<echo message="Compiling @{description}" />
<mkdir dir="@{destdir}" />
<hy.javac sourcepath="" destdir="@{destdir}">
<javac-elements />
<compilerarg line="${build.compilerarg}" />
<bootclasspath>
<fileset dir="${hy.jre}/lib/boot">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
</hy.javac>
</sequential>
</macrodef>
<macrodef name="compile-tests">
<attribute name="description" default="" />
<attribute name="destdir" default="${hy.build.mod}/test/api" />
<element name="javac-elements" />
<sequential>
<echo message="Compiling @{description}" />
<mkdir dir="@{destdir}" />
<mkdir dir="${hy.hdk}/build/test" />
<copy file="${junit.jar}"
tofile="${hy.hdk}/build/test/junit.jar" />
<copy file="${hamcrest-library.jar}"
tofile="${hy.hdk}/build/test/hamcrest-library.jar" />
<hy.javac destdir="@{destdir}">
<javac-elements />
<compilerarg line="${build.compilerarg}" />
<bootclasspath>
<fileset dir="${hy.jre}/lib/boot">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
<classpath location="${hy.build.top}/java" />
<classpath location="${hy.hdk}/build/test/junit.jar" />
<classpath
location="${hy.hdk}/build/test/hamcrest-library.jar" />
<classpath location="${hy.hdk}/build/test/support.jar" />
</hy.javac>
</sequential>
</macrodef>
<macrodef name="run-hdk-tests">
<attribute name="module" />
<attribute name="jar" />
<element name="junit-elements" optional="true"/>
<element name="excludeorinclude" optional="true"/>
<sequential>
<echo message="Running @{module} Unit Test from @{jar}" />
<echo message="Tested jre: ${test.jre.home}/bin/java" />
<property name="test.module.dir" value="${hy.test.root}/@{module}" />
<property name="test.excludes.dir" value="${test.module.dir}/excludes" />
<property name="test.resources.dir" value="${test.module.dir}/resources" />
<property name="module.work.dir" location="${work.dir}/@{module}" />
<property name="test.exclude.file" value="${module.work.dir}/test.exclude" />
<property name="module.temp.dir"
location="${work.dir}/@{module}/temp" />
<property name="junit.tempdir"
location="${module.temp.dir}/ant" />
<property name="junit.java.io.tmpdir"
location="${module.temp.dir}/tmpdir" />
<property name="junit.user.home"
location="${module.temp.dir}/user" />
<mkdir dir="${tests.output}" />
<mkdir dir="${junit.tempdir}" />
<mkdir dir="${junit.java.io.tmpdir}" />
<mkdir dir="${junit.user.home}" />
<prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
<junit fork="yes"
forkmode="${hy.test.forkmode}"
timeout="${hy.test.timeout}"
printsummary="withOutAndErr"
errorproperty="test.errors"
failureproperty="test.failures"
showoutput="on"
dir="${work.dir}/@{module}"
tempdir="${junit.tempdir}"
jvm="${test.jre.home}/bin/java">
<jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" />
<jvmarg line="-Duser.home=${junit.user.home}" />
<classpath>
<fileset dir="${hy.test.root}">
<include name="*.jar" />
</fileset>
<pathelement path="${test.resources.dir}/" />
<pathelement path="${test.module.dir}/" />
<pathelement location="${test.module.dir}/@{jar}" />
</classpath>
<junit-elements />
<batchtest todir="${tests.output}" haltonfailure="no">
<zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8">
<exclude name="Test.class" />
<exclude name="**/*$*" />
<!-- if ${test.case} -->
<include name="${converted.tc.class}" if="test.case" />
<!-- unless ${test.case} -->
<include name="**/*Test.class" unless="test.case" />
<excludesfile name="${test.exclude.file}" unless="test.case"/>
<excludeorinclude/>
</zipfileset>
</batchtest>
<assertions enableSystemAssertions="true">
<enable />
</assertions>
<jvmarg line="${hy.test.vmargs}" />
<!-- Used by Support_Exec.execJava() -->
<jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
<formatter type="xml" />
</junit>
<delete dir="${module.temp.dir}"
includeemptydirs="true" failonerror="false" />
<antcall target="touch-failures-file">
<param name="module" value="@{module}" />
</antcall>
<antcall target="touch-errors-file">
<param name="module" value="@{module}" />
</antcall>
</sequential>
</macrodef>
<!-- TOFIX: Can't seem to override the line:
<include name="**/*Test.class" unless="test.case" />
so this is just run-hdk-tests without that line -->
<macrodef name="run-selected-hdk-tests">
<attribute name="module" />
<attribute name="jar" />
<element name="junit-elements" optional="true"/>
<element name="excludeorinclude" optional="true"/>
<sequential>
<echo message="Running @{module} Unit Test from @{jar}" />
<echo message="Tested jre: ${test.jre.home}/bin/java" />
<property name="test.module.dir" value="${hy.test.root}/@{module}" />
<property name="test.excludes.dir" value="${test.module.dir}/excludes" />
<property name="test.resources.dir" value="${test.module.dir}/resources" />
<property name="module.work.dir" location="${work.dir}/@{module}" />
<property name="test.exclude.file" value="${module.work.dir}/test.exclude" />
<property name="module.temp.dir"
location="${work.dir}/@{module}/temp" />
<property name="junit.tempdir"
location="${module.temp.dir}/ant" />
<property name="junit.java.io.tmpdir"
location="${module.temp.dir}/tmpdir" />
<property name="junit.user.home"
location="${module.temp.dir}/user" />
<mkdir dir="${tests.output}" />
<mkdir dir="${junit.tempdir}" />
<mkdir dir="${junit.java.io.tmpdir}" />
<mkdir dir="${junit.user.home}" />
<prepare-exclude-list moduleName="@{module}" dir="${test.excludes.dir}" result="${test.exclude.file}" />
<junit fork="yes"
forkmode="${hy.test.forkmode}"
timeout="${hy.test.timeout}"
printsummary="withOutAndErr"
errorproperty="test.errors"
failureproperty="test.failures"
showoutput="on"
dir="${work.dir}/@{module}"
tempdir="${junit.tempdir}"
jvm="${test.jre.home}/bin/java">
<jvmarg line="-Djava.io.tmpdir=${junit.java.io.tmpdir}" />
<jvmarg line="-Duser.home=${junit.user.home}" />
<classpath>
<fileset dir="${hy.test.root}">
<include name="*.jar" />
</fileset>
<pathelement path="${test.resources.dir}/" />
<pathelement path="${test.module.dir}/" />
<pathelement location="${test.module.dir}/@{jar}" />
</classpath>
<junit-elements />
<batchtest todir="${tests.output}" haltonfailure="no">
<zipfileset src="${test.module.dir}/@{jar}" encoding="UTF-8">
<exclude name="Test.class" />
<exclude name="**/*$*" />
<!-- if ${test.case} -->
<include name="${converted.tc.class}" if="test.case" />
<!-- unless ${test.case} -->
<excludesfile name="${test.exclude.file}" unless="test.case"/>
<excludeorinclude/>
</zipfileset>
</batchtest>
<assertions enableSystemAssertions="true">
<enable />
</assertions>
<jvmarg line="${hy.test.vmargs}" />
<!-- Used by Support_Exec.execJava() -->
<jvmarg value="-Dhy.test.vmargs=${hy.test.vmargs}" />
<formatter type="xml" />
</junit>
<delete dir="${module.temp.dir}"
includeemptydirs="true" failonerror="false" />
<antcall target="touch-failures-file">
<param name="module" value="@{module}" />
</antcall>
<antcall target="touch-errors-file">
<param name="module" value="@{module}" />
</antcall>
</sequential>
</macrodef>
<target name="touch-failures-file" if="test.failures">
<echo file="${tests.output}/test.failures"
append="true">${module}${line.separator}</echo>
</target>
<target name="touch-errors-file" if="test.errors">
<echo file="${tests.output}/test.errors"
append="true">${module}${line.separator}</echo>
</target>
<!-- To use with -Dtest.case=... option -->
<!-- if ${test.case} is provided in package+class form -->
<!-- it is converted to dir+filename form -->
<macrodef name="convert-test-as-class">
<attribute name="from" />
<attribute name="to" />
<sequential>
<pathconvert property="@{to}" setonempty="no">
<path path="${@{from}}" />
<chainedmapper>
<filtermapper>
<replaceregex pattern="\.java$$" />
</filtermapper>
<unpackagemapper from="${basedir}${file.separator}*" to="*.class" />
</chainedmapper>
</pathconvert>
</sequential>
</macrodef>
<macrodef name="make-patternset">
<attribute name="source" default="src/main" />
<attribute name="module" />
<attribute name="file"
default="${hy.hdk}/build/ant/patternsets/@{module}.txt" />
<sequential>
<dirname file="@{file}" property="@{file}.dir" />
<mkdir dir="${@{file}.dir}" />
<property name="@{source}.loc" location="@{source}"/>
<pathconvert targetos="unix" property="@{file}.content"
pathsep="${line.separator}">
<fileset dir="${@{source}.loc}" includes="java*/**/*.java" />
<map from="${@{source}.loc}/java/unix/" to="" />
<map from="${@{source}.loc}/java/windows/" to="" />
<map from="${@{source}.loc}/java/common/" to="" />
<map from="${@{source}.loc}/java5/" to="" />
<map from="${@{source}.loc}/java/" to="" />
<compositemapper>
<mapper type="regexp" from="^(.*)\.java$$" to="\1.*"/>
<mapper type="regexp" from="^(.*)\.java$$" to="\1$*.*"/>
</compositemapper>
</pathconvert>
<echo message="${@{file}.content}${line.separator}"
file="@{file}" />
</sequential>
</macrodef>
<macrodef name="delete-patternset">
<attribute name="module" />
<sequential>
<delete file="${hy.hdk}/build/ant/patternsets/@{module}.txt" />
</sequential>
</macrodef>
<macrodef name="run-findBugs">
<attribute name="outputFile"/>
<attribute name="excludeFilter"/>
<attribute name="jarFile"/>
<sequential>
<!-- Find and define findbugs task -->
<property name="findbugs.home"
location="${hy.depends}/oss/findbugs-1.3.9"/>
<available
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.home}/lib/findbugs-ant.jar"
property="findbugs.available"/>
<taskdef
name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.home}/lib/findbugs-ant.jar"
onerror="ignore"/>
<fail message="FindBugs is unavailable" unless="findbugs.available"/>
<!-- Run findbugs using the attributes given -->
<dirname file="@{outputFile}" property="@{outputFile}.dir" />
<mkdir dir="${@{outputFile}.dir}" />
<findbugs home="${findbugs.home}"
output="xml"
outputFile="@{outputFile}"
excludeFilter="@{excludeFilter}"
jvmargs="-Xmx512M"
workhard="true">
<auxClasspath>
<fileset dir="${hy.jdk}/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
</auxClasspath>
<sourcePath path="src/main/java" />
<sourcePath path="src/main/java5" />
<sourcePath path="src/main/java/common" />
<sourcePath path="src/main/java/${hy.os.family}" />
<class location="@{jarFile}" />
</findbugs>
</sequential>
</macrodef>
<macrodef name="init-hdk">
<sequential>
<mkdir dir="${hy.hdk}/build/ant" />
<copy file="${common.resources}/make/depends.xml"
tofile="${hy.hdk}/build/ant/depends.xml"
outputencoding="UTF-8" />
<copy file="${common.resources}/make/depends.properties"
tofile="${hy.hdk}/build/ant/depends.properties"
outputencoding="UTF-8" />
<mkdir dir="${hy.hdk}/build/make" />
<copy todir="${hy.hdk}/build/make" overwrite="yes">
<fileset dir="${common.resources}/depends/build">
<include name="**" />
</fileset>
</copy>
</sequential>
</macrodef>
</project>