1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/build.xml Sat Jun 14 09:52:48 2008 +0200
1.3 @@ -0,0 +1,97 @@
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 + <javac destdir="build/tests" srcdir="test">
1.19 + <classpath>
1.20 + <pathelement location="${apiA}"/>
1.21 + <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
1.22 + </classpath>
1.23 + </javac>
1.24 + </target>
1.25 +
1.26 + <target name="run" depends="-run-binary-check,-run-source-check">
1.27 + <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.28 + <condition>
1.29 + <not><or>
1.30 + <isset property="execution.failed"/>
1.31 + <isset property="compilation.failed"/>
1.32 + </or></not>
1.33 + </condition>
1.34 + </fail>
1.35 + </target>
1.36 +
1.37 + <target name="-run-binary-check" depends="compile">
1.38 + <mkdir dir="build/testresultA"/>
1.39 + <junit dir="build/tests" failureproperty="run.on.A.shall.succeed">
1.40 + <batchtest todir="build/testresultA">
1.41 + <fileset dir="test" includes="**/*.java"/>
1.42 + </batchtest>
1.43 + <formatter type="brief" usefile="false"/>
1.44 + <formatter type="xml"/>
1.45 + <classpath>
1.46 + <pathelement location="${apiA}"/>
1.47 + <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
1.48 + <pathelement location="build/tests"/>
1.49 + </classpath>
1.50 + </junit>
1.51 +
1.52 + <mkdir dir="build/testresultB"/>
1.53 + <junit dir="build/tests" failureproperty="run.on.B.shall.fail">
1.54 + <batchtest todir="build/testresultB">
1.55 + <fileset dir="test" includes="**/*.java"/>
1.56 + </batchtest>
1.57 + <formatter type="brief" usefile="false"/>
1.58 + <formatter type="xml"/>
1.59 + <classpath>
1.60 + <pathelement location="${apiB}"/>
1.61 + <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
1.62 + <pathelement location="build/tests"/>
1.63 + </classpath>
1.64 + </junit>
1.65 +
1.66 + <condition property="execution.failed">
1.67 + <and>
1.68 + <isset property="run.on.B.shall.fail"/>
1.69 + <not><isset property="run.on.A.shall.succeed"/></not>
1.70 + </and>
1.71 + </condition>
1.72 + </target>
1.73 +
1.74 + <target name="-run-source-check" depends="compile" unless="execution.failed">
1.75 +
1.76 + <property name="build.b" location="build/verifyitbuildsagainstB"/>
1.77 + <delete dir="${build.b}"/>
1.78 + <mkdir dir="${build.b}"/>
1.79 + <javac destdir="${build.b}" srcdir="test" failonerror="false">
1.80 + <classpath>
1.81 + <pathelement location="${apiB}"/>
1.82 + <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
1.83 + </classpath>
1.84 + </javac>
1.85 +
1.86 +
1.87 + <uptodate property="compilation.failed">
1.88 + <srcfiles dir="${build.b}" includes="**/*.class"/>
1.89 + <mapper type="glob" from="*" to="build/tests/*"/>
1.90 + </uptodate>
1.91 +
1.92 +
1.93 + </target>
1.94 +
1.95 + <target name="test" depends="run"/>
1.96 +
1.97 + <target name="clean">
1.98 + <delete dir="build"/>
1.99 + </target>
1.100 +</project>