1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="differentreturntype" default="run" basedir=".">
8 <!-- BEGIN: theory.binary.differentreturntype.ant -->
9 <!-- This is the target that does the whole trick - e,g. it compiles
10 the Java source and then replaces tokens
11 inside of the .class file
13 <target name="-build-and-rename">
14 <mkdir dir="build/apimerge/classes"/>
16 srcdir="src-apimerge" destdir="build/apimerge/classes"
17 source="1.4" target="1.4" classpath="${cp}"
20 <!-- this is the replace. As the replace is done textually,
21 we need to use some reasonable encoding that treats all
22 byte values as characters. E.g. it is not possible to
23 use UTF-8 as it does not like the standard Java header
24 0xCAFEBABE. Western Europe encoding is fine
27 dir="build/apimerge/classes" casesensitive="true"
28 encoding="iso-8859-1" summary="true"
30 <include name="**/*.class"/>
31 <replacetoken>g3tIcon</replacetoken>
32 <replacevalue>getIcon</replacevalue>
35 <!-- END: theory.binary.differentreturntype.ant -->
37 <target name="compile" depends="build"/>
38 <target name="build" depends="clean">
39 <antcall target="-build-one">
40 <param name="version" value="api1.0"/>
42 <antcall target="-build-one">
43 <param name="version" value="api2.0"/>
45 <antcall target="-build-and-rename"/>
46 <antcall target="-build-one">
47 <param name="version" value="impl"/>
48 <param name="target" value="impl-with-api1.0"/>
49 <param name="cp" location="build/api1.0/classes"/>
51 <antcall target="-build-one">
52 <param name="version" value="impl"/>
53 <param name="target" value="impl-with-api2.0"/>
54 <param name="cp" location="build/api2.0/classes"/>
58 <target name="run" depends="build">
59 <echo level="info" message="Running the Implementation Compiled against Version 1.0 with Version 1.0. This should succeeds."/>
60 <antcall target="-run-one">
61 <param name="version" value="api1.0"/>
63 <echo level="info" message="Running the Implementation Compiled against Version 2.0 with Version 2.0. This should succeeds."/>
64 <antcall target="-run-one">
65 <param name="version" value="api2.0"/>
67 <echo level="info" message="Running the Implementation Compiled against Version 1.0 with Version 2.0. This should fail."/>
68 <antcall target="-run-one">
69 <param name="version" value="api2.0"/>
70 <param name="target" value="api1.0"/>
72 <echo level="info" message="Running the Implementation Compiled against Version 2.0 with Version 1.0. This should fail."/>
73 <antcall target="-run-one">
74 <param name="version" value="api1.0"/>
75 <param name="target" value="api2.0"/>
77 <echo level="info" message="Final success1: Running the Implementation Compiled against Version 1.0 with Merged Version."/>
78 <antcall target="-run-one">
79 <param name="version" value="apimerge"/>
80 <param name="target" value="api1.0"/>
82 <echo level="info" message="Final success2: Running the Implementation Compiled against Version 2.0 with Merged Version."/>
83 <antcall target="-run-one">
84 <param name="version" value="apimerge"/>
85 <param name="target" value="api2.0"/>
90 <!-- support methods -->
92 <target name="-run-one">
93 <fail message="You need to specify API version number" unless="version"/>
94 <property name="target" value="${version}"/>
95 <java classpath="build/${version}/classes:build/impl-with-${target}/classes" classname="impl.Impl"
100 <target name="-build-one">
101 <fail message="You need to specify version number" unless="version"/>
103 <property name="cp" value=""/>
104 <property name="target" value="${version}"/>
105 <mkdir dir="build/${target}/classes"/>
107 srcdir="src-${version}"
108 destdir="build/${target}/classes"
109 source="1.4" target="1.4"