1<project name="osgi-test" default="testAll"> 2 3 <!-- 4 This build file is usually run indirectly via Maven. 5 6 When running this build file through Ant directly, you must 7 define the currentVersion property on the command line, e.g.: 8 9 ant -DcurrentVersion=1.5.4-SNAPSHOT 10 --> 11 12 <echo message="compile classpath: ${currentVersion}" /> 13 <echo message="test classpath: ${test_classpath}" /> 14 <echo message="basedir: ${basedir}" /> 15 16 <property name="iBundleJar" value="target/iBundle.jar"/> 17 <property name="bundlesDir" value="bundle"/> 18 19 20 <!-- this is really very ugly, but it's the only way to circumvent 21 http://jira.codehaus.org/browse/MANTRUN-95 22 --> 23 <taskdef name="junit" classpath="${test_classpath}" 24 classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" /> 25 26 <path id="minimal"> 27 <pathelement location="target/test-classes/" /> 28 </path > 29 30 <target name="init"> 31 <mkdir dir="target/unit-reports" /> 32 </target> 33 34 <target name="createIBundle"> 35 <mkdir dir="${bundlesDir}"/> 36 <jar destFile="${iBundleJar}" 37 manifest="src/IBUNDLE-META-INF/MANIFEST.MF" 38 basedir="target/test-classes/" 39 includes="integrator/**.class"/> 40 41 </target> 42 43 <target name="testAll" depends="init, createIBundle, nop, simple, jdk14"> 44 </target> 45 46 47 <macrodef name="prepareOSGiHarness"> 48 <attribute name="binding"/> 49 <sequential> 50 <delete> 51 <fileset dir="${bundlesDir}" includes="*.jar"/> 52 </delete> 53 <copy file="${iBundleJar}" todir="${bundlesDir}"/> 54 <copy file="../slf4j-api/target/slf4j-api-${currentVersion}.jar" todir="${bundlesDir}"/> 55 <copy file="../slf4j-@{binding}/target/slf4j-@{binding}-${currentVersion}.jar" todir="${bundlesDir}"/> 56 <echo>value of t = @{t}</echo> 57 </sequential> 58 </macrodef> 59 60 61 <!-- for some reason if mvn is invoked from the parent directory, junit gets 62 invoked from the parent dir, which messes up theses tests. Hence, the 63 fork="yes" dir="${basedir}" --> 64 65 <target name="nop"> 66 <prepareOSGiHarness binding="nop"/> 67 <junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes"> 68 <classpath path="${test_classpath}"/> 69 <formatter type="plain" /> 70 <test fork="yes" todir="target/unit-reports" name="org.slf4j.test_osgi.BundleTest" /> 71 </junit> 72 </target> 73 74 <target name="simple"> 75 <prepareOSGiHarness binding="simple"/> 76 <junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes"> 77 <classpath path="${test_classpath}"/> 78 <formatter type="plain" /> 79 <test fork="yes" todir="target/unit-reports" name="org.slf4j.test_osgi.BundleTest" /> 80 </junit> 81 </target> 82 83 <target name="jdk14"> 84 <prepareOSGiHarness binding="jdk14"/> 85 <junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes"> 86 <classpath path="${test_classpath}"/> 87 <formatter type="plain" /> 88 <test fork="yes" todir="target/unit-reports" name="org.slf4j.test_osgi.BundleTest" /> 89 </junit> 90 </target> 91 92</project>