aboutsummaryrefslogtreecommitdiffstats
path: root/files/ant
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2012-06-15 16:15:06 -0700
committerXavier Ducrohet <xav@android.com>2012-06-15 16:26:31 -0700
commitaaeb6a3d58ce5dccc91360bb429b5e37af650619 (patch)
treeda6b77dd015773a6c9d4da12d3c07c93d15acc4d /files/ant
parentfcb82e3185d657e3b5440295478cdc58afd168c3 (diff)
downloadsdk-aaeb6a3d58ce5dccc91360bb429b5e37af650619.zip
sdk-aaeb6a3d58ce5dccc91360bb429b5e37af650619.tar.gz
sdk-aaeb6a3d58ce5dccc91360bb429b5e37af650619.tar.bz2
Fix issue where libraries were not getting instrumented.
They actually were instrumented but the emma output file was not passed to the report task. After trying to make each library generate its own .em file and passing to the report task, I gave up due to FileSet (and the report task) being stupid. So the main fix is having the libraries contribute to the main coverage.em file (since it's build using the merge option) which location is passed to the library project. The changes to the custom task was to support querying the libraries for a path with a given leaf (from the lib root folder) but this is not used at the moment. The other tasks are slightly cleaned up due to this though and are getting prepared to support customized folder names in folder. Change-Id: Ife59a2971ce6f2acf01b923abe90dea8adee462a
Diffstat (limited to 'files/ant')
-rw-r--r--files/ant/build.xml31
1 files changed, 24 insertions, 7 deletions
diff --git a/files/ant/build.xml b/files/ant/build.xml
index eb8b3d5..e842433 100644
--- a/files/ant/build.xml
+++ b/files/ant/build.xml
@@ -473,7 +473,7 @@
<if>
<condition><not><isset property="dont.do.deps" /></not></condition>
<then>
- <getlibs libraryFolderPathOut="project.library.folder.path" />
+ <getlibpath libraryFolderPathOut="project.library.folder.path" />
<if>
<condition>
<isreference refid="project.library.folder.path" />
@@ -570,6 +570,7 @@
antfile="build.xml">
<target name="nodeps" />
<target name="${project.libraries.target}" />
+ <property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" />
</subant>
</then>
</if>
@@ -706,13 +707,17 @@
libraryPackagesRefId="project.library.packages"
filterOut="emma.default.filter"/>
+ <!-- define where the .em file is going. This may have been
+ setup already if this is a library -->
+ <property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" />
+
<!-- It only instruments class files, not any external libs -->
<emma enabled="true">
<instr verbosity="${verbosity}"
mode="overwrite"
instrpath="${out.absolute.dir}/classes"
outdir="${out.absolute.dir}/classes"
- metadatafile="${out.absolute.dir}/coverage.em">
+ metadatafile="${emma.coverage.absolute.file}">
<filter excludes="${emma.default.filter}" />
<filter value="${emma.filter}" />
</instr>
@@ -1187,15 +1192,26 @@
<xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
expression="/manifest/@package" output="tested.project.app.package" />
- <getproperty projectPath="${tested.project.absolute.dir}"
- bin="tested.project.out.absolute.dir"
- src="tested.project.source.absolute.dir" />
+ <if condition="${emma.enabled}">
+ <then>
+ <getprojectpaths projectPath="${tested.project.absolute.dir}"
+ binOut="tested.project.out.absolute.dir"
+ srcOut="tested.project.source.absolute.dir" />
+ </then>
+ </if>
+
</then>
<else>
<!-- this is a test app, the tested package is the app's own package -->
<property name="tested.project.app.package" value="${project.app.package}" />
- <property name="tested.project.out.absolute.dir" value="${out.absolute.dir}" />
- <property name="tested.project.source.absolute.dir" value="${source.absolute.dir}" />
+
+ <if condition="${emma.enabled}">
+ <then>
+ <property name="tested.project.out.absolute.dir" value="${out.absolute.dir}" />
+ <property name="tested.project.source.absolute.dir" value="${source.absolute.dir}" />
+ </then>
+ </if>
+
</else>
</if>
@@ -1220,6 +1236,7 @@
<arg value="${out.absolute.dir}/coverage.ec" />
</exec>
<echo level="info">Extracting coverage report...</echo>
+
<emma>
<report sourcepath="${tested.project.source.absolute.dir}"
verbosity="${verbosity}">