author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:55:03 +0200 | |
changeset 123 | 920e95b47036 |
parent 119 | 8147cafd007a |
child 124 | 6270b19ab8db |
permissions | -rw-r--r-- |
jtulach@10 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
jtulach@10 | 2 |
<project name="differentreturntype" default="run" basedir="."> |
jtulach@10 | 3 |
<target name="clean"> |
jtulach@10 | 4 |
<delete dir="build"/> |
jtulach@10 | 5 |
</target> |
jtulach@10 | 6 |
|
jtulach@11 | 7 |
<!-- BEGIN: theory.binary.differentreturntype.ant --> |
jtulach@10 | 8 |
<!-- This is the target that does the whole trick - e,g. it compiles |
jtulach@10 | 9 |
the Java source and then replaces tokens inside of the .class file |
jtulach@10 | 10 |
--> |
jtulach@10 | 11 |
<target name="-build-and-rename"> |
jtulach@10 | 12 |
<mkdir dir="build/apimerge/classes"/> |
jtulach@11 | 13 |
<javac srcdir="src-apimerge" destdir="build/apimerge/classes" source="1.4" target="1.4" classpath="${cp}"/> |
jtulach@10 | 14 |
|
jtulach@10 | 15 |
<!-- this is the replace. As the replace is done textually, |
jtulach@10 | 16 |
we need to use some reasonable encoding that treats all byte values |
jtulach@10 | 17 |
as characters. E.g. it is not possible to use UTF-8 as it does not |
jtulach@10 | 18 |
like the standard Java header 0xCAFEBABE. Western Europe encoding is fine |
jtulach@10 | 19 |
--> |
jtulach@10 | 20 |
<replace dir="build/apimerge/classes" casesensitive="true" encoding="iso-8859-1" summary="true"> |
jtulach@10 | 21 |
<include name="**/*.class"/> |
jtulach@10 | 22 |
<replacetoken>g3tIcon</replacetoken> |
jtulach@10 | 23 |
<replacevalue>getIcon</replacevalue> |
jtulach@10 | 24 |
</replace> |
jtulach@10 | 25 |
</target> |
jtulach@11 | 26 |
<!-- END: theory.binary.differentreturntype.ant --> |
jtulach@10 | 27 |
|
jtulach@10 | 28 |
<target name="build" depends="clean"> |
jtulach@10 | 29 |
<antcall target="-build-one"> |
jtulach@10 | 30 |
<param name="version" value="api1.0"/> |
jtulach@10 | 31 |
</antcall> |
jtulach@10 | 32 |
<antcall target="-build-one"> |
jtulach@10 | 33 |
<param name="version" value="api2.0"/> |
jtulach@10 | 34 |
</antcall> |
jtulach@10 | 35 |
<antcall target="-build-and-rename"/> |
jtulach@10 | 36 |
<antcall target="-build-one"> |
jtulach@10 | 37 |
<param name="version" value="impl"/> |
jtulach@10 | 38 |
<param name="target" value="impl-with-api1.0"/> |
jtulach@10 | 39 |
<param name="cp" location="build/api1.0/classes"/> |
jtulach@10 | 40 |
</antcall> |
jtulach@10 | 41 |
<antcall target="-build-one"> |
jtulach@10 | 42 |
<param name="version" value="impl"/> |
jtulach@10 | 43 |
<param name="target" value="impl-with-api2.0"/> |
jtulach@10 | 44 |
<param name="cp" location="build/api2.0/classes"/> |
jtulach@10 | 45 |
</antcall> |
jtulach@10 | 46 |
</target> |
jtulach@10 | 47 |
|
jtulach@10 | 48 |
<target name="run" depends="build"> |
jtulach@10 | 49 |
<echo level="info" message="Running the Implementation Compiled against Version 1.0 with Version 1.0. This should succeeds."/> |
jtulach@10 | 50 |
<antcall target="-run-one"> |
jtulach@10 | 51 |
<param name="version" value="api1.0"/> |
jtulach@10 | 52 |
</antcall> |
jtulach@10 | 53 |
<echo level="info" message="Running the Implementation Compiled against Version 2.0 with Version 2.0. This should succeeds."/> |
jtulach@10 | 54 |
<antcall target="-run-one"> |
jtulach@10 | 55 |
<param name="version" value="api2.0"/> |
jtulach@10 | 56 |
</antcall> |
jtulach@10 | 57 |
<echo level="info" message="Running the Implementation Compiled against Version 1.0 with Version 2.0. This should fail."/> |
jtulach@10 | 58 |
<antcall target="-run-one"> |
jtulach@10 | 59 |
<param name="version" value="api2.0"/> |
jtulach@10 | 60 |
<param name="target" value="api1.0"/> |
jtulach@10 | 61 |
</antcall> |
jtulach@10 | 62 |
<echo level="info" message="Running the Implementation Compiled against Version 2.0 with Version 1.0. This should fail."/> |
jtulach@10 | 63 |
<antcall target="-run-one"> |
jtulach@10 | 64 |
<param name="version" value="api1.0"/> |
jtulach@10 | 65 |
<param name="target" value="api2.0"/> |
jtulach@10 | 66 |
</antcall> |
jtulach@10 | 67 |
<echo level="info" message="Final success1: Running the Implementation Compiled against Version 1.0 with Merged Version."/> |
jtulach@10 | 68 |
<antcall target="-run-one"> |
jtulach@10 | 69 |
<param name="version" value="apimerge"/> |
jtulach@10 | 70 |
<param name="target" value="api1.0"/> |
jtulach@10 | 71 |
</antcall> |
jtulach@10 | 72 |
<echo level="info" message="Final success2: Running the Implementation Compiled against Version 2.0 with Merged Version."/> |
jtulach@10 | 73 |
<antcall target="-run-one"> |
jtulach@10 | 74 |
<param name="version" value="apimerge"/> |
jtulach@10 | 75 |
<param name="target" value="api2.0"/> |
jtulach@10 | 76 |
</antcall> |
jtulach@10 | 77 |
</target> |
jtulach@10 | 78 |
|
jtulach@10 | 79 |
|
jtulach@10 | 80 |
<!-- support methods --> |
jtulach@10 | 81 |
|
jtulach@10 | 82 |
<target name="-run-one"> |
jtulach@10 | 83 |
<fail message="You need to specify API version number" unless="version"/> |
jtulach@10 | 84 |
<property name="target" value="${version}"/> |
jtulach@10 | 85 |
<java classpath="build/${version}/classes:build/impl-with-${target}/classes" classname="impl.Impl" |
jtulach@10 | 86 |
failonerror="false" |
jtulach@10 | 87 |
/> |
jtulach@10 | 88 |
</target> |
jtulach@10 | 89 |
|
jtulach@10 | 90 |
<target name="-build-one"> |
jtulach@10 | 91 |
<fail message="You need to specify version number" unless="version"/> |
jtulach@10 | 92 |
|
jtulach@10 | 93 |
<property name="cp" value=""/> |
jtulach@10 | 94 |
<property name="target" value="${version}"/> |
jtulach@10 | 95 |
<mkdir dir="build/${target}/classes"/> |
jtulach@10 | 96 |
<javac |
jtulach@10 | 97 |
srcdir="src-${version}" |
jtulach@10 | 98 |
destdir="build/${target}/classes" |
jtulach@10 | 99 |
source="1.4" target="1.4" |
jtulach@10 | 100 |
classpath="${cp}" |
jtulach@10 | 101 |
/> |
jtulach@10 | 102 |
</target> |
jtulach@10 | 103 |
</project> |