1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="differentreturntype" default="run" basedir=".">
7 <!-- This is the target that does the whole trick - e,g. it compiles
8 the Java source and then replaces tokens inside of the .class file
10 <target name="-build-and-rename">
11 <mkdir dir="build/apimerge/classes"/>
14 destdir="build/apimerge/classes"
15 source="1.4" target="1.4"
19 <!-- this is the replace. As the replace is done textually,
20 we need to use some reasonable encoding that treats all byte values
21 as characters. E.g. it is not possible to use UTF-8 as it does not
22 like the standard Java header 0xCAFEBABE. Western Europe encoding is fine
24 <replace dir="build/apimerge/classes" casesensitive="true" encoding="iso-8859-1" summary="true">
25 <include name="**/*.class"/>
26 <replacetoken>g3tIcon</replacetoken>
27 <replacevalue>getIcon</replacevalue>
31 <target name="build" depends="clean">
32 <antcall target="-build-one">
33 <param name="version" value="api1.0"/>
35 <antcall target="-build-one">
36 <param name="version" value="api2.0"/>
38 <antcall target="-build-and-rename"/>
39 <antcall target="-build-one">
40 <param name="version" value="impl"/>
41 <param name="target" value="impl-with-api1.0"/>
42 <param name="cp" location="build/api1.0/classes"/>
44 <antcall target="-build-one">
45 <param name="version" value="impl"/>
46 <param name="target" value="impl-with-api2.0"/>
47 <param name="cp" location="build/api2.0/classes"/>
51 <target name="run" depends="build">
52 <echo level="info" message="Running the Implementation Compiled against Version 1.0 with Version 1.0. This should succeeds."/>
53 <antcall target="-run-one">
54 <param name="version" value="api1.0"/>
56 <echo level="info" message="Running the Implementation Compiled against Version 2.0 with Version 2.0. This should succeeds."/>
57 <antcall target="-run-one">
58 <param name="version" value="api2.0"/>
60 <echo level="info" message="Running the Implementation Compiled against Version 1.0 with Version 2.0. This should fail."/>
61 <antcall target="-run-one">
62 <param name="version" value="api2.0"/>
63 <param name="target" value="api1.0"/>
65 <echo level="info" message="Running the Implementation Compiled against Version 2.0 with Version 1.0. This should fail."/>
66 <antcall target="-run-one">
67 <param name="version" value="api1.0"/>
68 <param name="target" value="api2.0"/>
70 <echo level="info" message="Final success1: Running the Implementation Compiled against Version 1.0 with Merged Version."/>
71 <antcall target="-run-one">
72 <param name="version" value="apimerge"/>
73 <param name="target" value="api1.0"/>
75 <echo level="info" message="Final success2: Running the Implementation Compiled against Version 2.0 with Merged Version."/>
76 <antcall target="-run-one">
77 <param name="version" value="apimerge"/>
78 <param name="target" value="api2.0"/>
83 <!-- support methods -->
85 <target name="-run-one">
86 <fail message="You need to specify API version number" unless="version"/>
87 <property name="target" value="${version}"/>
88 <java classpath="build/${version}/classes:build/impl-with-${target}/classes" classname="impl.Impl"
93 <target name="-build-one">
94 <fail message="You need to specify version number" unless="version"/>
96 <property name="cp" value=""/>
97 <property name="target" value="${version}"/>
98 <mkdir dir="build/${target}/classes"/>
100 srcdir="src-${version}"
101 destdir="build/${target}/classes"
102 source="1.4" target="1.4"