forked from priyaaank/RobolectricSample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
150 lines (124 loc) · 6.87 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0" encoding="UTF-8"?>
<project name="RoblectricSample" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked in in Version
Control Systems. -->
<property file="local.properties"/>
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the default property values
used by the Ant rules.
Here are some properties you may want to change/update:
application.package
the name of your application package as defined in the manifest. Used by the
'uninstall' rule.
source.dir
the name of the source directory. Default is 'src'.
out.dir
the name of the output directory. Default is 'bin'.
Properties related to the SDK location or the project target should be updated
using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems.
-->
<property file="build.properties"/>
<property name="external.libs.dir" value="${robolectric.sample.external.libs.dir}" />
<property name="jar.libs.dir" value="${robolectric.sample.external.libs.dir}" />
<!-- The default.properties file is created and updated by the 'android' tool, as well
as ADT.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems. -->
<property file="default.properties"/>
<!-- Custom Android task to deal with the project target, and import the proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk.dir}/tools/lib/anttasks.jar"/>
<pathelement path="${sdk.dir}/tools/lib/sdklib.jar"/>
<pathelement path="${sdk.dir}/tools/lib/androidprefs.jar"/>
<pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar"/>
<pathelement path="${sdk.dir}/tools/lib/jarutils.jar"/>
</path>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>
<!-- Execute the Android Setup task that will setup some properties specific to the target,
and import the build rules files.
The rules file is imported from
<SDK>/platforms/<target_platform>/templates/android_rules.xml
To customize some build steps for your project:
- copy the content of the main node <project> from android_rules.xml
- paste it in this build.xml below the <setup /> task.
- disable the import by changing the setup task below to <setup import="false" />
This will ensure that the properties are setup correctly but that your customized
build steps are used.
-->
<setup/>
<property name="test.absolute.dir" location="${test.dir}"/>
<property name="out.test-classes.dir" value="${out.absolute.dir}/testClasses"/>
<property name="out.test-classes.absolute.dir" value="${out.test-classes.dir}"/>
<property name="test.external.libs.absolute.dir" location="${test.external.libs.dir}"/>
<property name="publish.dir" location="${out.absolute.dir}/publish"/>
<property environment="env"/>
<condition property="build.number" value="${env.BUILD_NUMBER}" else="unknown">
<isset property="env.BUILD_NUMBER"/>
</condition>
<exec executable="date" outputproperty="build.date"/>
<target name="compile.tests" depends="compile"
description="compile module source; test classes" unless="skip.tests">
<mkdir dir="${out.test-classes.absolute.dir}"/>
<javac encoding="ascii" source="1.6" target="1.6" debug="true" extdirs=""
destdir="${out.test-classes.absolute.dir}"
verbose="${verbose}" classpath="${robolectric.sample.external.libs.dir}">
<src path="${test.absolute.dir}"/>
<classpath>
<pathelement path="${out.classes.absolute.dir}"/>
<path refid="android.target.classpath"/>
<fileset dir="${test.external.libs.absolute.dir}" includes="*.jar"/>
<fileset dir="${robolectric.sample.external.libs.dir}" includes="*.jar"/>
</classpath>
</javac>
</target>
<target name="clean" depends="android_rules.clean" description="cleanup module">
<delete dir="${out.test-classes.absolute.dir}"/>
<delete dir="${tmp.dir}"/>
</target>
<target name="test" depends="compile.tests" description="test all">
<mkdir dir="${basedir}/out/reports/tests"/>
<junit showoutput="true" failureproperty="junit.failure">
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="${basedir}/out/reports/tests">
<fileset dir="${test.absolute.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
<classpath>
<pathelement path="${out.classes.absolute.dir}"/>
<pathelement path="${out.test-classes.absolute.dir}"/>
<fileset dir="${test.external.libs.absolute.dir}" includes="*.jar"/>
<fileset dir="${robolectric.sample.external.libs.dir}" includes="*.jar"/>
<path refid="android.target.classpath"/>
</classpath>
</junit>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
<target name="maven-setup" depends="maven-set-android-sdk, maven-install-jars" description="Set the path to the Android SDK and install jars"/>
<target name="maven-install-jars" description="Install the jar files that Maven can't find for itself">
<exec executable="mvn">
<arg line="install:install-file -DgroupId=com.google.inject -DartifactId=guice -Dversion=2.0 -Dclassifier=no-aop -Dpackaging=jar -Dfile=lib/main/guice-2.0-no_aop.jar" />
</exec>
<exec executable="mvn">
<arg line="install:install-file -DgroupId=com.google.android.maps -DartifactId=maps -Dversion=8_r2 -Dpackaging=jar -Dfile=${sdk.dir}/add-ons/addon_google_apis_google_inc_8/libs/maps.jar" />
</exec>
</target>
<target name="maven-set-android-sdk" description="Set the path to the Android SDK in the pom.xml file">
<copy file="pom.xml" tofile="pom.xml.tmp">
<filterchain>
<tokenfilter>
<replacestring from="<!--<path></path>-->" to="<path>${sdk.dir}</path>"/>
</tokenfilter>
</filterchain>
</copy>
<copy file="pom.xml.tmp" tofile="pom.xml"/>
<delete file="pom.xml.tmp"/>
</target>
</project>