Commit 58d8a1ec authored by Lubomir Bulej's avatar Lubomir Bulej

build.xml: download dependencies using the Ivy dependency manager.

build.xml: check presence of the required dependency artifacts.
build.xml: make JUnit generate test reports.
lib: remove included dependencies.
parent 0389aab7
......@@ -7,9 +7,9 @@
<classpathentry kind="src" output="output/build/shvm-dispatch" path="src-shvm-dispatch"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="output/lib/disl-bypass.jar"/>
<classpathentry kind="lib" path="lib/asm-debug-all-5.0.3.jar"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/disl/asm-debug-all.jar" sourcepath="lib/devel/asm-debug-all-source.jar"/>
<classpathentry kind="lib" path="lib/disl/log4j.jar" sourcepath="lib/devel/log4j-source.jar"/>
<classpathentry kind="lib" path="lib/test/junit.jar" sourcepath="lib/devel/junit-source.jar"/>
<classpathentry kind="lib" path="lib/test/hamcrest-core.jar"/>
<classpathentry kind="output" path="output/build/disl"/>
</classpath>
lib.dir=lib
asm.lib=asm-debug-all-5.0.3.jar
asm.path=${lib.dir}/${asm.lib}
junit.core.lib=junit-4.11.jar
junit.core.path=${lib.dir}/${junit.core.lib}
junit.hamcrest.lib=hamcrest-core-1.3.jar
junit.hamcrest.path=${lib.dir}/${junit.hamcrest.lib}
log4j.lib=log4j-1.2.15.jar
log4j.path=${lib.dir}/${log4j.lib}
ant-contrib.lib=ant-contrib-0.6.jar
ant-contrib.resource=net/sf/antcontrib/antlib.xml
ant-contrib.path=${lib.dir}/${ant-contrib.lib}
lib.ant.dir=${lib.dir}/ant
lib.disl.dir=${lib.dir}/disl
lib.test.dir=${lib.dir}/test
src.bin=bin
src.disl=src-disl
......@@ -32,7 +19,7 @@ src.doc.intro=${src.doc}/intro
src.examples=examples
# Based output directory
# Base output directory
out.dir=output
......@@ -48,11 +35,19 @@ build.shvm.dispatch=${build.shvm}-dispatch
build.test=${build.dir}/test
build.doc.intro=${build.dir}/intro
# Build system libraries
build.ivy.url = http://central.maven.org/maven2/org/apache/ivy/ivy/${ivy.rev}/ivy-${ivy.rev}.jar
build.ivy.path = ${lib.ant.dir}/ivy.jar
build.ivy.file = dependencies.xml
build.artifacts.list = ${lib.dir}/artifacts.lst
# Directories for output artifacts
out.lib=${out.dir}/lib
out.src=${out.dir}/src
out.test=${out.dir}/test
out.junit=${out.dir}/junit
out.doc.jdoc=${out.dir}/jdoc
......
<project name="disl" default="build" basedir=".">
<project
name="disl" default="build" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:ac="antlib:net.sf.ant-contrib"
xmlns:jj="antlib:com.tonicsystems.jarjar"
>
<property name="build.sysclasspath" value="ignore" />
<property file="disl.version" />
<property file="dependencies.local.properties" />
<property file="dependencies.properties" />
<property file="build.local.properties" />
<property file="build.properties" />
<!-- ================================================================== -->
<!-- IVY SETUP & TASKS -->
<!-- ================================================================== -->
<!--
Define additional tasks from ant-contrib.
Downloads the Ivy dependency manager from the Maven central repository.
-->
<taskdef resource="${ant-contrib.resource}">
<classpath>
<pathelement location="${ant-contrib.path}" />
</classpath>
</taskdef>
<available file="${build.ivy.path}" property="build.ivy.downloaded" />
<target name="-download-ivy" unless="build.ivy.downloaded">
<mkdir dir="${lib.ant.dir}" />
<get src="${build.ivy.url}" dest="${build.ivy.path}" usetimestamp="true"/>
</target>
<!--
Define various class path elements.
Registers Ivy tasks within Ant.
-->
<path id="asm.classpath">
<pathelement location="${asm.path}" />
</path>
<target name="-setup-ivy" depends="-download-ivy">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${build.ivy.path}" />
</target>
<path id="log4j.classpath">
<pathelement location="${log4j.path}" />
</path>
<path id="junit.classpath">
<pathelement location="${junit.core.path}" />
<pathelement location="${junit.hamcrest.path}" />
</path>
<!--
Downloads dependencies for compilation. This target should allow
unconditional execution so that the download can be always forced.
-->
<target name="download-deps" depends="-setup-ivy" description="Downloads dependencies for compilation.">
<ivy:resolve conf="ant,disl,test" file="${build.ivy.file}"/>
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact].[ext]" />
</target>
<path id="util.classpath">
<pathelement location="${build.util}" />
</path>
<path id="disl.classpath">
<pathelement location="${build.disl}" />
</path>
<!--
Downloads dependency sources (for IDE integration).
-->
<target name="download-sources" depends="download-deps" description="Downloads dependency sources (for IDE integration).">
<ivy:resolve conf="devel" file="${build.ivy.file}"/>
<ivy:retrieve type="source" pattern="${lib.dir}/[conf]/[artifact]-[type].[ext]"/>
</target>
<path id="disl.bypass.classpath">
<pathelement location="${build.disl.bypass}/dynamic" />
</path>
<path id="shvm.classpath">
<pathelement location="${build.shvm}" />
<pathelement location="${build.shvm.dispatch}" />
</path>
<!-- ================================================================== -->
<!-- ARTIFACT LIST -->
<!-- ================================================================== -->
<!--
Downloads dependencies and stores the list of retrieved artifacts
so that their presence can be checked in subsequent invocations
without Ivy. This target should allow unconditional execution so
that the update of the artifact list can be always forced.
-->
<target name="update-artifact-list" depends="download-deps" description="Updates the list of expected dependency artifacts.">
<collect-artifacts id="build.artifacts"/>
<!-- Initialization -->
<local name="artifacts.text"/>
<path-to-text
property="artifacts.text" refid="build.artifacts"
mapfrom="${basedir}${file.separator}${lib.dir}"
mapto="${lib.dir}"
/>
<target name="determine-lib-names">
<!--
Determine the names of native agent libraries.
Mac OS X (Darwin) is considered a Unix family.
-->
<if>
<echo file="${build.artifacts.list}">${artifacts.text}</echo>
</target>
<!--
Determines whether the artifact list is up-to-date and sets the value
of the 'build.artifacts.list.uptodate' property accordingly. The list
is considered up-to-date if it contains at least one non-empty line
and is newer than both the files describing the dependency properties.
-->
<target name="-check-artifact-list">
<condition property="build.artifacts.list.uptodate"><and>
<resourcecount when="greater" count="0">
<tokens><concat>
<filterchain>
<tokenfilter><ignoreblank/></tokenfilter>
</filterchain>
<file file="${build.artifacts.list}"/>
</concat></tokens>
</resourcecount>
<uptodate targetfile="${build.artifacts.list}">
<srcfiles dir="${basedir}" includes="dependencies*.properties" />
</uptodate>
</and></condition>
</target>
<!--
Creates artifact list if it is missing or not up-to-date. This will
trigger an initial download of artifacts so that the list is build
from the downloaded artifacts.
-->
<target name="-create-artifact-list" depends="-check-artifact-list" unless="build.artifacts.list.uptodate">
<antcall target="update-artifact-list"/>
</target>
<!--
Collects downloaded artifacts into a fileset.
-->
<macrodef name="collect-artifacts">
<attribute name="id"/>
<sequential>
<fileset dir="${basedir}" id="@{id}">
<include name="${lib.ant.dir}/*.jar"/>
<include name="${lib.disl.dir}/*.jar"/>
<include name="${lib.test.dir}/*.jar"/>
</fileset>
</sequential>
</macrodef>
<!--
Converts a path-like entity to text, one entry per line.
Optionally performs mapping from one path prefix to another.
-->
<macrodef name="path-to-text">
<attribute name="property"/>
<attribute name="refid"/>
<attribute name="mapfrom" default=""/>
<attribute name="mapto" default=""/>
<sequential>
<pathconvert pathsep="${line.separator}" property="@{property}" refid="@{refid}">
<map from="@{mapfrom}" to="@{mapto}"/>
</pathconvert>
</sequential>
</macrodef>
<!-- ================================================================== -->
<!-- DEPENDENCY CHECKS -->
<!-- ================================================================== -->
<!--
Determines if any of the expected artifacts are missing and sets
the value of the 'build.artifacts.missing' property accordingly.
This may trigger creating the list of expected artifacts after an
initial download of dependencies.
-->
<target name="-check-artifacts" depends="-create-artifact-list">
<find-missing-files file="${build.artifacts.list}" id="build.artifacts.missing.list"/>
<condition property="build.artifacts.missing">
<not><resourcecount refid="build.artifacts.missing.list" count="0"/></not>
</condition>
</target>
<!--
Download dependency artifacts if they are missing.
-->
<target name="-download-artifacts" depends="-check-artifacts" if="build.artifacts.missing">
<antcall target="download-deps" />
</target>
<!--
Checks that none of the required artifacts are missing. This may
trigger an initial download of dependency artifacts, but generally
they will checked against a list of expected artifacts. If any of
the artifacts are missing at this point, the build will fail.
-->
<target name="-check-deps" depends="-download-artifacts">
<find-missing-files file="${build.artifacts.list}" id="build.artifacts.really.missing.list"/>
<!-- Sanitize the path names of potentially missing artifacts. -->
<local name="missing.text"/>
<path-to-text
property="missing.text" refid="build.artifacts.really.missing.list"
mapfrom="${basedir}${file.separator}${lib.dir}"
mapto="${lib.dir}"
/>
<!-- Fail if there are any missing artifacts. -->
<fail message="missing artifacts${line.separator}${missing.text}${line.separator}Try running 'ant download-deps' to re-download dependencies.">
<condition>
<not><resourcecount refid="build.artifacts.really.missing.list" count="0"/></not>
</condition>
</fail>
</target>
<!--
Loads a list of files and selects those that are missing.
-->
<macrodef name="find-missing-files">
<attribute name="file"/>
<attribute name="id"/>
<sequential>
<restrict id="@{id}">
<resourcelist>
<file file="@{file}"/>
</resourcelist>
<not><exists/></not>
</restrict>
</sequential>
</macrodef>
<!-- ================================================================== -->
<!-- INITIALIZATION -->
<!-- ================================================================== -->
<!--
Setup Ant extensions and define class paths involving both the
downloaded artifacts and project classes.
-->
<target name="-init" depends="-check-deps">
<path id="build.ant.classpath">
<fileset dir="${lib.ant.dir}" includes="*.jar" />
</path>
<!-- taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" uri="antlib:com.conicsystems.jarjar" classpathref="build.ant.classpath" /-->
<taskdef resource="net/sf/antcontrib/antlib.xml" uri="antlib:net.sf.ant-contrib" classpathref="build.ant.classpath" />
<!-- Dependency class paths -->
<path id="asm.classpath">
<fileset dir="${lib.disl.dir}" includes="asm*.jar" />
</path>
<!-- Get ASM libs from ASM class path. -->
<pathconvert property="asm.libs" refid="asm.classpath">
<mapper type="flatten"/>
</pathconvert>
<path id="log4j.classpath">
<fileset dir="${lib.disl.dir}" includes="log4j*.jar" />
</path>
<path id="junit.classpath">
<fileset dir="${lib.test.dir}" includes="*.jar" />
</path>
<!-- Project class paths -->
<path id="util.classpath">
<pathelement location="${build.util}" />
</path>
<path id="disl.classpath">
<pathelement location="${build.disl}" />
</path>
<path id="disl.bypass.classpath">
<pathelement location="${build.disl.bypass}/dynamic" />
</path>
<path id="shvm.classpath">
<pathelement location="${build.shvm}" />
<pathelement location="${build.shvm.dispatch}" />
</path>
</target>
<!--
Determines the names of native agent libraries.
Mac OS X (Darwin) is considered a Unix family.
-->
<target name="-determine-lib-names" depends="-init">
<ac:if>
<os family="windows" />
<then>
<ac:then>
<property name="dl.prefix" value="" />
<property name="dl.suffix" value=".dll" />
</then>
<else><if>
<os family="unix" />
<then>
<property name="dl.prefix" value="lib" />
<if>
<os family="mac" />
<then>
<property name="dl.suffix" value=".jnilib" />
</then>
<else>
<property name="dl.suffix" value=".so" />
</else>
</if>
</then>
<else>
<fail message="Unsupported operating system: ${os.name}" />
</else>
</if></else>
</if>
</ac:then><ac:else>
<ac:if>
<os family="unix" />
<ac:then>
<property name="dl.prefix" value="lib" />
<ac:if>
<os family="mac" />
<ac:then>
<property name="dl.suffix" value=".jnilib" />
</ac:then><ac:else>
<property name="dl.suffix" value=".so" />
</ac:else>
</ac:if>
</ac:then><ac:else>
<fail message="Unsupported operating system: ${os.name}" />
</ac:else>
</ac:if>
</ac:else>
</ac:if>
<property name="disl.agent.lib" value="${dl.prefix}${disl.agent.lib.base}${dl.suffix}" />
<property name="shvm.agent.lib" value="${dl.prefix}${shvm.agent.lib.base}${dl.suffix}" />
......@@ -111,7 +328,7 @@
<!-- Build tools -->
<target name="compile-tools">
<target name="compile-tools" depends="-init">
<mkdir dir="${build.tools}" />
<javac destdir="${build.tools}" srcdir="${src.tools}">
<classpath>
......@@ -135,15 +352,15 @@
if not, we use a thread extended from build tools to generate
the extended Thread class.
-->
<pathconvert property="build.disl.thread.available" setonempty="false">
<!-- pathconvert property="build.disl.thread.available" setonempty="false">
<fileset dir="." includes="${build.disl.thread}/**/Thread.class" />
</pathconvert>
<target name="prepare-disl-thread" unless="build.disl.thread.available">
<antcall target="create-disl-thread" />
</target>
</pathconvert -->
<condition property="build.disl.thread.available"><and>
<available file="${build.disl.thread}/java/lang/Thread.class"/>
<length file="${build.disl.thread}/java/lang/Thread.class" when="greater" length="1024"/>
</and></condition>
<target name="create-disl-thread" depends="compile-tools">
<target name="-prepare-disl-thread" unless="build.disl.thread.available" depends="compile-tools">
<local name="extender.class" />
<find-class property="extender.class" dir="${build.tools}" name="ExtendThread" />
......@@ -172,15 +389,15 @@
The DiSL server requires both classes to create class literals
in the weaver code.
-->
<target name="compile-disl-bypass" depends="prepare-disl-thread">
<for list="always,never,dynamic" param="variant">
<target name="compile-disl-bypass" depends="-init,-prepare-disl-thread">
<ac:for list="always,never,dynamic" param="variant">
<sequential>
<mkdir dir="${build.disl.bypass}/@{variant}" />
<javac destdir="${build.disl.bypass}/@{variant}" srcdir="${src.disl.bypass}/@{variant}" debug="true" source="${target.disl.bypass}" target="${target.disl.bypass}">
<compilerarg value="-Xbootclasspath/p:${basedir}/${build.disl.thread}" />
</javac>
</sequential>
</for>
</ac:for>
<union id="disl.bypass.files">
<fileset dir="${build.disl.bypass}/always" includes="**/BypassCheck.class" />
......@@ -206,7 +423,7 @@
<!-- Shared utility code -->
<target name="compile-util">
<target name="compile-util" depends="-init">
<mkdir dir="${build.util}" />
<javac destdir="${build.util}" srcdir="${src.util}" debug="true">
<classpath refid="log4j.classpath" />
......@@ -253,7 +470,7 @@
<jar destfile="${out.lib}/${disl.lib}">
<manifest>
<attribute name="Class-Path" value="${asm.lib}" />
<attribute name="Class-Path" value="${asm.libs}" />
<attribute name="Main-Class" value="${server.class}" />
<attribute name="DiSL-Version" value="${disl.version}" />
</manifest>
......@@ -274,21 +491,22 @@
various code generation options. This target generates the
header using "javah" after compiling DiSL.
-->
<property name="build.disl.agent.codeflags.path" value="${src.disl.agent}/codeflags.h" />
<uptodate property="disl.agent.codeflags.uptodate" targetfile="${build.disl.agent.codeflags.path}">
<srcfiles dir="${src.disl}" includes="**/DiSL.java" />
</uptodate>
<target name="prepare-disl-agent-codeflags" unless="disl.agent.codeflags.uptodate">
<antcall target="generate-disl-agent-codeflags" />
<target name="-check-disl-agent-codeflags">
<property name="build.disl.agent.codeflags.path" value="${src.disl.agent}/codeflags.h" />
<uptodate property="build.disl.agent.codeflags.uptodate" targetfile="${build.disl.agent.codeflags.path}">
<srcfiles dir="${src.disl}" includes="**/DiSL.java" />
</uptodate>
</target>
<target name="-generate-disl-agent-codeflags-if-needed" unless="build.disl.agent.codeflags.uptodate" depends="-check-disl-agent-codeflags">
<antcall target="-generate-disl-agent-codeflags"/>
</target>
<target name="generate-disl-agent-codeflags" depends="compile-disl">
<target name="-generate-disl-agent-codeflags" depends="compile-disl">
<local name="flags.class" />
<find-class property="flags.class" dir="${build.disl}" name="*CodeOption$Flag" />
<javah outputFile="${build.disl.agent.codeflags.path}">
<javah outputFile="${build.disl.agent.codeflags.path}" force="yes">
<class name="${flags.class}" />
<classpath refid="disl.classpath" />
</javah>
......@@ -300,26 +518,27 @@
classes. This target generates the "bytecode.c" containing
the necessary bytecode.
-->
<property name="build.disl.agent.bytecode.path" value="${src.disl.agent}/bytecode.c" />
<uptodate property="build.disl.agent.bytecode.uptodate" targetfile="${build.disl.agent.bytecode.path}">
<srcfiles dir="${src.disl.bypass}" />
</uptodate>
<target name="prepare-disl-agent-bytecode" unless="build.disl.agent.bytecode.uptodate">
<antcall target="generate-disl-agent-bytecode" />
<target name="-check-disl-agent-bytecode">
<property name="build.disl.agent.bytecode.path" value="${src.disl.agent}/bytecode.c" />
<uptodate property="build.disl.agent.bytecode.uptodate" targetfile="${build.disl.agent.bytecode.path}">
<srcfiles dir="${src.disl.bypass}" />
</uptodate>
</target>
<target name="-generate-disl-agent-bytecode-if-needed" unless="build.disl.agent.bytecode.uptodate" depends="-check-disl-agent-bytecode">
<antcall target="-generate-disl-agent-bytecode" />
</target>
<target name="generate-disl-agent-bytecode" depends="compile-tools,compile-disl">
<local name="output.file" />
<property name="output.file" value="${build.disl.agent.bytecode.path}" />
<target name="-generate-disl-agent-bytecode" depends="compile-disl,compile-tools">
<taskdef name="bytedump" classname="ch.usi.dag.disl.tools.ByteDumpTask">
<classpath>
<pathelement location="${build.tools}" />
</classpath>
</taskdef>
<local name="output.file" />
<property name="output.file" value="${build.disl.agent.bytecode.path}" />
<echo file="${output.file}">/**${line.separator}</echo>
<echo file="${output.file}" append="true"> * DO NOT EDIT!${line.separator}</echo>
<echo file="${output.file}" append="true"> *${line.separator}</echo>
......@@ -327,7 +546,7 @@
<echo file="${output.file}" append="true"> */${line.separator}</echo>
<echo file="${output.file}" append="true">#include &lt;jvmti.h&gt;${line.separator}</echo>
<for param="file.path">
<ac:for param="file.path">
<path>
<fileset dir="${build.disl.bypass}" includes="**/BypassCheck.class" />
<!-- fileset dir="${build.disl.bypass}" includes="**/DynamicBypass.class" /-->
......@@ -361,14 +580,14 @@
/>
<echo file="${output.file}" append="true">};${line.separator}</echo>
</sequential>
</for>
</ac:for>
</target>
<target name="prepare-disl-agent" depends="prepare-disl-agent-codeflags,prepare-disl-agent-bytecode" />
<target name="-prepare-disl-agent" depends="-generate-disl-agent-codeflags-if-needed,-generate-disl-agent-bytecode-if-needed"/>
<target name="compile-disl-agent" depends="prepare-disl-agent,determine-lib-names">
<target name="compile-disl-agent" depends="-prepare-disl-agent">
<exec executable="make" dir="${src.disl.agent}">
<arg value="WHOLE=1" />
</exec>
......@@ -380,7 +599,7 @@
Windows using MinGW. It is currently not used in the
default build, but should be used for binary releases.
-->
<target name="compile-disl-agent-mingw" depends="prepare-disl-agent,determine-lib-names">
<target name="compile-disl-agent-mingw" depends="-prepare-disl-agent">
<exec executable="make" dir="${src.disl.agent}">
<arg value="WHOLE=1" />
<arg value="TARGET_ENV=MinGW" />
......@@ -388,7 +607,7 @@
</target>
<target name="build-disl-agent" depends="compile-disl-agent">
<target name="build-disl-agent" depends="compile-disl-agent,-determine-lib-names">
<copy file="${src.disl.agent}/${disl.agent.lib}" todir="${out.lib}" />
</target>
......@@ -421,7 +640,7 @@
<jar destfile="${out.lib}/${shvm.lib}">
<manifest>
<attribute name="Class-Path" value="${asm.lib}" />
<attribute name="Class-Path" value="${asm.libs}" />
<attribute name="Main-Class" value="${shvm.server.class}" />
<attribute name="DiSL-Version" value="${disl.version}" />
</manifest>
......@@ -433,14 +652,14 @@
<!-- Shadow VM agent -->
<target name="compile-shvm-agent" depends="determine-lib-names">
<target name="compile-shvm-agent">
<exec executable="make" dir="${src.shvm.agent}">
<arg value="WHOLE=1" />
</exec>
</target>
<target name="build-shvm-agent" depends="compile-shvm-agent">
<target name="build-shvm-agent" depends="compile-shvm-agent,-determine-lib-names">
<copy file="${src.shvm.agent}/${shvm.agent.lib}" todir="${out.lib}" />
</target>
......@@ -455,7 +674,7 @@
<path refid="asm.classpath" />
</path>
<target name="compile-test" depends="compile-util,compile-disl,compile-shvm">
<target name="compile-test" depends="-init,compile-util,compile-disl,compile-shvm">
<mkdir dir="${build.test}" />
<javac destdir="${build.test}" srcdir="${src.test}" debug="true">
<classpath refid="test.classpath" />
......@@ -482,7 +701,7 @@
</macrodef>
<target name="build-test" depends="compile-test">
<target name="build-test" depends="-init,compile-test">
<property name="suite.base.pkg" value="ch.usi.dag.disl.test.suite" />
<package2path package="${suite.base.pkg}" property="suite.base.path" />
......@@ -490,7 +709,7 @@
<isset property="test.name" />
</condition>
<for param="suite.path">
<ac:for param="suite.path">
<path>
<dirset dir="${src.test}/${suite.base.path}">
<include name="${test.suites}" />
......@@ -499,65 +718,65 @@
<sequential>
<local name="suite.name" />
<basename file="@{suite.path}" property="suite.name" />
<antcall target="build-test-suite">
<param name="test.suite.name" value="${suite.name}" />
<param name="test.suite.path" value="${suite.base.path}/${suite.name}" />
<param name="test.suite.pkg" value="${suite.base.pkg}.${suite.name}" />
</antcall>
<build-test-suite name="${suite.name}" path="${suite.base.path}/${suite.name}" pkg="${suite.base.pkg}.${suite.name}" />
</sequential>
</for>
</ac:for>
</target>
<target name="build-test-suite">
<!-- Package target application classes. -->
<jar destfile="${out.test}/${test.suite.name}-app.jar">
<fileset dir="${build.test}" includes="${test.suite.path}/app/**" />
<manifest>
<attribute name="Main-Class" value="${test.suite.pkg}.app.TargetClass" />
</manifest>
</jar>
<!--
Process annotations to find DiSL classes.
Use an empty directory as destination for the classes to
make the "javac" task actually execute "javac" with the
source files. Using the normal build destination directory
would result in "javac" task excluding all source files
for which it could find up-to-date class files.
-->
<local name="classfinder.output" />
<tempfile property="classfinder.output" destDir="${out.dir}" createFile="true" deleteOnExit="true" />
<local name="classfinder.class" />
<find-class property="classfinder.class" dir="${build.disl}" name="DislClassFinder" />
<mkdir dir="${out.dir}/empty" />
<javac srcdir="${src.test}" destDir="${out.dir}/empty">
<classpath refid="test.classpath" />
<compilerArg value="-proc:only" />
<compilerArg line="-processor ${classfinder.class}" />
<compilerArg value="-Adisl.classfinder.output=${classfinder.output}" />
<compilerArg value="-Adisl.classfinder.separator=," />
<include name="${test.suite.path}/**/*.java" />
</javac>
<loadfile property="disl.classes" srcFile="${classfinder.output}" />
<!-- Package instrumentation classes. -->
<jar destfile="${out.test}/${test.suite.name}-inst.jar">
<manifest>
<attribute name="DiSL-Classes" value="${disl.classes}" />
</manifest>
<fileset dir="${build.test}" includes="${test.suite.path}/instr/**" />
</jar>
</target>
<macrodef name="build-test-suite">
<attribute name="name"/>
<attribute name="path"/>
<attribute name="pkg"/>
<sequential>
<!-- Package target application classes. -->
<jar destfile="${out.test}/@{name}-app.jar">
<fileset dir="${build.test}" includes="@{path}/app/**" />
<manifest>
<attribute name="Main-Class" value="@{pkg}.app.TargetClass" />
</manifest>
</jar>
<!--
Process annotations to find DiSL classes.
Use an empty directory as destination for the classes to
make the "javac" task actually execute "javac" with the
source files. Using the normal build destination directory
would result in "javac" task excluding all source files
for which it could find up-to-date class files.
-->
<local name="classfinder.output" />
<tempfile property="classfinder.output" prefix="@{name}-disl-classes-" suffix=".lst" destDir="${out.dir}" createFile="true" deleteOnExit="true" />
<local name="classfinder.class" />
<find-class property="classfinder.class" dir="${build.disl}" name="DislClassFinder" />
<mkdir dir="${out.dir}/empty" />
<javac srcdir="${src.test}" destDir="${out.dir}/empty">
<classpath refid="test.classpath" />
<compilerArg value="-proc:only" />
<compilerArg line="-processor ${classfinder.class}" />
<compilerArg value="-Adisl.classfinder.output=${classfinder.output}" />
<compilerArg value="-Adisl.classfinder.separator=," />
<include name="@{path}/**/*.java" />
</javac>