Add automatic application package extraction from manifest

Automatic extraction of the application.package property has been added
leveradging xpath ant task. This reduces redundancy, removes hardcoded
application.package and solves bug with uninstalling test application
package. In order to function properly needs removing application.package
from build.properties file.
This commit is contained in:
Piotr Gurgul
2009-09-21 21:40:15 -07:00
parent 780a7fa1f5
commit 3cbe2b7943
2 changed files with 13 additions and 3 deletions

View File

@@ -22,9 +22,16 @@
classname="com.android.ant.ApkBuilderTask" classname="com.android.ant.ApkBuilderTask"
classpathref="android.antlibs" /> classpathref="android.antlibs" />
<taskdef name="xpath"
classname="com.android.ant.XPathTask"
classpathref="android.antlibs" />
<!-- Properties --> <!-- Properties -->
<property name="android.tools.dir" location="${sdk.dir}/tools" /> <property name="android.tools.dir" location="${sdk.dir}/tools" />
<!-- Name of the application package extracted from manifest file -->
<xpath input="AndroidManifest.xml" expression="/manifest/@package"
output="application.package" />
<!-- Input directories --> <!-- Input directories -->
<property name="source.dir" value="src" /> <property name="source.dir" value="src" />

View File

@@ -8,11 +8,14 @@
<property name="instrumentation.absolute.dir" location="${instrumentation.dir}" /> <property name="instrumentation.absolute.dir" location="${instrumentation.dir}" />
<property name="test.runner" value="android.test.InstrumentationTestRunner" /> <property name="test.runner" value="android.test.InstrumentationTestRunner" />
<property name="application.package.to.instrument" value="${application.package}.tests" /> <!-- Application package of the tested project extracted from its manifest file -->
<xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
expression="/manifest/@package" output="tested.application.package" />
<!-- TODO: make it more configurable in the next CL's - now it is default for auto-generated <!-- TODO: make it more configurable in the next CL's - now it is default for auto-generated
project --> project -->
<property name="emma.dump.file" value="/data/data/${application.package}/files/coverage.ec" /> <property name="emma.dump.file"
value="/data/data/${tested.application.package}/files/coverage.ec" />
<macrodef name="run-tests-helper"> <macrodef name="run-tests-helper">
<attribute name="emma.enabled" default="false" /> <attribute name="emma.enabled" default="false" />
@@ -28,7 +31,7 @@
<arg value="coverage" /> <arg value="coverage" />
<arg value="@{emma.enabled}" /> <arg value="@{emma.enabled}" />
<extra-instrument-args /> <extra-instrument-args />
<arg value="${application.package.to.instrument}/${test.runner}" /> <arg value="${application.package}/${test.runner}" />
</exec> </exec>
</sequential> </sequential>
</macrodef> </macrodef>