diff options
author | Xavier Ducrohet <xav@android.com> | 2012-03-29 19:28:25 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-04-16 12:54:55 -0700 |
commit | 1daa8f999d87443d14f698ca8ccc103e3309fa3e (patch) | |
tree | 29f034c67acbecc4933e35a46484edf1f9c9d055 /files/ant | |
parent | 4a8a17e5f23eace570b54084318b30bdd593fbc0 (diff) | |
download | sdk-1daa8f999d87443d14f698ca8ccc103e3309fa3e.zip sdk-1daa8f999d87443d14f698ca8ccc103e3309fa3e.tar.gz sdk-1daa8f999d87443d14f698ca8ccc103e3309fa3e.tar.bz2 |
Fix "ant test" + misc clean up / reorganization of build.xml
- Split NewSetupTask in several tasks to make things more flexible.
Particularly this allows more targets to get access to the project
type (app, lib, test, ...) as it's not so computive intensive.
- Fix test project to give them access to the full tested project's
classpath.
- Fix support for projects that test themselves.
- Make sure library projects are instrumented when using the
emma target.
Change-Id: Ia0c9564eacee2521e7cbd5154b8a85ea287ad4fd
Diffstat (limited to 'files/ant')
-rw-r--r-- | files/ant/build.xml | 421 | ||||
-rw-r--r-- | files/ant/pre_setup.xml | 6 |
2 files changed, 237 insertions, 190 deletions
diff --git a/files/ant/build.xml b/files/ant/build.xml index 7d2a6d7..856a501 100644 --- a/files/ant/build.xml +++ b/files/ant/build.xml @@ -27,7 +27,7 @@ <!-- **************** Overridable Properties *************** --> <!-- ******************************************************* --> - <!-- You can override these values in your build.xml or build.properties. + <!-- You can override these values in your build.xml or ant.properties. Overriding any other properties may result in broken build. --> <!-- Tells adb which device to target. You can change this from the command line @@ -72,8 +72,28 @@ </path> <!-- Custom tasks --> - <taskdef name="setup" - classname="com.android.ant.NewSetupTask" + <taskdef name="checkenv" + classname="com.android.ant.CheckEnvTask" + classpathref="android.antlibs" /> + + <taskdef name="gettype" + classname="com.android.ant.GetTypeTask" + classpathref="android.antlibs" /> + + <taskdef name="gettarget" + classname="com.android.ant.GetTargetTask" + classpathref="android.antlibs" /> + + <taskdef name="getlibs" + classname="com.android.ant.GetLibraryListTask" + classpathref="android.antlibs" /> + + <taskdef name="dependency" + classname="com.android.ant.ComputeDependencyTask" + classpathref="android.antlibs" /> + + <taskdef name="testedprojectclasspath" + classname="com.android.ant.ComputeProjectClasspathTask" classpathref="android.antlibs" /> <taskdef name="aapt" @@ -163,8 +183,13 @@ <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" /> <property name="aapt" location="${android.platform.tools.dir}/aapt${exe}" /> <property name="dx" location="${android.platform.tools.dir}/dx${bat}" /> - <!-- renderscript location is set by NewSetupTask since we have a choice of - several executables based on minSdkVersion --> + <property name="renderscript" location="${android.platform.tools.dir}/llvm-rs-cc${exe}"/> + + <!-- Renderscript include Path --> + <path id="android.renderscript.include.path"> + <pathelement location="${android.platform.tools.dir}/renderscript/include" /> + <pathelement location="${android.platform.tools.dir}/renderscript/clang-include" /> + </path> <!-- Intermediate files --> <property name="dex.file.name" value="classes.dex" /> @@ -276,7 +301,7 @@ </condition> <else> <path id="out.dex.jar.input.ref"> - <path refid="project.libraries.jars" /> + <path refid="project.all.jars.path" /> </path> </else> </if> @@ -316,9 +341,9 @@ buildType="${build.is.packaging.debug}/${build.is.signing.debug}"> <dex path="${intermediate.dex.file}"/> <sourcefolder path="${source.absolute.dir}"/> - <jarfile refid="project.libraries.jars" /> + <jarfile refid="project.all.jars.path" /> <nativefolder path="${native.libs.absolute.dir}" /> - <nativefolder refid="project.libraries.libs" /> + <nativefolder refid="project.library.native.folder.path" /> <extra-jars/> </apkbuilder> </sequential> @@ -353,7 +378,7 @@ <arg value="coverage" /> <arg value="@{emma.enabled}" /> <extra-instrument-args /> - <arg value="${manifest.package}/${test.runner}" /> + <arg value="${project.app.package}/${test.runner}" /> </exec> </sequential> </macrodef> @@ -393,104 +418,86 @@ <!-- ******************** Build Targets ******************** --> <!-- ******************************************************* --> + <!-- Basic Ant + SDK check --> + <target name="-check-env"> + <checkenv /> + </target> + <!-- target to disable building dependencies --> <target name="nodeps"> <property name="dont.do.deps" value="true" /> </target> - <!-- this target simply force running -setup making - the project info be read. To be used as - ant all clean - to clean the main project as well as the libraries and tested project --> - <target name="all" depends="-setup"/> + <!-- generic setup --> + <target name="-setup" depends="-check-env"> + <echo level="info">Project Name: ${ant.project.name}</echo> + <gettype projectTypeOut="project.type" /> + + <!-- sets a few boolean based on project.type + to make the if task easier --> + <condition property="project.is.library" value="true" else="false"> + <equals arg1="${project.type}" arg2="library" /> + </condition> + <condition property="project.is.test" value="true" else="false"> + <equals arg1="${project.type}" arg2="test" /> + </condition> + <condition property="project.is.testapp" value="true" else="false"> + <equals arg1="${project.type}" arg2="test-app" /> + </condition> + + <!-- If a test project, resolve absolute path to tested project. --> + <if condition="${project.is.test}"> + <then> + <property name="tested.project.absolute.dir" location="${tested.project.dir}" /> + </then> + </if> + + <!-- get the project manifest package --> + <xpath input="AndroidManifest.xml" + expression="/manifest/@package" output="project.app.package" /> + + </target> <!-- empty default pre-clean target. Create a similar target in your build.xml and it'll be called instead of this one. --> <target name="-pre-clean"/> <!-- clean target --> - <target name="clean" depends="-pre-clean" + <target name="clean" depends="-setup, -pre-clean" description="Removes output files created by other targets."> <delete dir="${out.absolute.dir}" verbose="${verbose}" /> <delete dir="${gen.absolute.dir}" verbose="${verbose}" /> - <!-- if we know about a tested project or libraries, we clean them too. This - will only work if the target 'all' was called first --> + <!-- if we know about a tested project or libraries, we clean them too. --> <if condition="${project.is.test}"> <then> <property name="tested.project.absolute.dir" location="${tested.project.dir}" /> <subant failonerror="true"> <fileset dir="${tested.project.absolute.dir}" includes="build.xml" /> - <target name="all" /> - <target name="clean" /> - </subant> - </then> - </if> - - <if> - <condition> - <isreference refid="project.libraries" /> - <not><isset property="dont.do.deps" /></not> - </condition> - <then> - <subant - buildpathref="project.libraries" - antfile="build.xml" - failonerror="true"> - <target name="nodeps" /> <target name="clean" /> </subant> </then> </if> - </target> - <!-- generic setup --> - <target name="-setup"> + <!-- get all the libraries --> <if> - <condition> - <not><isset property="setup.done" /></not> - </condition> + <condition><not><isset property="dont.do.deps" /></not></condition> <then> - <echo level="info">Creating output directories if needed...</echo> - <mkdir dir="${resource.absolute.dir}" /> - <mkdir dir="${jar.libs.absolute.dir}" /> - <mkdir dir="${out.absolute.dir}" /> - <mkdir dir="${out.res.absolute.dir}" /> - - <property name="setup.done" value="true" /> - <echo level="info">Gathering info for ${ant.project.name}...</echo> - <!-- load project properties, resolve Android target, library dependencies - and set some properties with the results. - All property names are passed as parameters ending in -Out --> - <setup - projectTypeOut="android.project.type" - androidJarFileOut="android.jar" - androidAidlFileOut="android.aidl" - renderScriptExeOut="renderscript" - renderScriptIncludeDirOut="android.rs" - bootclasspathrefOut="android.target.classpath" - projectLibrariesRootOut="project.libraries" - projectLibrariesJarsOut="project.libraries.jars" - projectLibrariesResOut="project.libraries.res" - projectLibrariesPackageOut="project.libraries.package" - projectLibrariesLibsOut="project.libraries.libs" - targetApiOut="target.api" - verbose="${verbose}" - /> - - <!-- sets a few boolean based on android.project.type - to make the if task easier --> - <condition property="project.is.library" else="false"> - <equals arg1="${android.project.type}" arg2="library" /> - </condition> - <condition property="project.is.test" else="false"> - <equals arg1="${android.project.type}" arg2="test" /> - </condition> - - <!-- If a test project, resolve absolute path to tested project. --> - <if condition="${project.is.test}"> + <getlibs libraryFolderPathOut="project.library.folder.path" /> + <if> + <condition> + <isreference refid="project.library.folder.path" /> + </condition> <then> - <property name="tested.project.absolute.dir" location="${tested.project.dir}" /> + <!-- clean the libraries with nodeps since we already + know about all the libraries even the indirect one --> + <subant + buildpathref="project.library.folder.path" + antfile="build.xml" + failonerror="true"> + <target name="nodeps" /> + <target name="clean" /> + </subant> </then> </if> </then> @@ -509,26 +516,69 @@ <property name="build.last.is.packaging.debug" value="" /> <property name="build.last.is.signing.debug" value="" /> + <echo level="info">Resolving Build Target for ${ant.project.name}...</echo> + <!-- load project properties, resolve Android target, library dependencies + and set some properties with the results. + All property names are passed as parameters ending in -Out --> + <gettarget + androidJarFileOut="project.target.android.jar" + androidAidlFileOut="project.target.framework.aidl" + bootClassPathOut="project.target.class.path" + targetApiOut="project.target.apilevel" + minSdkVersionOut="project.minSdkVersion" /> + + <!-- Value of the hasCode attribute (Application node) extracted from manifest file --> + <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:hasCode" + output="manifest.hasCode" default="true"/> + + <echo level="info">----------</echo> + <echo level="info">Creating output directories if needed...</echo> + <mkdir dir="${resource.absolute.dir}" /> + <mkdir dir="${jar.libs.absolute.dir}" /> + <mkdir dir="${out.absolute.dir}" /> + <mkdir dir="${out.res.absolute.dir}" /> + <do-only-if-manifest-hasCode> + <mkdir dir="${gen.absolute.dir}" /> + <mkdir dir="${out.classes.absolute.dir}" /> + </do-only-if-manifest-hasCode> + + <echo level="info">----------</echo> + <echo level="info">Resolving Dependencies for ${ant.project.name}...</echo> + <dependency + libraryFolderPathOut="project.library.folder.path" + libraryPackagesOut="project.library.packages" + libraryResFolderPathOut="project.library.res.folder.path" + libraryNativeFolderPathOut="project.library.native.folder.path" + jarLibraryPathOut="project.all.jars.path" + targetApi="${project.target.apilevel}" + verbose="${verbose}" /> + <!-- compile the libraries if any --> <if> <condition> <and> - <isreference refid="project.libraries" /> + <isreference refid="project.library.folder.path" /> <not><isset property="dont.do.deps" /></not> </and> </condition> <then> - <echo level="info">Building Libraries</echo> + <!-- figure out which target must be used to build the library projects. + If emma is enabled, then use 'instrument' otherwise, use 'debug' --> + <condition property="project.libraries.target" value="instrument" else="${build.target}"> + <istrue value="${build.is.instrumented}" /> + </condition> + + <echo level="info">----------</echo> + <echo level="info">Building Libraries with '${project.libraries.target}'...</echo> + + <!-- no need to build the deps as we have already + the full list of libraries --> <subant failonerror="true" - buildpathref="project.libraries" + buildpathref="project.library.folder.path" antfile="build.xml"> <target name="nodeps" /> - <target name="${build.target}" /> + <target name="${project.libraries.target}" /> </subant> - <echo level="info"></echo> - <echo level="info">############################################</echo> - <echo level="info">**** Back to project ${ant.project.name} ****</echo> - <echo level="info">############################################</echo> </then> </if> @@ -541,20 +591,25 @@ <isset property="emma.enabled" /> </condition> - <echo level="info">Building tested project at ${tested.project.absolute.dir}</echo> + <echo level="info">----------</echo> + <echo level="info">Building tested project at ${tested.project.absolute.dir} with '${tested.project.target}'...</echo> <subant target="${tested.project.target}" failonerror="true"> <fileset dir="${tested.project.absolute.dir}" includes="build.xml" /> </subant> - <echo level="info"></echo> - <echo level="info">############################################</echo> - <echo level="info">**** Back to project ${ant.project.name} ****</echo> - <echo level="info">############################################</echo> + + <!-- get the tested project full classpath to be able to build + the test project --> + <testedprojectclasspath + projectLocation="${tested.project.absolute.dir}" + projectClassPathOut="tested.project.classpath"/> </then> + <else> + <!-- no tested project, make an empty Path object so that javac doesn't + complain --> + <path id="tested.project.classpath" /> + </else> </if> - <!-- Value of the hasCode attribute (Application node) extracted from manifest file --> - <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:hasCode" - output="manifest.hasCode" default="true"/> <!-- If the "debug" build type changed, clear out the compiled code. This is to make sure the new BuildConfig.DEBUG value is picked up @@ -590,11 +645,6 @@ </if> </else> </if> - - <do-only-if-manifest-hasCode> - <mkdir dir="${gen.absolute.dir}" /> - <mkdir dir="${out.classes.absolute.dir}" /> - </do-only-if-manifest-hasCode> </target> <!-- empty default pre-build target. Create a similar target in @@ -605,9 +655,8 @@ <target name="-code-gen"> <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping aidl/renderscript/R.java"> - <echo level="info">----------</echo> <echo level="info">Handling aidl files...</echo> - <aidl executable="${aidl}" framework="${android.aidl}" + <aidl executable="${aidl}" framework="${project.target.framework.aidl}" genFolder="${gen.absolute.dir}"> <source path="${source.absolute.dir}"/> </aidl> @@ -616,10 +665,10 @@ <echo level="info">----------</echo> <echo level="info">Handling RenderScript files...</echo> <renderscript executable="${renderscript}" - framework="${android.rs}" + includePath="${android.renderscript.include.path}" genFolder="${gen.absolute.dir}" resFolder="${out.res.absolute.dir}/raw" - targetApi="${target.api}" + targetApi="${project.minSdkVersion}" optLevel="${renderscript.opt.level}" buildType="${build.is.packaging.debug}" previousBuildType="${build.last.is.packaging.debug}"> @@ -632,22 +681,20 @@ command="package" verbose="${verbose}" manifest="AndroidManifest.xml" - androidjar="${android.jar}" + androidjar="${project.target.android.jar}" rfolder="${gen.absolute.dir}" nonConstantId="${android.library}" - projectLibrariesResName="project.libraries.res" - projectLibrariesPackageName="project.libraries.package"> + libraryResFolderPathRefid="project.library.res.folder.path" + libraryPackagesRefid="project.library.packages"> <res path="${out.res.absolute.dir}" /> <res path="${resource.absolute.dir}" /> </aapt> <echo level="info">----------</echo> <echo level="info">Handling BuildConfig class...</echo> - <xpath input="AndroidManifest.xml" expression="/manifest/@package" - output="manifest.package" /> <buildconfig genFolder="${gen.absolute.dir}" - package="${manifest.package}" + package="${project.app.package}" buildType="${build.is.packaging.debug}" previousBuildType="${build.last.is.packaging.debug}"/> @@ -661,34 +708,41 @@ <!-- Compiles this project's .java files into .class files. --> <target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile"> <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> - <!-- If android rules are used for a test project, its classpath should include - tested project's location --> - <condition property="extensible.classpath" - value="${tested.project.absolute.dir}/bin/classes" - else="."> - <isset property="tested.project.absolute.dir" /> - </condition> - <condition property="extensible.libs.classpath" - value="${tested.project.absolute.dir}/${jar.libs.dir}" - else="${jar.libs.dir}"> - <isset property="tested.project.absolute.dir" /> - </condition> + <!-- merge the project's own classpath and the tested project's classpath --> + <path id="project.javac.classpath"> + <path refid="project.all.jars.path" /> + <path refid="tested.project.classpath" /> + </path> <javac encoding="${java.encoding}" source="${java.source}" target="${java.target}" debug="true" extdirs="" includeantruntime="false" destdir="${out.classes.absolute.dir}" - bootclasspathref="android.target.classpath" + bootclasspathref="project.target.class.path" verbose="${verbose}" - classpath="${extensible.classpath}" - classpathref="project.libraries.jars" + classpathref="project.javac.classpath" fork="${need.javac.fork}"> <src path="${source.absolute.dir}" /> <src path="${gen.absolute.dir}" /> - <classpath> - <fileset dir="${extensible.libs.classpath}" includes="*.jar" /> - </classpath> <compilerarg line="${java.compilerargs}" /> </javac> + + <!-- if the project is instrumented, intrument the classes --> + <if condition="${build.is.instrumented}"> + <then> + <echo level="info">Instrumenting classes from ${out.absolute.dir}/classes...</echo> + <!-- 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"> + <filter excludes="${project.app.package}.R,${project.app.package}.R$$*,${project.app.package}.BuildConfig" /> + <filter value="${emma.filter}" /> + </instr> + </emma> + </then> + </if> + <!-- if the project is a library then we generate a jar file --> <if condition="${project.is.library}"> <then> @@ -703,33 +757,17 @@ </then> </if> - <propertybyreplace name="manifest.package.path" input="${manifest.package}" replace="." with="/" /> + <propertybyreplace name="project.app.package.path" input="${project.app.package}" replace="." with="/" /> <jar destfile="${out.library.jar.file}"> <fileset dir="${out.classes.absolute.dir}" includes="**/*.class" - excludes="${manifest.package.path}/R.class ${manifest.package.path}/R$*.class ${manifest.package.path}/Manifest.class ${manifest.package.path}/Manifest$*.class ${manifest.package.path}/BuildConfig.class"/> + excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/Manifest.class ${project.app.package.path}/Manifest$*.class ${project.app.package.path}/BuildConfig.class"/> <fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" /> </jar> </then> </if> - <!-- if the project is instrumented, intrument the classes --> - <if condition="${build.is.instrumented}"> - <then> - <echo level="info">Instrumenting classes from ${out.absolute.dir}/classes...</echo> - <!-- 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"> - <filter excludes="${manifest.package}.R,${manifest.package}.R$$*,${manifest.package}.BuildConfig" /> - <filter value="${emma.filter}" /> - </instr> - </emma> - </then> - </if> </do-only-if-manifest-hasCode> </target> @@ -770,7 +808,7 @@ all the jar files separated by a platform path-separator. Each path must be quoted if it contains spaces. --> - <pathconvert property="android.libraryjars" refid="android.target.classpath"> + <pathconvert property="project.target.classpath.value" refid="project.target.class.path"> <firstmatchmapper> <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> <identitymapper/> @@ -780,15 +818,15 @@ <!-- Build a path object with all the jar files that must be obfuscated. This include the project compiled source code and any 3rd party jar files. --> - <path id="project.jars.ref"> + <path id="project.all.classes.path"> <pathelement location="${preobfuscate.jar.file}" /> - <path refid="project.libraries.jars" /> + <path refid="project.all.jars.path" /> </path> <!-- Set the project jar files Path object into a single property. It'll be all the jar files separated by a platform path-separator. Each path must be quoted if it contains spaces. --> - <pathconvert property="project.jars" refid="project.jars.ref"> + <pathconvert property="project.all.classes.value" refid="project.all.classes.path"> <firstmatchmapper> <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> <identitymapper/> @@ -813,9 +851,9 @@ destfile="${preobfuscate.jar.file}" /> <proguard> -include "${proguard.configcmd}" - -injars ${project.jars} + -injars ${project.all.classes.value} -outjars "${obfuscated.jar.file}" - -libraryjars ${android.libraryjars} + -libraryjars ${project.target.classpath.value} -dump "${obfuscate.absolute.dir}/dump.txt" -printseeds "${obfuscate.absolute.dir}/seeds.txt" -printusage "${obfuscate.absolute.dir}/usage.txt" @@ -875,13 +913,13 @@ debug="${build.is.packaging.debug}" manifest="AndroidManifest.xml" assets="${asset.absolute.dir}" - androidjar="${android.jar}" + androidjar="${project.target.android.jar}" apkfolder="${out.absolute.dir}" nocrunch="${build.packaging.nocrunch}" resourcefilename="${resource.package.file.name}" resourcefilter="${aapt.resource.filter}" - projectLibrariesResName="project.libraries.res" - projectLibrariesPackageName="project.libraries.package" + libraryResFolderPathRefid="project.library.res.folder.path" + libraryPackagesRefid="project.library.packages" previousBuildType="${build.last.target}" buildType="${build.target}"> <res path="${out.res.absolute.dir}" /> @@ -932,11 +970,24 @@ </target> - <target name="-set-debug-mode"> + <target name="-set-debug-mode" depends="-setup"> <!-- record the current build target --> <property name="build.target" value="debug" /> - <property name="build.is.instrumented" value="false" /> + <if> + <condition> + <and> + <istrue value="${project.is.testapp}" /> + <istrue value="${emma.enabled}" /> + </and> + </condition> + <then> + <property name="build.is.instrumented" value="true" /> + </then> + <else> + <property name="build.is.instrumented" value="false" /> + </else> + </if> <!-- whether the build is a debug build. always set. --> <property name="build.is.packaging.debug" value="true" /> @@ -1131,33 +1182,40 @@ </target> <!-- fails if the project is not a test project --> - <target name="-test-project-check"> - <!-- can't use project.is.test since the setup target is not run --> + <target name="-test-project-check" depends="-setup"> <if> <condition> - <isset property="tested.project.dir" /> + <and> + <isfalse value="${project.is.test}" /> + <isfalse value="${project.is.testapp}" /> + </and> </condition> - <else> + <then> <fail message="Project is not a test project." /> - </else> + </then> </if> </target> <target name="test" depends="-test-project-check" description="Runs tests from the package defined in test.package property"> - - <property name="tested.project.absolute.dir" location="${tested.project.dir}" /> - <property name="test.runner" value="android.test.InstrumentationTestRunner" /> - <!-- Application package of the tested project extracted from its manifest file --> - <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml" - expression="/manifest/@package" output="tested.manifest.package" /> - <xpath input="AndroidManifest.xml" - expression="/manifest/@package" output="manifest.package" /> + <if condition="${project.is.test}"> + <then> + <property name="tested.project.absolute.dir" location="${tested.project.dir}" /> + + <!-- Application package of the tested project extracted from its manifest file --> + <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml" + expression="/manifest/@package" output="tested.project.app.package" /> + </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}" /> + </else> + </if> <property name="emma.dump.file" - value="/data/data/${tested.manifest.package}/coverage.ec" /> + value="/data/data/${tested.project.app.package}/coverage.ec" /> <if condition="${emma.enabled}"> <then> @@ -1294,18 +1352,14 @@ <!-- Uninstalls the package from the default emulator/device --> - <target name="uninstall" + <target name="uninstall" depends="-setup" description="Uninstalls the application from a running emulator or device."> - <!-- Name of the application package extracted from manifest file --> - <xpath input="AndroidManifest.xml" expression="/manifest/@package" - output="manifest.package" /> - <if> <condition> - <isset property="manifest.package" /> + <isset property="project.app.package" /> </condition> <then> - <uninstall-helper app.package="${manifest.package}" /> + <uninstall-helper app.package="${project.app.package}" /> </then> <else> <fail message="Could not find application package in manifest. Cannot run 'adb uninstall'." /> @@ -1313,11 +1367,10 @@ </if> <!-- Now uninstall the tested project, if applicable --> - <!-- can't use project.is.test since the setup target might not have run --> <if> <condition> <and> - <isset property="tested.project.dir" /> + <istrue value="${project.is.test}" /> <not> <isset property="dont.do.deps" /> </not> @@ -1328,13 +1381,13 @@ <!-- Application package of the tested project extracted from its manifest file --> <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml" - expression="/manifest/@package" output="tested.manifest.package" /> + expression="/manifest/@package" output="tested.project.app.package" /> <if> <condition> - <isset property="tested.manifest.package" /> + <isset property="tested.project.app.package" /> </condition> <then> - <uninstall-helper app.package="${tested.manifest.package}" /> + <uninstall-helper app.package="${tested.project.app.package}" /> </then> <else> <fail message="Could not find tested application package in manifest. Cannot run 'adb uninstall'." /> @@ -1372,7 +1425,7 @@ <echo> debug key.</echo> <echo> test: Runs the tests. Project must be a test project and</echo> <echo> must have been built. Typical usage would be:</echo> - <echo> ant [emma] debug installt test</echo> + <echo> ant [emma] debug install test</echo> <echo> emma: Transiently enables code coverage for subsequent</echo> <echo> targets.</echo> <echo> install: Installs the newly build package. Must either be used</echo> diff --git a/files/ant/pre_setup.xml b/files/ant/pre_setup.xml deleted file mode 100644 index 1c86109..0000000 --- a/files/ant/pre_setup.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="imported" basedir="."> - - <fail message="Your build.xml file is outdated. Delete it and regenerate it with 'android update project'"/> - -</project> |