-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.xml
85 lines (73 loc) · 2.77 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<project name="AndroidProjectTest" default="test-report-junit" basedir=".">
<description>
Android-Project-Test - Robolectric Tests for Android Application
</description>
<!-- set global properties for this build -->
<property name="libs.dir" value="./libs/"/>
<property name="build.dir" value="./build/"/>
<property name="android.project.classpath" value="../android-project/bin/classes/"/>
<property name="test.report.dir" value="./test-reports/"/>
<property name="test.html.dir" value="./test-report-html/"/>
<property name="source.dir" value="./src/"/>
<filelist id="android_jars" dir="${libs.dir}">
<file name="android.jar"/>
<file name="maps.jar"/>
</filelist>
<filelist id="libs_jars" dir="${libs.dir}">
<file name="junit.jar"/>
<file name="hamcrest.jar"/>
<file name="robolectric-with-dependencies.jar"/>
</filelist>
<path id="compile_classpath">
<filelist refid="libs_jars"/>
<filelist refid="android_jars"/>
<pathelement path="${android.project.classpath}"/>
<pathelement path="${build.dir}"/>
</path>
<path id="junit_classpath">
<pathelement path="${build.dir}"/>
<pathelement path="${android.project.classpath}"/>
<!-- NOTE: junit.jar must come before android.jar! -->
<filelist refid="libs_jars"/>
<filelist refid="android_jars"/>
</path>
<!-- targets -->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" depends="init" description="compile test source">
<javac srcdir="${source.dir}" destdir="${build.dir}" debug="true" >
<classpath refid="compile_classpath" />
</javac>
</target>
<target name="test-run" depends="compile" description="Run JUnit tests">
<mkdir dir="${test.report.dir}"/>
<echo message="Running JUnit Tests in directory ${source.dir}..."/>
<junit showoutput="true" printsummary="yes" failureproperty="junit.failure" fork="yes" forkmode="once" maxmemory="512m">
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="${test.report.dir}">
<fileset dir="${source.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
<classpath refid="junit_classpath"/>
</junit>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
<target name="test-report-junit" depends="test-run" description="Generate JUnit HTML reports">
<mkdir dir="${test.html.dir}"/>
<junitreport todir="${test.report.dir}">
<fileset dir="${test.report.dir}" includes="TEST-*.xml"/>
<report format="frames" todir="${test.html.dir}"/>
</junitreport>
</target>
<target name="clean" description="Clean Up" >
<delete dir="${build.dir}"/>
<delete dir="${test.report.dir}"/>
<delete dir="${test.html.dir}"/>
<delete file="${basedir}/tmp/cached-robolectric-classes.jar"/>
</target>
</project>