1<project>
2  <property file="ant-${opencv.build.type}.properties"/>
3  <property name="test.dir" value="testResults"/>
4  <property name="build.dir" value="build"/>
5
6  <path id="master-classpath">
7    <fileset dir="lib">
8      <include name="*.jar"/>
9    </fileset>
10    <fileset dir="bin">
11      <include name="*.jar"/>
12    </fileset>
13  </path>
14
15  <target name="clean">
16    <delete dir="build"/>
17    <delete dir="${test.dir}"/>
18  </target>
19
20  <target name="compile">
21    <mkdir dir="build/classes"/>
22
23    <javac sourcepath="" srcdir="src" destdir="build/classes" includeantruntime="false" >
24      <include name="**/*.java"/>
25      <classpath refid="master-classpath"/>
26    </javac>
27  </target>
28
29  <target name="jar">
30    <mkdir dir="build/jar"/>
31    <jar destfile="build/jar/opencv-test.jar" basedir="build/classes">
32      <manifest>
33        <attribute name="Main-Class" value="org.opencv.test.OpenCVTestRunner"/>
34      </manifest>
35    </jar>
36  </target>
37
38  <target name="test">
39    <mkdir dir="${test.dir}"/>
40    <junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
41      <sysproperty key="java.library.path" path="${opencv.lib.path}"/>
42      <env key="PATH" path="${opencv.lib.path}"/>
43      <classpath refid="master-classpath"/>
44      <classpath>
45        <pathelement location="build/classes"/>
46      </classpath>
47
48      <formatter type="xml"/>
49
50      <batchtest fork="yes" todir="${test.dir}">
51        <zipfileset src="build/jar/opencv-test.jar" includes="**/*.class" excludes="**/OpenCVTest*">
52          <exclude name="**/*$*.class"/>
53        </zipfileset>
54      </batchtest>
55    </junit>
56    <junitreport todir="${test.dir}">
57      <fileset dir="${test.dir}">
58        <include name="TEST-*.xml"/>
59      </fileset>
60      <report format="noframes" todir="${test.dir}"/>
61    </junitreport>
62  </target>
63
64  <target name="build">
65    <antcall target="compile"/>
66    <antcall target="jar"/>
67  </target>
68
69  <target name="buildAndTest">
70    <antcall target="compile"/>
71    <antcall target="jar"/>
72    <antcall target="test"/>
73  </target>
74</project>
75