1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- this is a template file to test -->
3 <project name="common" default="run" basedir=".">
4 <description>Builds the test against first version and runs them against two</description>
6 <loadproperties srcfile="${ant.file.common}/../common.properties"/>
7 <loadproperties srcfile="project.properties"/>
9 <target name="make-sure-projects-are-compiled">
10 <ant dir="${taskA}/${apitotest}" target="compile"/>
11 <ant dir="${taskB}/${apitotest}" target="compile"/>
14 <target name="compile" depends="make-sure-projects-are-compiled">
15 <mkdir dir="build/tests"/>
16 <echo level="info" message="Compiling the tests against old version of the API"/>
17 <javac destdir="build/tests" srcdir="test">
19 <pathelement location="${apiA}"/>
20 <pathelement location="${junit.jar}"/>
25 <target name="run" depends="-run-binary-check,-run-source-check">
26 <fail message="The test shall either compile against A and not B or run on A and fail on B, nothing like that happened">
29 <isset property="execution.failed"/>
30 <isset property="compilation.failed"/>
36 <target name="-run-binary-check" depends="compile">
37 <mkdir dir="build/testresultA"/>
39 <echo level="info" message="Running the tests against old version of the API"/>
40 <junit dir="build/tests" failureproperty="run.on.A.shall.succeed" fork="true">
41 <batchtest todir="build/testresultA">
42 <fileset dir="test" includes="**/*.java"/>
44 <formatter type="brief" usefile="false"/>
45 <formatter type="xml"/>
47 <pathelement location="${apiA}"/>
48 <pathelement location="${junit.jar}"/>
49 <pathelement location="build/tests"/>
53 <mkdir dir="build/testresultB"/>
54 <echo level="info" message="Running the same tests against new version of the API, this should fail, if there is binary or functional incompatibility"/>
55 <junit dir="build/tests" failureproperty="run.on.B.shall.fail" fork="true">
56 <batchtest todir="build/testresultB">
57 <fileset dir="test" includes="**/*.java"/>
59 <formatter type="brief" usefile="false"/>
60 <formatter type="xml"/>
62 <pathelement location="${apiB}"/>
63 <pathelement location="${junit.jar}"/>
64 <pathelement location="build/tests"/>
68 <condition property="execution.failed">
70 <isset property="run.on.B.shall.fail"/>
71 <not><isset property="run.on.A.shall.succeed"/></not>
76 <target name="-run-source-check" depends="compile" unless="execution.failed">
78 <property name="build.b" location="build/verifyitbuildsagainstB"/>
79 <delete dir="${build.b}"/>
80 <mkdir dir="${build.b}"/>
83 <echo level="info" message="Verifying source compatibility: Compiling the tests against new version of the API"/>
84 <javac destdir="${build.b}" srcdir="test" failonerror="false" fork="true">
86 <pathelement location="${apiB}"/>
87 <pathelement location="${junit.jar}"/>
92 <uptodate property="compilation.failed">
93 <srcfiles dir="${build.b}" includes="**/*.class"/>
94 <mapper type="glob" from="*" to="build/tests/*"/>
100 <target name="test" depends="run"/>
102 <target name="clean">
103 <delete dir="build"/>