Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

1148 lines (1023 sloc) 52.5 KB
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
May 11, 2011 8:52:47 AM
ant build scripts for the android dvm test project
====================================================================== -->
<project name="WabashLineANTTest" basedir="." default="">
ant build scripts for the android dvm test project
<property environment="env"/>
<format property="TODAY_US" pattern="MMMM-d-yyyy" locale="en,US"/>
<format property="TSTAMP" pattern="hh:mm aa"/>
<format property="DSTAMP" pattern="MMMM-d-yyyy"/>
<!-- The file is created and updated by the 'android'
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="" />
<!-- The 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:
The name of the source directory. Default is 'src'.
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 into Version Control Systems.
<property file="" />
<!-- The 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 into Version Control Systems. -->
<property file="" />
<!-- Required pre-setup import -->
<import file="${sdk.dir}/tools/ant/pre_setup.xml" />
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<target name="-pre-build">
<target name="-pre-compile">
[This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir}]
<target name="-post-compile">
<!-- 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
Depending on the project type it can be either:
- main_rules.xml
- lib_rules.xml
- test_rules.xml
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<setup> task.
- customize it to your needs.
- Customize the whole script.
- copy/paste the content of the rules files (minus the top node)
into this file, *after* the <setup> task
- disable the import of the rules by changing the setup task
below to <setup import="false" />.
- customize to your needs.
<setup import="false"/>
This rules file is meant to be imported by the custom Ant task:
The following properties are put in place by the importing task:
android.jar, android.aidl, aapt, aidl, and dx
Additionnaly, the task sets up the following classpath reference:
This is used by the compiler task as the boot classpath.
<!-- Custom tasks -->
<taskdef name="aapt"
classpathref="android.antlibs" />
<taskdef name="aidl"
classpathref="android.antlibs" />
<taskdef name="renderscript"
classpathref="android.antlibs" />
<taskdef name="apkbuilder"
classpathref="android.antlibs" />
<taskdef name="xpath"
classpathref="android.antlibs" />
<taskdef name="if"
classpathref="android.antlibs" />
<!-- Properties -->
<!-- Tells adb which device to target. You can change this from the command line
by invoking "ant -Dadb.device.arg=-d" for device "ant -Dadb.device.arg=-e" for
the emulator. -->
<property name="adb.device.arg" value="" />
<property name="" location="${sdk.dir}/tools" />
<property name="" location="${sdk.dir}/platform-tools" />
<!-- Name of the application package extracted from manifest file -->
<xpath input="AndroidManifest.xml" expression="/manifest/@package"
output="manifest.package" />
<!-- 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"/>
<!-- Input directories -->
<property name="source.dir" value="src" />
<property name="source.absolute.dir" location="${source.dir}" />
<property name="gen.dir" value="gen" />
<property name="gen.absolute.dir" location="${gen.dir}" />
<property name="resource.dir" value="res" />
<property name="resource.absolute.dir" location="${resource.dir}" />
<property name="asset.dir" value="assets" />
<property name="asset.absolute.dir" location="${asset.dir}" />
<!-- Directory for the third party java libraries -->
<property name="jar.libs.dir" value="libs" />
<property name="jar.libs.absolute.dir" location="${jar.libs.dir}" />
<!-- create a path with all the jar files, from the main project and the
libraries -->
<path id="jar.libs.ref">
<fileset dir="${jar.libs.absolute.dir}" includes="*.jar" />
<path refid="project.libraries.jars" />
<!-- Directory for the native libraries -->
<property name="native.libs.dir" value="libs" />
<property name="native.libs.absolute.dir" location="${native.libs.dir}" />
<!-- Output directories -->
<property name="out.dir" value="bin" />
<property name="out.absolute.dir" location="${out.dir}" />
<property name="out.classes.dir" value="${out.absolute.dir}/classes" />
<property name="out.classes.absolute.dir" location="${out.classes.dir}" />
<!-- Intermediate files -->
<property name="" value="classes.dex" />
<property name="intermediate.dex.file"
location="${out.absolute.dir}/${}" />
<property name=""
value="${}.ap_" />
<!-- The final package file to generate
These can be overridden by setting them earlier to
different values -->
<property name="out.debug.unaligned.file"
location="${out.absolute.dir}/${}-debug-unaligned.apk" />
<property name="out.debug.file"
location="${out.absolute.dir}/${}-debug.apk" />
<property name=""
value="${}-unsigned.apk" />
<property name="out.unsigned.file"
location="${out.absolute.dir}/${}" />
<property name=""
value="${}-unaligned.apk" />
<property name="out.unaligned.file"
location="${out.absolute.dir}/${}" />
<property name=""
value="${}-release.apk" />
<property name="out.release.file"
location="${out.absolute.dir}/${}" />
<!-- set some properties used for filtering/override. If those weren't defined
before, then this will create them with empty values, which are then ignored
by the custom tasks receiving them. -->
<property name="version.code" value="" />
<property name="aapt.resource.filter" value="" />
<property name="filter.abi" value="" />
<!-- compilation options -->
<property name="java.encoding" value="UTF-8" />
<property name="" value="1.5" />
<property name="java.source" value="1.5" />
<!-- Verbosity -->
<property name="verbose" value="false" />
<!-- This is needed by emma as it uses multilevel verbosity instead of simple 'true' or 'false'
The property 'verbosity' is not user configurable and depends exclusively on 'verbose'
<condition property="verbosity" value="verbose" else="quiet">
<istrue value="${verbose}" />
<!-- This is needed to switch verbosity of zipalign. Depends exclusively on 'verbose'
<condition property="v.option" value="-v" else="">
<istrue value="${verbose}" />
<!-- This is needed to switch verbosity of dx. Depends exclusively on 'verbose' -->
<condition property="verbose.option" value="--verbose" else="">
<istrue value="${verbose}" />
<!-- properties for signing in release mode -->
<condition property="has.keystore">
<isset property="" />
<length string="${}" when="greater" length="0" />
<isset property="key.alias" />
<condition property="has.password">
<isset property="has.keystore" />
<isset property="" />
<isset property="key.alias.password" />
<!-- Tools -->
<condition property="exe" value=".exe" else=""><os family="windows" /></condition>
<property name="adb" location="${}/adb${exe}" />
<property name="zipalign" location="${}/zipalign${exe}" />
<!-- Emma configuration -->
<property name="emma.dir" value="${sdk.dir}/tools/lib" />
<path id="emma.lib">
<pathelement location="${emma.dir}/emma.jar" />
<pathelement location="${emma.dir}/emma_ant.jar" />
<taskdef resource="" classpathref="emma.lib" />
<!-- End of emma configuration -->
<!-- Macros -->
<!-- Configurable macro, which allows to pass as parameters output directory,
output dex filename and external libraries to dex (optional) -->
<macrodef name="dex-helper">
<element name="external-libs" optional="yes" />
<element name="extra-parameters" optional="yes" />
<!-- sets the primary input for dex. If a pre-dex task sets it to
something else this has no effect -->
<property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" />
<!-- set the secondary dx input: the project (and library) jar files
If a pre-dex task sets it to something else this has no effect -->
<isreference refid="out.dex.jar.input.ref" />
<path id="out.dex.jar.input.ref">
<path refid="jar.libs.ref" />
<echo>Converting compiled files and external libraries into ${intermediate.dex.file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<arg value="--dex" />
<arg value="--output=${intermediate.dex.file}" />
<extra-parameters />
<arg line="${verbose.option}" />
<arg path="${out.dex.input.absolute.dir}" />
<path refid="out.dex.jar.input.ref" />
<external-libs />
<!-- This is macro that enable passing variable list of external jar files to ApkBuilder
Example of use:
<package-helper output.filepath="/path/to/foo.apk">
<jarfolder path="my_jars" />
<jarfile path="foo/bar.jar" />
<jarfolder path="your_jars" />
</package-helper> -->
<macrodef name="package-helper">
<attribute name="output.filepath" />
<element name="extra-jars" optional="yes" />
<dex path="${intermediate.dex.file}"/>
<sourcefolder path="${source.absolute.dir}"/>
<sourcefolder refid="project.libraries.src"/>
<jarfolder path="${jar.libs.absolute.dir}" />
<jarfolder refid="project.libraries.libs" />
<nativefolder path="${native.libs.absolute.dir}" />
<nativefolder refid="project.libraries.libs" />
<!-- This is macro which zipaligns in.package and outputs it to out.package. Used by targets
debug, -debug-with-emma and release.-->
<macrodef name="zipalign-helper">
<attribute name="in.package" />
<attribute name="out.package" />
<echo>Running zip align on final apk...</echo>
<exec executable="${zipalign}" failonerror="true">
<arg line="${v.option}" />
<arg value="-f" />
<arg value="4" />
<arg path="@{in.package}" />
<arg path="@{out.package}" />
<!-- This is macro used only for sharing code among two targets, -install and
-install-with-emma which do exactly the same but differ in dependencies -->
<macrodef name="install-helper">
<echo>Installing ${out.debug.file} onto default emulator or device...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="install" />
<arg value="-r" />
<arg path="${out.debug.file}" />
<!-- Rules -->
<!-- Creates the output directories if they don't exist yet. -->
<target name="-dirs">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${resource.absolute.dir}" />
<mkdir dir="${jar.libs.absolute.dir}" />
<mkdir dir="${out.absolute.dir}" />
<if condition="${manifest.hasCode}">
<mkdir dir="${gen.absolute.dir}" />
<mkdir dir="${out.classes.absolute.dir}" />
<!-- empty default pre-build target. Create a similar target in
your build.xml and it'll be called instead of this one. -->
<target name="-pre-build"/>
<!-- Generates the file for this project's resources. -->
<target name="-resource-src" depends="-dirs">
<if condition="${manifest.hasCode}">
<echo>Generating / from the resources...</echo>
<aapt executable="${aapt}"
<res path="${resource.absolute.dir}" />
<echo>hasCode = false. Skipping...</echo>
<!-- Generates java classes from .aidl files. -->
<target name="-aidl" depends="-dirs">
<if condition="${manifest.hasCode}">
<echo>Compiling aidl files into Java classes...</echo>
<aidl executable="${aidl}" framework="${android.aidl}"
<source path="${source.absolute.dir}"/>
<source refid="project.libraries.src"/>
<echo>hasCode = false. Skipping...</echo>
<!-- Compiles RenderScript files into Java and bytecode. -->
<target name="-renderscript" depends="-dirs">
<if condition="${manifest.hasCode}">
<echo>Compiling RenderScript files into Java classes and RenderScript bytecode...</echo>
<renderscript executable="${renderscript}"
<source path="${source.absolute.dir}"/>
<source refid="project.libraries.src"/>
<echo>hasCode = false. Skipping...</echo>
<!-- empty default pre-compile target. Create a similar target in
your build.xml and it'll be called instead of this one. -->
<target name="-pre-compile"/>
<!-- Compiles this project's .java files into .class files. -->
<target name="compile" depends="-pre-build, -aidl, -renderscript, -resource-src, -pre-compile"
description="Compiles project's .java files into .class files">
<if condition="${manifest.hasCode}">
<!-- If android rules are used for a test project, its classpath should include
tested project's location -->
<condition property="extensible.classpath"
<isset property="tested.project.absolute.dir" />
<condition property="extensible.libs.classpath"
<isset property="tested.project.absolute.dir" />
<javac encoding="${java.encoding}"
source="${java.source}" target="${}"
debug="true" extdirs=""
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<src refid="project.libraries.src" />
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
<fileset dir="${tested.project.dir}/buildsystem/projectframeworkslibs/dvmtestproject/androidmock/goesintestclasspath" includes="*.jar"/>
<echo>hasCode = false. Skipping...</echo>
<!-- empty default post-compile target. Create a similar target in
your build.xml and it'll be called instead of this one. -->
<target name="-post-compile">
<subant target="-dvm.checkstyle">
<fileset dir="${basedir}" includes="build.xml"/>
<subant target="-dvm.pmd">
<fileset dir="${basedir}" includes="build.xml"/>
<subant target="-dvm.apivizdoclet">
<fileset dir="${basedir}" includes="build.xml"/>
<!-- Obfuscate target
This is only active in release builds when proguard.config is defined
To replace Proguard with a different obfuscation engine:
Override the following targets in your build.xml, before the call to <setup>
Check whether obfuscation should happen, and put the result in a property.
Obfuscation should not happen. Set the same property to false.
** Make sure unless="do.not.compile" is used in the target definition **
check if the property set in -debug/release-obfuscation-check is set to true.
If true:
Perform obfuscation
Set property out.dex.input.absolute.dir to be the output of the obfuscation
<target name="-obfuscate" unless="do.not.compile">
<if condition="${proguard.enabled}">
<property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard" />
<property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/original.jar" />
<property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar" />
<!-- input for dex will be proguard's output -->
<property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}" />
<!-- Add Proguard Tasks -->
<property name="proguard.jar" location="${}/proguard/lib/proguard.jar" />
<taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}" />
<!-- Set the android classpath Path object into a single property. It'll be
all the jar files separated by a platform path-separator.
<property name="android.libraryjars" refid=""/>
<!-- 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">
<pathelement location="${preobfuscate.jar.file}" />
<path refid="jar.libs.ref" />
<!-- Set the project jar files Path object into a single property. It'll be
all the jar files separated by a platform path-separator.
<property name="project.jars" refid="project.jars.ref" />
<mkdir dir="${obfuscate.absolute.dir}" />
<delete file="${preobfuscate.jar.file}"/>
<delete file="${obfuscated.jar.file}"/>
<jar basedir="${out.classes.dir}" destfile="${preobfuscate.jar.file}" />
-injars ${project.jars}
-outjars ${obfuscated.jar.file}
-libraryjars ${android.libraryjars}
-dump ${obfuscate.absolute.dir}/dump.txt
-printseeds ${obfuscate.absolute.dir}/seeds.txt
-printusage ${obfuscate.absolute.dir}/usage.txt
-printmapping ${obfuscate.absolute.dir}/mapping.txt
<!-- Converts this project's .class files into .dex files -->
<target name="-dex" depends="compile, -post-compile, -obfuscate"
<if condition="${manifest.hasCode}">
<dex-helper />
<echo>hasCode = false. Skipping...</echo>
<!-- Puts the project's resources into the output package file
This actually can create multiple resource package in case
Some custom apk with specific configuration have been
declared in
<target name="-package-resources">
<echo>Packaging resources</echo>
<aapt executable="${aapt}"
<res path="${resource.absolute.dir}" />
<!-- <nocompress /> forces no compression on any files in assets or res/raw -->
<!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
<!-- Packages the application and sign it with a debug key. -->
<target name="-package-debug-sign" depends="-dex, -package-resources">
output.filepath="${out.debug.unaligned.file}" />
<!-- Packages the application without signing it. -->
<target name="-package-release" depends="-dex, -package-resources">
<target name="-compile-tested-if-test" if="tested.project.dir" unless="do.not.compile.again">
<subant target="compile">
<fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
<target name="-debug-obfuscation-check">
<!-- proguard is never enabled in debug mode -->
<property name="proguard.enabled" value="false"/>
<target name="-set-debug-mode" depends="-debug-obfuscation-check">
<!-- property only set in debug mode.
Useful for if/unless attributes in target node
when using Ant before 1.8 -->
<property name="build.mode.debug" value="true"/>
<!-- whether the build is a debug build. always set. -->
<property name="build.packaging.debug" value="true" />
<!-- signing mode: debug -->
<property name="build.signing.debug" value="true" />
<!-- Builds debug output package, provided all the necessary files are already dexed -->
<target name="debug" depends="-set-debug-mode, -compile-tested-if-test, -package-debug-sign"
description="Builds the application and signs it with a debug key.">
<zipalign-helper in.package="${out.debug.unaligned.file}"
out.package="${out.debug.file}" />
<echo>Debug Package: ${out.debug.file}</echo>
<!-- called through target 'release'. Only executed if the keystore and
key alias are known but not their password. -->
<target name="-release-prompt-for-password" if="has.keystore" unless="has.password">
<!-- Gets passwords -->
message="Please enter keystore password (store:${}):"
addproperty="" />
message="Please enter password for alias '${key.alias}':"
addproperty="key.alias.password" />
<!-- called through target 'release'. Only executed if there's no
keystore/key alias set -->
<target name="-release-nosign" unless="has.keystore">
<echo>No and key.alias properties found in</echo>
<echo>Please sign ${out.unsigned.file} manually</echo>
<echo>and run zipalign from the Android SDK tools.</echo>
<target name="-release-obfuscation-check">
<condition property="proguard.enabled" value="true" else="false">
<isset property="build.mode.release" />
<isset property="proguard.config" />
<if condition="${proguard.enabled}">
<!-- Secondary dx input (jar files) is empty since all the
jar files will be in the obfuscated jar -->
<path id="out.dex.jar.input.ref" />
<target name="-set-release-mode">
<!-- release mode is only valid if the manifest does not explicitly
set debuggable to true. default is false.
We actually store build.packaging.debug, not build.release -->
<xpath input="AndroidManifest.xml" expression="/manifest/application/@android:debuggable"
output="build.packaging.debug" default="false"/>
<!-- signing mode: release -->
<property name="build.signing.debug" value="false" />
<if condition="${build.packaging.debug}">
<echo>**** Android Manifest has debuggable=true ****</echo>
<echo>**** Doing DEBUG packaging with RELEASE keys ****</echo>
<!-- property only set in release mode.
Useful for if/unless attributes in target node
when using Ant before 1.8 -->
<property name="build.mode.release" value="true"/>
<!-- This runs -package-release and -release-nosign first and then runs
only if release-sign is true (set in -release-check,
called by -release-no-sign)-->
<target name="release"
depends="-set-release-mode, -release-obfuscation-check, -package-release, -release-prompt-for-password, -release-nosign"
description="Builds the application. The generated apk file must be signed before
it is published.">
<!-- Signs the APK -->
<echo>Signing final apk...</echo>
verbose="${verbose}" />
<!-- Zip aligns the APK -->
<zipalign-helper in.package="${out.unaligned.file}"
out.package="${out.release.file}" />
<echo>Release Package: ${out.release.file}</echo>
<target name="install" depends="debug"
description="Installs/reinstalls the debug package onto a running
emulator or device. If the application was previously installed,
the signatures must match." >
<install-helper />
<target name="-uninstall-check">
<condition property="">
<isset property="manifest.package" />
<target name="-uninstall-error" depends="-uninstall-check" unless="">
<echo>Unable to run 'ant uninstall', manifest.package property is not defined.
<!-- Uninstalls the package from the default emulator/device -->
<target name="uninstall" depends="-uninstall-error" if=""
description="Uninstalls the application from a running emulator or device.">
<echo>Uninstalling ${manifest.package} from the default emulator or device...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="uninstall" />
<arg value="${manifest.package}" />
<target name="clean" description="Removes output files created by other targets.">
<delete dir="${out.absolute.dir}" verbose="${verbose}" />
<delete dir="${gen.absolute.dir}" verbose="${verbose}" />
<!-- Targets for code-coverage measurement purposes, invoked from external file -->
<!-- Emma-instruments tested project classes (compiles the tested project if necessary)
and writes instrumented classes to ${instrumentation.absolute.dir}/classes -->
<target name="-emma-instrument" depends="compile">
<echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
<!-- It only instruments class files, not any external libs -->
<emma enabled="true">
<instr verbosity="${verbosity}"
<!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
user defined file -->
<target name="-dex-instrumented" depends="-emma-instrument">
<arg value="--no-locals" />
<fileset file="${emma.dir}/emma_device.jar" />
<!-- Invoked from external files for code coverage purposes -->
<target name="-package-with-emma" depends="-dex-instrumented, -package-resources">
<!-- Injected from external file -->
<jarfile path="${emma.dir}/emma_device.jar" />
<target name="-debug-with-emma" depends="-set-debug-mode, -package-with-emma">
<zipalign-helper in.package="${out.debug.unaligned.file}"
out.package="${out.debug.file}" />
<target name="-install-with-emma" depends="-debug-with-emma">
<install-helper />
<!-- End of targets for code-coverage measurement purposes -->
<target name="help">
<!-- displays starts at col 13
|13 80| -->
<echo>Android Ant Build. Available targets:</echo>
<echo> help: Displays this help.</echo>
<echo> clean: Removes output files created by other targets.</echo>
<echo> compile: Compiles project's .java files into .class files.</echo>
<echo> debug: Builds the application and signs it with a debug key.</echo>
<echo> release: Builds the application. The generated apk file must be</echo>
<echo> signed before it is published.</echo>
<echo> install: Installs/reinstalls the debug package onto a running</echo>
<echo> emulator or device.</echo>
<echo> If the application was previously installed, the</echo>
<echo> signatures must match.</echo>
<echo> uninstall: Uninstalls the application from a running emulator or</echo>
<echo> device.</echo>
<property name="tested.project.absolute.dir" location="${tested.project.dir}" />
<property name="instrumentation.dir" value="instrumented" />
<property name="instrumentation.absolute.dir" location="${instrumentation.dir}" />
<property name="test.runner" value="" />
<!-- 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" />
<property name="reports.dir" value="${tested.project.dir}/build/docs"/>
<property name="files.dir" value="/data/data/${tested.manifest.package}/files"/>
<!-- TODO: make it more configurable in the next CL's - now it is default for auto-generated
project -->
<property name="emma.dump.file"
value="/data/data/${tested.manifest.package}/files/" />
<macrodef name="run-tests-helper">
<attribute name="emma.enabled" default="false" />
<element name="extra-instrument-args" optional="yes" />
<echo>Cleaning up previous test reports...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="shell" />
<arg value="rm" />
<arg value="${files.dir}/*" />
<echo>Running tests ...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="shell" />
<arg value="am" />
<arg value="instrument" />
<arg value="-w" />
<arg value="-e" />
<arg value="coverage" />
<arg value="@{emma.enabled}" />
<arg value="-e" />
<arg value="multiFile" />
<arg value="false" />
<arg value="reportFile"/>
<arg value="dvm-junit-report"/>
<extra-instrument-args />
<arg value="${manifest.package}/${test.runner}" />
<echo>Downloading XML test reports...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/>
<arg value="pull" />
<arg value="${files.dir}" />
<arg value="${reports.dir}" />
<!-- Invoking this target sets the value of extensible.classpath, which is being added to javac
classpath in target 'compile' (android_rules.xml) -->
<target name="-set-coverage-classpath">
<property name="extensible.classpath"
location="${instrumentation.absolute.dir}/classes" />
<!-- Ensures that tested project is installed on the device before we run the tests.
Used for ordinary tests, without coverage measurement -->
<target name="-install-tested-project">
<property name="do.not.compile.again" value="true" />
<subant target="install">
<fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
<target name="run-tests" depends="-install-tested-project, install"
description="Runs tests from the package defined in test.package property">
<run-tests-helper />
<target name="-install-instrumented">
<property name="do.not.compile.again" value="true" />
<subant target="-install-with-emma">
<property name="out.absolute.dir" value="${instrumentation.absolute.dir}" />
<fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
<target name="coverage" depends="-set-coverage-classpath, -install-instrumented, install"
description="Runs the tests against the instrumented code and generates
code coverage report">
<run-tests-helper emma.enabled="true">
<arg value="-e" />
<arg value="coverageFile" />
<arg value="${emma.dump.file}" />
<echo>Downloading coverage file into project directory...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}" />
<arg value="pull" />
<arg value="${emma.dump.file}" />
<arg value="" />
<echo>Extracting coverage report...</echo>
<report sourcepath="${tested.project.absolute.dir}/${source.dir}"
<!-- TODO: report.dir or something like should be introduced if necessary -->
<!-- per sdk 11/adt 10.01 its wrong
<infileset file="${tested.project.absolute.dir}/build/docs/" />
<infileset file="${tested.project.absolute.dir}/coverage.em"/>
<!-- TODO: reports in other, indicated by user formats -->
<html outfile="${tested.project.absolute.dir}/build/docs/coverage.html" />
<echo>Cleaning up temporary files...</echo>
<delete dir="${instrumentation.absolute.dir}" />
<!-- file appears in build/docs and
coverage.em appears in app project/root
thus we need to specify location-->
<delete file="${tested.project.absolute.dir}/build/docs/" />
<delete file="${tested.project.absolute.dir}/coverage.em" />
<echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
<!-- Although this is the dvm-test build script we still need to execute
and store some codeqa in the build/docs of this project, namely:
Thus some buildsystem properties and stuff to enable that to happen -->
<property name="" location="${basedir}/build"/>
<property name="" location="${}/docs"/>
<mkdir dir="${}"/>
<property name="dvm.javadoc.dir" location="${}/javadoc"/>
<property name="dvm.javadoc.resources.dir"
<mkdir dir="${dvm.javadoc.resources.dir}"/>
<property name="" location="${}/images"/>
<mdkir dir="${}"/>
<property name="" location="${}/fonts"/>
<mkdir dir="${}"/>
<property name="" location="${}/css"/>
<mkdir dir="${}"/>
<property name="buildsystem.anttasklibs.dir"
<property name="buildsystem.codeqa.dir"
<property name="buildsystem.codeqa.images.dir"
<property name="buildsystem.codeqa.css.dir"
<property name="buildsystem.codeqa.fonts.dir"
<property name="buildsystem.apiviz.loc"
<copy todir="${}">
<fileset dir="${buildsystem.codeqa.css.dir}" />
<copy todir="${}">
<fileset dir="${buildsystem.codeqa.fonts.dir}"/>
<copy todir="${}">
<fileset dir="${buildsystem.codeqa.images.dir}"/>
<copy file="${buildsystem.codeqa.images.dir}/companylogo.png"
<path id="dvm.anttasklibs.paths">
<fileset dir="${buildsystem.anttasklibs.dir}" includes="**/*.jar"/>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
<taskdef resource=""
<property name="dvm.checkstyle.file"
<property name="dvm.checkstyle.xsl.loc"
<property name="dvm.pmd.ruleset.file"
<property name="dvm.pmd.xsl.loc"
<path id="dvm.javadoc.source">
<pathelement path="${source.absolute.dir}"/>
<pathelement path="${gen.absolute.dir}"/>
<!-- Path needs to include both Android jars and
3rd party library jars in libs
Need to included tested.project
classes to feed into javadoc task-->
<path id="">
<fileset dir="${native.libs.dir}">
<include name="**/*.jar"/>
<path refid=""/>
<fileset dir="${tested.project.dir}/build/classes">
<include name="**/*.class"/>
<path id="dvm.classes.classpath">
<fileset dir="build/classes">
<include name="**/*.class"/>
<target name="-dvm.checkstyle">
<checkstyle config="${dvm.checkstyle.file}"
<formatter type="xml"
<fileset dir="${source.absolute.dir}" includes="**/*.java"/>
<classpath refid="dvm.classes.classpath"/>
<property key="checkstyle.cache.file" file="${basedir}/cachefile"/>
<xslt basedir="${}" destdir="${}"
<param name="project" expression="${}"/>
<param name="today" expression="${DSTAMP}"/>
<param name="company" expression="${company}"/>
<mapper type="glob" from="checkstyle.xml" to="checkstyle.html"/>
<target name="-dvm.pmd">
<pmd rulesetfiles="${pmd.ruleset.file}">
<path refid=""/>
<pathelement location="${out.classes.absolute.dir}" />
<path refid="jar.libs.ref"/>
<formatter type="xml" toFile="${}/pmd.xml"/>
<fileset dir="${source.absolute.dir}" includes="**/*.java" />
<xslt basedir="${}" destdir="${}"
<param name="project" expression="${}"/>
<param name="today" expression="${DSTAMP}"/>
<param name="comnpany" expression="${company}"/>
<param name="rulesets" expression="androidrules"/>
<mapper type="glob" from="pmd.xml" to="pmd.html"/>
<target name="-dvm.apivizdoclet">
additionalparam="-author -version -sourceclasspath ${out.classes.dir}">
<!-- Use a nice documentation title -->
API Specification
<!-- Create a header that contains the taglets logo -->
<!-- Note the use of the {@docRoot} tag to link to the logo -->
width=&quot;88&quot; height=&quot;40&quot; border=&quot;0&quot;
<!-- Same for the footer -->
width=&quot;88&quot; height=&quot;40&quot;
<!-- Include a timestamp at the bottom of the docu generated -->
<!-- Note the use of ${timestamp} which was created by the -->
<!-- <tstamp> task at the start of this target -->
&lt;p align=&quot;right&quot;&gt;
&lt;font class=&quot;NavBarFont1&quot; size=&quot;-1&quot;&gt;
Android SDK API Target ${target}&lt;br&gt;
API Spec&lt;br&gt;
<doclet name="org.jboss.apiviz.APIviz"
Jump to Line
Something went wrong with that request. Please try again.