1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="co-contra-variance" default="run" basedir=".">
6 <target name="test" depends="run"/>
8 <target name="compile" depends="build"/>
10 <antcall target="-build-one">
11 <param name="version" value="api1.0"/>
13 <antcall target="-build-one">
14 <param name="version" value="api2.0"/>
16 <echo level="info" message="Compiling the test against Version 1.0 of the API. This should succeeds."/>
17 <antcall target="-build-one">
18 <param name="version" value="impl"/>
19 <param name="output" value="impl-with-1.0"/>
20 <param name="cp" location="build/api1.0/classes"/>
22 <echo level="info" message="Compiling the test against Version 2.0 of the API. This should succeeds."/>
23 <antcall target="-build-one">
24 <param name="version" value="impl"/>
25 <param name="output" value="impl-with-2.0"/>
26 <param name="cp" location="build/api2.0/classes"/>
30 <target name="run" depends="build">
31 <echo level="info" message="Running the test compiled with version 1.0 of the API against version 1.0 of the API. This should succeeds."/>
32 <antcall target="-run-one">
33 <param name="version" value="api1.0"/>
34 <param name="testversion" value="impl-with-1.0"/>
35 <param name="result" value="0"/>
37 <echo level="info" message="Running the test compiled with version 2.0 of the API against version 2.0 of the API. This should succeeds."/>
38 <antcall target="-run-one">
39 <param name="version" value="api2.0"/>
40 <param name="testversion" value="impl-with-2.0"/>
41 <param name="result" value="0"/>
43 <echo level="info" message="Mixing should not work: Running the test compiled with version 1.0 of the API against version 2.0 of the API. This should fail."/>
44 <antcall target="-run-one">
45 <param name="version" value="api2.0"/>
46 <param name="testversion" value="impl-with-1.0"/>
47 <param name="result" value="1"/>
49 <echo level="info" message="Mixing does not work: Running the test compiled with version 2.0 of the API against version 1.0 of the API. This should fail."/>
50 <antcall target="-run-one">
51 <param name="version" value="api1.0"/>
52 <param name="testversion" value="impl-with-2.0"/>
53 <param name="result" value="1"/>
58 <!-- support methods -->
60 <target name="-run-one">
61 <fail message="You need to specify API version number" unless="version"/>
62 <java classpath="build/${version}/classes:build/${testversion}/classes" classname="test.CovarianceTest"
63 resultproperty="result.real" failonerror="false" fork="true"
65 <fail message="Unexpected failure for ${version}: ${result.real}">
68 <equals arg1="${result}" arg2="${result.real}"/>
74 <target name="-build-one">
75 <fail message="You need to specify version number" unless="version"/>
77 <property name="output" value="${version}"/>
78 <mkdir dir="build/${output}/classes"/>
79 <property name="cp" value=""/>
81 srcdir="src-${version}"
82 destdir="build/${output}/classes"
83 source="1.6" target="1.6"
85 includeantruntime="false"