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