0
|
1 <?xml version="1.0" encoding="UTF-8"?>
|
|
2 <!-- vim: set ts=4 sw=4 et: -->
|
|
3 <project name="tests" default="help">
|
|
4
|
|
5 <!-- The local.properties file is created and updated by the 'android' tool.
|
|
6 It contains the path to the SDK. It should *NOT* be checked into
|
|
7 Version Control Systems. -->
|
|
8 <loadproperties srcFile="local.properties" />
|
|
9
|
|
10 <!-- The ant.properties file can be created by you. It is only edited by the
|
|
11 'android' tool to add properties to it.
|
|
12 This is the place to change some Ant specific build properties.
|
|
13 Here are some properties you may want to change/update:
|
|
14
|
|
15 source.dir
|
|
16 The name of the source directory. Default is 'src'.
|
|
17 out.dir
|
|
18 The name of the output directory. Default is 'bin'.
|
|
19
|
|
20 For other overridable properties, look at the beginning of the rules
|
|
21 files in the SDK, at tools/ant/build.xml
|
|
22
|
|
23 Properties related to the SDK location or the project target should
|
|
24 be updated using the 'android' tool with the 'update' action.
|
|
25
|
|
26 This file is an integral part of the build system for your
|
|
27 application and should be checked into Version Control Systems.
|
|
28
|
|
29 -->
|
|
30 <property file="ant.properties" />
|
|
31
|
|
32 <!-- The project.properties file is created and updated by the 'android'
|
|
33 tool, as well as ADT.
|
|
34
|
|
35 This contains project specific properties such as project target, and library
|
|
36 dependencies. Lower level build properties are stored in ant.properties
|
|
37 (or in .classpath for Eclipse projects).
|
|
38
|
|
39 This file is an integral part of the build system for your
|
|
40 application and should be checked into Version Control Systems. -->
|
|
41 <loadproperties srcFile="project.properties" />
|
|
42
|
|
43 <!-- quick check on sdk.dir -->
|
|
44 <fail
|
|
45 message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
|
46 unless="sdk.dir"
|
|
47 />
|
|
48
|
|
49
|
|
50 <!-- extension targets. Uncomment the ones where you want to do custom work
|
|
51 in between standard targets -->
|
|
52 <!--
|
|
53 <target name="-pre-build">
|
|
54 </target>
|
|
55 <target name="-pre-compile">
|
|
56 </target>
|
|
57
|
|
58 /* This is typically used for code obfuscation.
|
|
59 Compiled code location: ${out.classes.absolute.dir}
|
|
60 If this is not done in place, override ${out.dex.input.absolute.dir} */
|
|
61 <target name="-post-compile">
|
|
62 </target>
|
|
63 -->
|
|
64
|
|
65 <!-- Import the actual build file.
|
|
66
|
|
67 To customize existing targets, there are two options:
|
|
68 - Customize only one target:
|
|
69 - copy/paste the target into this file, *before* the
|
|
70 <import> task.
|
|
71 - customize it to your needs.
|
|
72 - Customize the whole content of build.xml
|
|
73 - copy/paste the content of the rules files (minus the top node)
|
|
74 into this file, replacing the <import> task.
|
|
75 - customize to your needs.
|
|
76
|
|
77 ***********************
|
|
78 ****** IMPORTANT ******
|
|
79 ***********************
|
|
80 In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
81 in order to avoid having your file be overridden by tools such as "android update project"
|
|
82 -->
|
|
83 <!-- version-tag: custom -->
|
|
84 <import file="${sdk.dir}/tools/ant/build.xml" />
|
|
85
|
|
86 <target name="coverage-xml" depends="-test-project-check">
|
|
87
|
|
88 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
|
|
89
|
|
90 <property name="test.runner" value="android.test.InstrumentationTestRunner" />
|
|
91
|
|
92 <!-- Application package of the tested project extracted from its manifest file -->
|
|
93 <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
|
|
94 expression="/manifest/@package" output="tested.manifest.package" />
|
|
95
|
|
96 <getprojectpaths projectPath="${tested.project.absolute.dir}"
|
|
97 binOut="tested.project.out.absolute.dir"
|
|
98 srcOut="tested.project.source.absolute.dir" />
|
|
99
|
|
100 <getlibpath projectPath="${tested.project.absolute.dir}"
|
|
101 libraryFolderPathOut="tested.project.lib.source.path"
|
|
102 leaf="@{source.dir}" />
|
|
103
|
|
104 <property name="emma.dump.file"
|
|
105 value="/data/data/${tested.manifest.package}/coverage.ec" />
|
|
106
|
|
107 <run-tests-helper emma.enabled="true">
|
|
108 <extra-instrument-args>
|
|
109 <arg value="-e" />
|
|
110 <arg value="coverageFile" />
|
|
111 <arg value="${emma.dump.file}" />
|
|
112 </extra-instrument-args>
|
|
113 </run-tests-helper>
|
|
114 <echo>Downloading coverage file into project directory...</echo>
|
|
115 <exec executable="${adb}" failonerror="true">
|
|
116 <arg line="${adb.device.arg}" />
|
|
117 <arg value="pull" />
|
|
118 <arg value="${emma.dump.file}" />
|
|
119 <arg value="${out.absolute.dir}/coverage.ec" />
|
|
120 </exec>
|
|
121 <echo>Extracting XML coverage report...</echo>
|
|
122 <emma>
|
|
123 <report sourcepath="${tested.project.source.absolute.dir}:${tested.project.lib.source.path.value}"
|
|
124 verbosity="${verbosity}">
|
|
125 <!-- TODO: report.dir or something like should be introduced if necessary -->
|
|
126 <infileset file="${out.absolute.dir}/coverage.ec" />
|
|
127 <infileset file="${tested.project.out.absolute.dir}/coverage.em" />
|
|
128 <!-- TODO: reports in other, indicated by user formats -->
|
|
129 <xml outfile="${out.absolute.dir}/coverage.xml" />
|
|
130 </report>
|
|
131 </emma>
|
|
132 <echo level="info">Cleaning up temporary files...</echo>
|
|
133 <delete file="${out.absolute.dir}/coverage.ec" />
|
|
134 <delete file="${out.absolute.dir}/coverage.em" />
|
|
135 <echo level="info">Saving the report file in ${out.absolute.dir}/coverage.xml</echo>
|
|
136 </target>
|
|
137
|
|
138 </project>
|