1.1 --- a/samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/build.xml Sat Jun 14 09:52:49 2008 +0200
1.2 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/build.xml Sat Jun 14 09:52:52 2008 +0200
1.3 @@ -1,104 +1,5 @@
1.4 <?xml version="1.0" encoding="UTF-8"?>
1.5 <!-- this is a template file to test -->
1.6 <project name="testing-template" default="run" basedir=".">
1.7 - <description>Builds the test against first version and runs them against two</description>
1.8 -
1.9 - <loadproperties srcfile="project.properties"/>
1.10 -
1.11 - <target name="make-sure-projects-are-compiled">
1.12 - <ant dir="${dayA}/${apitotest}" target="compile"/>
1.13 - <ant dir="${dayB}/${apitotest}" target="compile"/>
1.14 - </target>
1.15 -
1.16 - <target name="compile" depends="make-sure-projects-are-compiled">
1.17 - <mkdir dir="build/tests"/>
1.18 - <echo level="info" message="Compiling the tests against old version of the API"/>
1.19 - <javac destdir="build/tests" srcdir="test">
1.20 - <classpath>
1.21 - <pathelement location="${apiA}"/>
1.22 - <pathelement location="${junit.jar}"/>
1.23 - </classpath>
1.24 - </javac>
1.25 - </target>
1.26 -
1.27 - <target name="run" depends="-run-binary-check,-run-source-check">
1.28 - <fail message="The test shall either compile against A and not B or run on A and fail on B, nothing like that happened">
1.29 - <condition>
1.30 - <not><or>
1.31 - <isset property="execution.failed"/>
1.32 - <isset property="compilation.failed"/>
1.33 - </or></not>
1.34 - </condition>
1.35 - </fail>
1.36 - </target>
1.37 -
1.38 - <target name="-run-binary-check" depends="compile">
1.39 - <mkdir dir="build/testresultA"/>
1.40 -
1.41 - <echo level="info" message="Running the tests against old version of the API"/>
1.42 - <junit dir="build/tests" failureproperty="run.on.A.shall.succeed" fork="true">
1.43 - <batchtest todir="build/testresultA">
1.44 - <fileset dir="test" includes="**/*.java"/>
1.45 - </batchtest>
1.46 - <formatter type="brief" usefile="false"/>
1.47 - <formatter type="xml"/>
1.48 - <classpath>
1.49 - <pathelement location="${apiA}"/>
1.50 - <pathelement location="${junit.jar}"/>
1.51 - <pathelement location="build/tests"/>
1.52 - </classpath>
1.53 - </junit>
1.54 -
1.55 - <mkdir dir="build/testresultB"/>
1.56 - <echo level="info" message="Running the same tests against new version of the API, this should fail, if there is binary or functional incompatibility"/>
1.57 - <junit dir="build/tests" failureproperty="run.on.B.shall.fail" fork="true">
1.58 - <batchtest todir="build/testresultB">
1.59 - <fileset dir="test" includes="**/*.java"/>
1.60 - </batchtest>
1.61 - <formatter type="brief" usefile="false"/>
1.62 - <formatter type="xml"/>
1.63 - <classpath>
1.64 - <pathelement location="${apiB}"/>
1.65 - <pathelement location="${junit.jar}"/>
1.66 - <pathelement location="build/tests"/>
1.67 - </classpath>
1.68 - </junit>
1.69 -
1.70 - <condition property="execution.failed">
1.71 - <and>
1.72 - <isset property="run.on.B.shall.fail"/>
1.73 - <not><isset property="run.on.A.shall.succeed"/></not>
1.74 - </and>
1.75 - </condition>
1.76 - </target>
1.77 -
1.78 - <target name="-run-source-check" depends="compile" unless="execution.failed">
1.79 -
1.80 - <property name="build.b" location="build/verifyitbuildsagainstB"/>
1.81 - <delete dir="${build.b}"/>
1.82 - <mkdir dir="${build.b}"/>
1.83 -
1.84 -
1.85 - <echo level="info" message="Verifying source compatibility: Compiling the tests against new version of the API"/>
1.86 - <javac destdir="${build.b}" srcdir="test" failonerror="false" fork="true">
1.87 - <classpath>
1.88 - <pathelement location="${apiB}"/>
1.89 - <pathelement location="${junit.jar}"/>
1.90 - </classpath>
1.91 - </javac>
1.92 -
1.93 -
1.94 - <uptodate property="compilation.failed">
1.95 - <srcfiles dir="${build.b}" includes="**/*.class"/>
1.96 - <mapper type="glob" from="*" to="build/tests/*"/>
1.97 - </uptodate>
1.98 -
1.99 -
1.100 - </target>
1.101 -
1.102 - <target name="test" depends="run"/>
1.103 -
1.104 - <target name="clean">
1.105 - <delete dir="build"/>
1.106 - </target>
1.107 + <import file="../../common.xml"/>
1.108 </project>