Incorporating Patrick's changes. I am not reall sure about the changes after the war, it is really 'or' it cannot be 'and'. I will change that when I do the reading through the whole chapter.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="Build Script" default="test" basedir=".">
7 <target name="compile" depends="build"/>
8 <target name="build" depends="-libraries">
9 <antcall target="-build-one">
10 <param name="version" value="api1.0"/>
12 <antcall target="-build-one">
13 <param name="version" value="api2.0"/>
15 <antcall target="-build-one">
16 <param name="version" value="api2.0-compat"/>
18 <antcall target="-build-one">
19 <param name="version" value="api2.0-property"/>
21 <antcall target="-build-one">
22 <param name="version" value="api2.0-enum"/>
24 <antcall target="-build-one">
25 <param name="version" value="api2.0-runtime"/>
28 <antcall target="-build-one">
29 <param name="version" value="test"/>
30 <param name="cp" value="build/api1.0/classes:${junit.jar}"/>
34 <target name="test" depends="build">
35 <echo level="info" message="Running the Implementation against Version 1.0 of the API. This should succeeds."/>
36 <antcall target="-run-one">
37 <param name="version" value="api1.0"/>
39 <echo level="info" message="Running the Implementation against Version 2.0 of the API. This should fail."/>
40 <antcall target="-run-one">
41 <param name="version" value="api2.0"/>
43 <echo level="info" message="Running the Implementation against Version 2.0 with compatible extension of the API. This should succeed."/>
44 <antcall target="-run-one">
45 <param name="version" value="api2.0-compat"/>
47 <echo level="info" message="Running the Implementation against Version 2.0 with property guarded extension of the API. This should succeed."/>
48 <antcall target="-run-one">
49 <param name="version" value="api2.0-property"/>
51 <echo level="info" message="Running the Implementation against Version 2.0 with enum guarded extension of the API. This should succeed."/>
52 <antcall target="-run-one">
53 <param name="version" value="api2.0-enum"/>
55 <echo level="info" message="Running the Implementation against Version 2.0 with runtime check in the API. This should succeed."/>
56 <antcall target="-run-one">
57 <param name="version" value="api2.0-runtime"/>
61 <!-- support methods -->
63 <target name="-libraries">
66 <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
69 <target name="-run-one">
70 <fail message="You need to specify API version number" unless="version"/>
71 <mkdir dir="build/testresults"/>
72 <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
73 <batchtest todir="build/testresults">
74 <fileset dir="build/test/classes">
75 <filename name="**/*Test.class"/>
79 <path location="build/${version}/classes"/>
80 <path location="build/test/classes"/>
81 <path location="${junit.jar}"/>
83 <formatter type="brief" usefile="false"/>
84 <formatter type="xml"/>
88 <target name="-build-one">
89 <fail message="You need to specify version number" unless="version"/>
91 <mkdir dir="build/${version}/classes"/>
92 <property name="cp" value=""/>
94 srcdir="src-${version}"
95 destdir="build/${version}/classes"
96 source="1.5" target="1.5"