1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="android_rules" default="debug">
5 This build file is imported by the project build file. It contains
6 all the targets and tasks necessary to build Android projects, be they
7 regular projects, library projects, or test projects.
9 At the beginning of the file is a list of properties that can be overridden
10 by adding them to your ant.properties (properties are immutable, so their
11 first definition sticks and is never changed).
14 - custom task definitions,
15 - more properties (do not override those unless the whole build system is modified).
16 - macros used throughout the build,
18 - debug-specific build targets,
19 - release-specific build targets,
20 - instrument-specific build targets,
21 - test project-specific build targets,
26 <!-- ******************************************************* -->
27 <!-- **************** Overridable Properties *************** -->
28 <!-- ******************************************************* -->
30 <!-- You can override these values in your build.xml or ant.properties.
31 Overriding any other properties may result in broken build. -->
33 <!-- Tells adb which device to target. You can change this from the command line
34 by invoking "ant -Dadb.device.arg=-d" for device "ant -Dadb.device.arg=-e" for
36 <property name="adb.device.arg" value="" />
38 <!-- fileset exclude patterns (space separated) to prevent
39 files inside src/ from being packaged. -->
40 <property name="android.package.excludes" value="" />
42 <!-- set some properties used for filtering/override. If those weren't defined
43 before, then this will create them with empty values, which are then ignored
44 by the custom tasks receiving them. -->
45 <property name="version.code" value="" />
46 <property name="version.name" value="" />
47 <property name="aapt.resource.filter" value="" />
48 <!-- 'aapt.ignore.assets' is the list of file patterns to ignore under /res and /assets.
49 Default is "!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
51 Overall patterns syntax is:
52 [!][<dir>|<file>][*suffix-match|prefix-match*|full-match]:more:patterns...
54 - The first character flag ! avoids printing a warning.
55 - Pattern can have the flag "<dir>" to match only directories
56 or "<file>" to match only files. Default is to match both.
57 - Match is not case-sensitive.
59 <property name="aapt.ignore.assets" value="" />
61 <!-- dex force jumbo options, to be used when dex merging fails with
62 UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.util.DexException: Cannot handle conversion to jumbo index!
63 at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:103)
66 <property name="dex.force.jumbo" value="false" />
67 <property name="dex.disable.merger" value="false" />
69 <!-- compilation options -->
70 <property name="java.encoding" value="UTF-8" />
71 <property name="java.target" value="1.5" />
72 <property name="java.source" value="1.5" />
73 <property name="java.compilerargs" value="" />
74 <property name="java.compiler.classpath" value="" />
76 <!-- Renderscript options -->
77 <property name="renderscript.debug.opt.level" value="O0" />
78 <property name="renderscript.release.opt.level" value="O3" />
79 <property name="renderscript.support.mode" value="false" />
81 <!-- manifest merger default value -->
82 <property name="manifestmerger.enabled" value="false" />
84 <!-- instrumentation options -->
85 <property name="emma.filter" value="" />
88 <property name="verbose" value="false" />
90 <!-- Output location of the HTML report for the "lint" target.
91 Ideally this would be specified as
92 value="${out.dir}/lint-results.html"
93 but we can't make a forward reference to the definition for
94 ${out.dir}, and it is not a configurable property (yet).
96 <property name="lint.out.html" value="bin/lint-results.html" />
98 <!-- Output location of the XML report for the "lint" target -->
99 <property name="lint.out.xml" value="bin/lint-results.xml" />
101 <!-- ******************************************************* -->
102 <!-- ********************* Custom Tasks ******************** -->
103 <!-- ******************************************************* -->
105 <!-- jar file from where the tasks are loaded -->
106 <path id="android.antlibs">
107 <pathelement path="${sdk.dir}/tools/lib/ant-tasks.jar" />
110 <!-- Custom tasks -->
111 <taskdef resource="anttasks.properties" classpathref="android.antlibs" />
113 <!-- Emma configuration -->
114 <property name="emma.dir" value="${sdk.dir}/tools/lib" />
116 <pathelement location="${emma.dir}/emma.jar" />
117 <pathelement location="${emma.dir}/emma_ant.jar" />
119 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
120 <!-- End of emma configuration -->
123 <!-- ******************************************************* -->
124 <!-- ******************* Other Properties ****************** -->
125 <!-- ******************************************************* -->
126 <!-- overriding these properties may break the build
127 unless the whole file is updated -->
129 <!-- Input directories -->
130 <property name="source.dir" value="src" />
131 <property name="source.absolute.dir" location="${source.dir}" />
132 <property name="gen.absolute.dir" location="gen" />
133 <property name="resource.absolute.dir" location="res" />
134 <property name="asset.dir" value="assets" />
135 <property name="asset.absolute.dir" location="${asset.dir}" />
136 <property name="jar.libs.dir" value="libs" />
137 <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" />
138 <property name="native.libs.absolute.dir" location="libs" />
140 <property name="manifest.file" value="AndroidManifest.xml" />
141 <property name="manifest.abs.file" location="${manifest.file}" />
143 <!-- Output directories -->
144 <property name="out.dir" value="bin" />
145 <property name="out.absolute.dir" location="${out.dir}" />
146 <property name="out.classes.absolute.dir" location="${out.dir}/classes" />
147 <property name="out.res.absolute.dir" location="${out.dir}/res" />
148 <property name="out.rs.obj.absolute.dir" location="${out.dir}/rsObj" />
149 <property name="out.rs.libs.absolute.dir" location="${out.dir}/rsLibs" />
150 <property name="out.aidl.absolute.dir" location="${out.dir}/aidl" />
151 <property name="out.dexed.absolute.dir" location="${out.dir}/dexedLibs" />
152 <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.xml" />
154 <!-- tools location -->
155 <property name="android.tools.dir" location="${sdk.dir}/tools" />
156 <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
157 <condition property="exe" value=".exe" else=""><os family="windows" /></condition>
158 <condition property="bat" value=".bat" else=""><os family="windows" /></condition>
159 <property name="adb" location="${android.platform.tools.dir}/adb${exe}" />
160 <property name="lint" location="${android.tools.dir}/lint${bat}" />
162 <!-- Intermediate files -->
163 <property name="dex.file.name" value="classes.dex" />
164 <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
165 <property name="resource.package.file.name" value="${ant.project.name}.ap_" />
167 <!-- Build property file -->
168 <property name="out.build.prop.file" location="${out.absolute.dir}/build.prop" />
171 <!-- This is needed by emma as it uses multilevel verbosity instead of simple 'true' or 'false'
172 The property 'verbosity' is not user configurable and depends exclusively on 'verbose'
174 <condition property="verbosity" value="verbose" else="quiet">
175 <istrue value="${verbose}" />
178 <!-- properties for signing in release mode -->
179 <condition property="has.keystore">
181 <isset property="key.store" />
182 <length string="${key.store}" when="greater" length="0" />
183 <isset property="key.alias" />
186 <condition property="has.password">
188 <isset property="has.keystore" />
189 <isset property="key.store.password" />
190 <isset property="key.alias.password" />
194 <!-- properties for packaging -->
195 <property name="build.packaging.nocrunch" value="true" />
197 <!-- whether we need to fork javac.
198 This is only needed on Windows when running Java < 7 -->
199 <condition else="false" property="need.javac.fork">
201 <matches pattern="1\.[56]" string="${java.specification.version}"/>
208 <!-- ******************************************************* -->
209 <!-- ************************ Macros *********************** -->
210 <!-- ******************************************************* -->
212 <!-- macro to do a task on if project.is.library is false.
213 elseText attribute is displayed otherwise -->
214 <macrodef name="do-only-if-not-library">
215 <attribute name="elseText" />
216 <element name="task-to-do" implicit="yes" />
218 <if condition="${project.is.library}">
223 <echo level="info">@{elseText}</echo>
229 <!-- macro to do a task on if manifest.hasCode is true.
230 elseText attribute is displayed otherwise -->
231 <macrodef name="do-only-if-manifest-hasCode">
232 <attribute name="elseText" default=""/>
233 <element name="task-to-do" implicit="yes" />
235 <if condition="${manifest.hasCode}">
242 <length string="@{elseText}" trim="true" when="greater" length="0" />
245 <echo level="info">@{elseText}</echo>
254 <!-- Configurable macro, which allows to pass as parameters output directory,
255 output dex filename and external libraries to dex (optional) -->
256 <macrodef name="dex-helper">
257 <element name="external-libs" optional="yes" />
258 <attribute name="nolocals" default="false" />
260 <!-- sets the primary input for dex. If a pre-dex task sets it to
261 something else this has no effect -->
262 <property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" />
264 <!-- set the secondary dx input: the project (and library) jar files
265 If a pre-dex task sets it to something else this has no effect -->
268 <isreference refid="out.dex.jar.input.ref" />
271 <path id="out.dex.jar.input.ref">
272 <path refid="project.all.jars.path" />
277 <dex executable="${dx}"
278 output="${intermediate.dex.file}"
279 dexedlibs="${out.dexed.absolute.dir}"
280 nolocals="@{nolocals}"
281 forceJumbo="${dex.force.jumbo}"
282 disableDexMerger="${dex.disable.merger}"
283 verbose="${verbose}">
284 <path path="${out.dex.input.absolute.dir}"/>
285 <path refid="out.dex.jar.input.ref" />
291 <!-- This is macro that enable passing variable list of external jar files to ApkBuilder
295 <jarfolder path="my_jars" />
296 <jarfile path="foo/bar.jar" />
297 <jarfolder path="your_jars" />
299 </package-helper> -->
300 <macrodef name="package-helper">
301 <element name="extra-jars" optional="yes" />
304 outfolder="${out.absolute.dir}"
305 resourcefile="${resource.package.file.name}"
306 apkfilepath="${out.packaged.file}"
307 debugpackaging="${build.is.packaging.debug}"
308 debugsigning="${build.is.signing.debug}"
310 hascode="${manifest.hasCode}"
311 previousBuildType="${build.last.is.packaging.debug}/${build.last.is.signing.debug}"
312 buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
313 <dex path="${intermediate.dex.file}"/>
314 <sourcefolder path="${source.absolute.dir}"/>
315 <jarfile refid="project.all.jars.path" />
316 <nativefolder path="${native.libs.absolute.dir}" />
317 <nativefolder refid="project.library.native.folder.path" />
318 <nativefolder refid="project.rs.support.libs.path" />
319 <nativefolder path="${out.rs.libs.absolute.dir}" />
325 <!-- This is macro which zipaligns in.package and outputs it to out.package. Used by targets
326 debug, -debug-with-emma and release.-->
327 <macrodef name="zipalign-helper">
328 <attribute name="in.package" />
329 <attribute name="out.package" />
332 executable="${zipalign}"
333 input="@{in.package}"
334 output="@{out.package}"
335 verbose="${verbose}" />
339 <macrodef name="run-tests-helper">
340 <attribute name="emma.enabled" default="false" />
341 <element name="extra-instrument-args" optional="yes" />
343 <echo level="info">Running tests ...</echo>
344 <exec executable="${adb}" failonerror="true">
345 <arg line="${adb.device.arg}" />
346 <arg value="shell" />
348 <arg value="instrument" />
351 <arg value="coverage" />
352 <arg value="@{emma.enabled}" />
353 <extra-instrument-args />
354 <arg value="${project.app.package}/${test.runner}" />
359 <macrodef name="record-build-key">
360 <attribute name="key" default="false" />
361 <attribute name="value" default="false" />
363 <propertyfile file="${out.build.prop.file}" comment="Last build type">
364 <entry key="@{key}" value="@{value}"/>
369 <macrodef name="record-build-info">
371 <record-build-key key="build.last.target" value="${build.target}" />
372 <record-build-key key="build.last.is.instrumented" value="${build.is.instrumented}" />
373 <record-build-key key="build.last.is.packaging.debug" value="${build.is.packaging.debug}" />
374 <record-build-key key="build.last.is.signing.debug" value="${build.is.signing.debug}" />
378 <macrodef name="uninstall-helper">
379 <attribute name="app.package" default="false" />
381 <echo level="info">Uninstalling @{app.package} from the default emulator or device...</echo>
382 <exec executable="${adb}" failonerror="true">
383 <arg line="${adb.device.arg}" />
384 <arg value="uninstall" />
385 <arg value="@{app.package}" />
390 <!-- ******************************************************* -->
391 <!-- ******************** Build Targets ******************** -->
392 <!-- ******************************************************* -->
394 <!-- Basic Ant + SDK check -->
395 <target name="-check-env">
399 <!-- target to disable building dependencies -->
400 <target name="nodeps">
401 <property name="dont.do.deps" value="true" />
404 <!-- generic setup -->
405 <target name="-setup" depends="-check-env">
406 <echo level="info">Project Name: ${ant.project.name}</echo>
407 <gettype projectTypeOut="project.type" />
409 <!-- sets a few boolean based on project.type
410 to make the if task easier -->
411 <condition property="project.is.library" value="true" else="false">
412 <equals arg1="${project.type}" arg2="library" />
414 <condition property="project.is.test" value="true" else="false">
415 <equals arg1="${project.type}" arg2="test" />
417 <condition property="project.is.testapp" value="true" else="false">
418 <equals arg1="${project.type}" arg2="test-app" />
421 <!-- If a test project, resolve absolute path to tested project. -->
422 <if condition="${project.is.test}">
424 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
428 <!-- get the project manifest package -->
429 <xpath input="${manifest.abs.file}"
430 expression="/manifest/@package" output="project.app.package" />
434 <!-- empty default pre-clean target. Create a similar target in
435 your build.xml and it'll be called instead of this one. -->
436 <target name="-pre-clean"/>
438 <!-- clean target -->
439 <target name="clean" depends="-setup, -pre-clean"
440 description="Removes output files created by other targets.">
441 <delete dir="${out.absolute.dir}" verbose="${verbose}" />
442 <delete dir="${gen.absolute.dir}" verbose="${verbose}" />
444 <!-- if we know about a tested project or libraries, we clean them too. -->
445 <if condition="${project.is.test}">
447 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
448 <subant failonerror="true">
449 <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
450 <target name="clean" />
455 <!-- get all the libraries -->
457 <condition><not><isset property="dont.do.deps" /></not></condition>
459 <getlibpath libraryFolderPathOut="project.library.folder.path" />
462 <isreference refid="project.library.folder.path" />
465 <!-- clean the libraries with nodeps since we already
466 know about all the libraries even the indirect one -->
468 buildpathref="project.library.folder.path"
471 <target name="nodeps" />
472 <target name="clean" />
480 <!-- Pre build setup -->
481 <target name="-build-setup" depends="-setup">
482 <!-- find location of build tools -->
483 <getbuildtools name="android.build.tools.dir" verbose="${verbose}" />
485 <!-- read the previous build mode -->
486 <property file="${out.build.prop.file}" />
487 <!-- if empty the props won't be set, meaning it's a new build.
488 To force a build, set the prop to empty values. -->
489 <property name="build.last.target" value="" />
490 <property name="build.last.is.instrumented" value="" />
491 <property name="build.last.is.packaging.debug" value="" />
492 <property name="build.last.is.signing.debug" value="" />
494 <!-- If the "debug" build type changed, clear out the compiled code.
495 This is to make sure the new BuildConfig.DEBUG value is picked up
496 as javac can't deal with this type of change in its dependency computation. -->
500 <length string="${build.last.is.packaging.debug}" trim="true" when="greater" length="0" />
502 arg1="${build.is.packaging.debug}"
503 arg2="${build.last.is.packaging.debug}" /></not>
507 <echo level="info">Switching between debug and non debug build: Deleting previous compilation output...</echo>
508 <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" />
511 <!-- Else, we may still need to clean the code, for another reason.
512 special case for instrumented: if the previous build was
513 instrumented but not this one, clear out the compiled code -->
517 <istrue value="${build.last.is.instrumented}" />
518 <isfalse value="${build.is.instrumented}" />
522 <echo level="info">Switching from instrumented to non-instrumented build: Deleting previous compilation output...</echo>
523 <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" />
529 <echo level="info">Resolving Build Target for ${ant.project.name}...</echo>
530 <!-- load project properties, resolve Android target, library dependencies
531 and set some properties with the results.
532 All property names are passed as parameters ending in -Out -->
534 androidJarFileOut="project.target.android.jar"
535 androidAidlFileOut="project.target.framework.aidl"
536 bootClassPathOut="project.target.class.path"
537 targetApiOut="project.target.apilevel"
538 minSdkVersionOut="project.minSdkVersion" />
540 <!-- Value of the hasCode attribute (Application node) extracted from manifest file -->
541 <xpath input="${manifest.abs.file}" expression="/manifest/application/@android:hasCode"
542 output="manifest.hasCode" default="true"/>
544 <echo level="info">----------</echo>
545 <echo level="info">Creating output directories if needed...</echo>
546 <mkdir dir="${resource.absolute.dir}" />
547 <mkdir dir="${jar.libs.absolute.dir}" />
548 <mkdir dir="${out.absolute.dir}" />
549 <mkdir dir="${out.res.absolute.dir}" />
550 <mkdir dir="${out.rs.obj.absolute.dir}" />
551 <mkdir dir="${out.rs.libs.absolute.dir}" />
552 <do-only-if-manifest-hasCode>
553 <mkdir dir="${gen.absolute.dir}" />
554 <mkdir dir="${out.classes.absolute.dir}" />
555 <mkdir dir="${out.dexed.absolute.dir}" />
556 </do-only-if-manifest-hasCode>
558 <echo level="info">----------</echo>
559 <echo level="info">Resolving Dependencies for ${ant.project.name}...</echo>
561 libraryFolderPathOut="project.library.folder.path"
562 libraryPackagesOut="project.library.packages"
563 libraryManifestFilePathOut="project.library.manifest.file.path"
564 libraryResFolderPathOut="project.library.res.folder.path"
565 libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.path"
566 libraryRFilePathOut="project.library.bin.r.file.path"
567 libraryNativeFolderPathOut="project.library.native.folder.path"
568 jarLibraryPathOut="project.all.jars.path"
569 targetApi="${project.target.apilevel}"
570 renderscriptSupportMode="${renderscript.support.mode}"
571 buildToolsFolder="${android.build.tools.dir}"
572 renderscriptSupportLibsOut="project.rs.support.libs.path"
573 verbose="${verbose}" />
575 <!-- compile the libraries if any -->
579 <isreference refid="project.library.folder.path" />
580 <not><isset property="dont.do.deps" /></not>
584 <!-- figure out which target must be used to build the library projects.
585 If emma is enabled, then use 'instrument' otherwise, use 'debug' -->
586 <condition property="project.libraries.target" value="instrument" else="${build.target}">
587 <istrue value="${build.is.instrumented}" />
590 <echo level="info">----------</echo>
591 <echo level="info">Building Libraries with '${project.libraries.target}'...</echo>
593 <!-- no need to build the deps as we have already
594 the full list of libraries -->
595 <subant failonerror="true"
596 buildpathref="project.library.folder.path"
598 <target name="nodeps" />
599 <target name="${project.libraries.target}" />
600 <property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" />
605 <!-- compile the main project if this is a test project -->
606 <if condition="${project.is.test}">
608 <!-- figure out which target must be used to build the tested project.
609 If emma is enabled, then use 'instrument' otherwise, use 'debug' -->
610 <condition property="tested.project.target" value="instrument" else="debug">
611 <isset property="emma.enabled" />
614 <echo level="info">----------</echo>
615 <echo level="info">Building tested project at ${tested.project.absolute.dir} with '${tested.project.target}'...</echo>
616 <subant target="${tested.project.target}" failonerror="true">
617 <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
620 <!-- get the tested project full classpath to be able to build
622 <testedprojectclasspath
623 projectLocation="${tested.project.absolute.dir}"
624 projectClassPathOut="tested.project.classpath"/>
627 <!-- no tested project, make an empty Path object so that javac doesn't
629 <path id="tested.project.classpath" />
634 <!-- empty default pre-build target. Create a similar target in
635 your build.xml and it'll be called instead of this one. -->
636 <target name="-pre-build"/>
638 <!-- Code Generation: compile resources (aapt -> R.java), aidl, renderscript -->
639 <target name="-code-gen">
640 <!-- always merge manifest -->
642 appManifest="${manifest.abs.file}"
643 outManifest="${out.manifest.abs.file}"
644 enabled="${manifestmerger.enabled}">
645 <library refid="project.library.manifest.file.path" />
648 <do-only-if-manifest-hasCode
649 elseText="hasCode = false. Skipping aidl/renderscript/R.java">
650 <echo level="info">Handling aidl files...</echo>
651 <aidl executable="${aidl}"
652 framework="${project.target.framework.aidl}"
653 libraryBinAidlFolderPathRefid="project.library.bin.aidl.folder.path"
654 genFolder="${gen.absolute.dir}"
655 aidlOutFolder="${out.aidl.absolute.dir}">
656 <source path="${source.absolute.dir}"/>
659 <!-- renderscript generates resources so it must be called before aapt -->
660 <echo level="info">----------</echo>
661 <echo level="info">Handling RenderScript files...</echo>
662 <!-- set the rs target prop in case it hasn't been set. -->
663 <property name="renderscript.target" value="${project.minSdkVersion}" />
665 buildToolsRoot="${android.build.tools.dir}"
666 genFolder="${gen.absolute.dir}"
667 resFolder="${out.res.absolute.dir}"
668 rsObjFolder="${out.rs.obj.absolute.dir}"
669 libsFolder="${out.rs.libs.absolute.dir}"
670 targetApi="${renderscript.target}"
671 optLevel="${renderscript.opt.level}"
672 supportMode="${renderscript.support.mode}"
673 binFolder="${out.absolute.dir}"
674 buildType="${build.is.packaging.debug}"
675 previousBuildType="${build.last.is.packaging.debug}">
676 <source path="${source.absolute.dir}"/>
679 <echo level="info">----------</echo>
680 <echo level="info">Handling Resources...</echo>
681 <aapt executable="${aapt}"
684 manifest="${out.manifest.abs.file}"
685 originalManifestPackage="${project.app.package}"
686 androidjar="${project.target.android.jar}"
687 rfolder="${gen.absolute.dir}"
688 nonConstantId="${android.library}"
689 libraryResFolderPathRefid="project.library.res.folder.path"
690 libraryPackagesRefid="project.library.packages"
691 libraryRFileRefid="project.library.bin.r.file.path"
692 ignoreAssets="${aapt.ignore.assets}"
693 binFolder="${out.absolute.dir}"
694 proguardFile="${out.absolute.dir}/proguard.txt">
695 <res path="${out.res.absolute.dir}" />
696 <res path="${resource.absolute.dir}" />
699 <echo level="info">----------</echo>
700 <echo level="info">Handling BuildConfig class...</echo>
702 genFolder="${gen.absolute.dir}"
703 package="${project.app.package}"
704 buildType="${build.is.packaging.debug}"
705 previousBuildType="${build.last.is.packaging.debug}"/>
707 </do-only-if-manifest-hasCode>
710 <!-- empty default pre-compile target. Create a similar target in
711 your build.xml and it'll be called instead of this one. -->
712 <target name="-pre-compile"/>
714 <!-- Compiles this project's .java files into .class files. -->
715 <target name="-compile" depends="-pre-build, -build-setup, -code-gen, -pre-compile">
716 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
717 <!-- merge the project's own classpath and the tested project's classpath -->
718 <path id="project.javac.classpath">
719 <path refid="project.all.jars.path" />
720 <path refid="tested.project.classpath" />
721 <path path="${java.compiler.classpath}" />
723 <javac encoding="${java.encoding}"
724 source="${java.source}" target="${java.target}"
725 debug="true" extdirs="" includeantruntime="false"
726 destdir="${out.classes.absolute.dir}"
727 bootclasspathref="project.target.class.path"
729 classpathref="project.javac.classpath"
730 fork="${need.javac.fork}">
731 <src path="${source.absolute.dir}" />
732 <src path="${gen.absolute.dir}" />
733 <compilerarg line="${java.compilerargs}" />
736 <!-- if the project is instrumented, intrument the classes -->
737 <if condition="${build.is.instrumented}">
739 <echo level="info">Instrumenting classes from ${out.absolute.dir}/classes...</echo>
741 <!-- build the filter to remove R, Manifest, BuildConfig -->
743 appPackage="${project.app.package}"
744 libraryPackagesRefId="project.library.packages"
745 filterOut="emma.default.filter"/>
747 <!-- define where the .em file is going. This may have been
748 setup already if this is a library -->
749 <property name="emma.coverage.absolute.file" location="${out.absolute.dir}/coverage.em" />
751 <!-- It only instruments class files, not any external libs -->
752 <emma enabled="true">
753 <instr verbosity="${verbosity}"
755 instrpath="${out.absolute.dir}/classes"
756 outdir="${out.absolute.dir}/classes"
757 metadatafile="${emma.coverage.absolute.file}">
758 <filter excludes="${emma.default.filter}" />
759 <filter value="${emma.filter}" />
765 <!-- if the project is a library then we generate a jar file -->
766 <if condition="${project.is.library}">
768 <echo level="info">Creating library output jar file...</echo>
769 <property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" />
772 <length string="${android.package.excludes}" trim="true" when="greater" length="0" />
775 <echo level="info">Custom jar packaging exclusion: ${android.package.excludes}</echo>
779 <propertybyreplace name="project.app.package.path" input="${project.app.package}" replace="." with="/" />
781 <jar destfile="${out.library.jar.file}">
782 <fileset dir="${out.classes.absolute.dir}"
783 includes="**/*.class"
784 excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/BuildConfig.class"/>
785 <fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
790 </do-only-if-manifest-hasCode>
793 <!-- empty default post-compile target. Create a similar target in
794 your build.xml and it'll be called instead of this one. -->
795 <target name="-post-compile"/>
797 <!-- Obfuscate target
798 This is only active in release builds when proguard.config is defined
799 in default.properties.
801 To replace Proguard with a different obfuscation engine:
802 Override the following targets in your build.xml, before the call to <setup>
803 -release-obfuscation-check
804 Check whether obfuscation should happen, and put the result in a property.
805 -debug-obfuscation-check
806 Obfuscation should not happen. Set the same property to false.
808 check if the property set in -debug/release-obfuscation-check is set to true.
811 Set property out.dex.input.absolute.dir to be the output of the obfuscation
813 <target name="-obfuscate">
814 <if condition="${proguard.enabled}">
816 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard" />
817 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/original.jar" />
818 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar" />
819 <!-- input for dex will be proguard's output -->
820 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}" />
822 <!-- Add Proguard Tasks -->
823 <property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar" />
824 <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}" />
826 <!-- Set the android classpath Path object into a single property. It'll be
827 all the jar files separated by a platform path-separator.
828 Each path must be quoted if it contains spaces.
830 <pathconvert property="project.target.classpath.value" refid="project.target.class.path">
832 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
837 <!-- Build a path object with all the jar files that must be obfuscated.
838 This include the project compiled source code and any 3rd party jar
840 <path id="project.all.classes.path">
841 <pathelement location="${preobfuscate.jar.file}" />
842 <path refid="project.all.jars.path" />
844 <!-- Set the project jar files Path object into a single property. It'll be
845 all the jar files separated by a platform path-separator.
846 Each path must be quoted if it contains spaces.
848 <pathconvert property="project.all.classes.value" refid="project.all.classes.path">
850 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
855 <!-- Turn the path property ${proguard.config} from an A:B:C property
856 into a series of includes: -include A -include B -include C
857 suitable for processing by the ProGuard task. Note - this does
858 not include the leading '-include "' or the closing '"'; those
859 are added under the <proguard> call below.
861 <path id="proguard.configpath">
862 <pathelement path="${proguard.config}"/>
864 <pathconvert pathsep='" -include "' property="proguard.configcmd" refid="proguard.configpath"/>
866 <mkdir dir="${obfuscate.absolute.dir}" />
867 <delete file="${preobfuscate.jar.file}"/>
868 <delete file="${obfuscated.jar.file}"/>
869 <jar basedir="${out.classes.absolute.dir}"
870 destfile="${preobfuscate.jar.file}" />
872 -include "${proguard.configcmd}"
873 -include "${out.absolute.dir}/proguard.txt"
874 -injars ${project.all.classes.value}
875 -outjars "${obfuscated.jar.file}"
876 -libraryjars ${project.target.classpath.value}
877 -dump "${obfuscate.absolute.dir}/dump.txt"
878 -printseeds "${obfuscate.absolute.dir}/seeds.txt"
879 -printusage "${obfuscate.absolute.dir}/usage.txt"
880 -printmapping "${obfuscate.absolute.dir}/mapping.txt"
886 <!-- Converts this project's .class files into .dex files -->
887 <target name="-dex" depends="-compile, -post-compile, -obfuscate">
888 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
889 <!-- only convert to dalvik bytecode is *not* a library -->
890 <do-only-if-not-library elseText="Library project: do not convert bytecode..." >
891 <!-- special case for instrumented builds: need to use no-locals and need
892 to pass in the emma jar. -->
893 <if condition="${build.is.instrumented}">
895 <dex-helper nolocals="true">
897 <fileset file="${emma.dir}/emma_device.jar" />
905 </do-only-if-not-library>
906 </do-only-if-manifest-hasCode>
909 <!-- Updates the pre-processed PNG cache -->
910 <target name="-crunch">
911 <exec executable="${aapt}" taskName="crunch">
912 <arg value="crunch" />
915 <arg path="${resource.absolute.dir}" />
917 <arg path="${out.res.absolute.dir}" />
921 <!-- Puts the project's resources into the output package file
922 This actually can create multiple resource package in case
923 Some custom apk with specific configuration have been
924 declared in default.properties.
926 <target name="-package-resources" depends="-crunch">
927 <!-- only package resources if *not* a library project -->
928 <do-only-if-not-library elseText="Library project: do not package resources..." >
929 <aapt executable="${aapt}"
931 versioncode="${version.code}"
932 versionname="${version.name}"
933 debug="${build.is.packaging.debug}"
934 manifest="${out.manifest.abs.file}"
935 assets="${asset.absolute.dir}"
936 androidjar="${project.target.android.jar}"
937 apkfolder="${out.absolute.dir}"
938 nocrunch="${build.packaging.nocrunch}"
939 resourcefilename="${resource.package.file.name}"
940 resourcefilter="${aapt.resource.filter}"
941 libraryResFolderPathRefid="project.library.res.folder.path"
942 libraryPackagesRefid="project.library.packages"
943 libraryRFileRefid="project.library.bin.r.file.path"
944 previousBuildType="${build.last.target}"
945 buildType="${build.target}"
946 ignoreAssets="${aapt.ignore.assets}">
947 <res path="${out.res.absolute.dir}" />
948 <res path="${resource.absolute.dir}" />
949 <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
950 <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
952 </do-only-if-not-library>
955 <!-- Packages the application. -->
956 <target name="-package" depends="-dex, -package-resources">
957 <!-- only package apk if *not* a library project -->
958 <do-only-if-not-library elseText="Library project: do not package apk..." >
959 <if condition="${build.is.instrumented}">
963 <!-- Injected from external file -->
964 <jarfile path="${emma.dir}/emma_device.jar" />
972 </do-only-if-not-library>
975 <target name="-post-package" />
976 <target name="-post-build" />
978 <target name="-set-mode-check">
979 <fail if="build.is.mode.set"
980 message="Cannot run two different modes at the same time. If you are running more than one debug/release/instrument type targets, call them from different Ant calls." />
983 <!-- ******************************************************* -->
984 <!-- **************** Debug specific targets *************** -->
985 <!-- ******************************************************* -->
987 <target name="-set-debug-files" depends="-set-mode-check">
989 <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk" />
990 <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-debug.apk" />
991 <property name="build.is.mode.set" value="true" />
995 <target name="-set-debug-mode" depends="-setup">
996 <!-- record the current build target -->
997 <property name="build.target" value="debug" />
1002 <istrue value="${project.is.testapp}" />
1003 <istrue value="${emma.enabled}" />
1007 <property name="build.is.instrumented" value="true" />
1010 <property name="build.is.instrumented" value="false" />
1014 <!-- whether the build is a debug build. always set. -->
1015 <property name="build.is.packaging.debug" value="true" />
1017 <!-- signing mode: debug -->
1018 <property name="build.is.signing.debug" value="true" />
1020 <!-- Renderscript optimization level: none -->
1021 <property name="renderscript.opt.level" value="${renderscript.debug.opt.level}" />
1025 <target name="-debug-obfuscation-check">
1026 <!-- proguard is never enabled in debug mode -->
1027 <property name="proguard.enabled" value="false"/>
1030 <!-- Builds debug output package -->
1031 <target name="-do-debug" depends="-set-debug-mode, -debug-obfuscation-check, -package, -post-package">
1032 <!-- only create apk if *not* a library project -->
1033 <do-only-if-not-library elseText="Library project: do not create apk..." >
1035 <zipalign-helper in.package="${out.packaged.file}" out.package="${out.final.file}" />
1036 <echo level="info">Debug Package: ${out.final.file}</echo>
1038 </do-only-if-not-library>
1039 <record-build-info />
1042 <!-- Builds debug output package -->
1043 <target name="debug" depends="-set-debug-files, -do-debug, -post-build"
1044 description="Builds the application and signs it with a debug key.">
1048 <!-- ******************************************************* -->
1049 <!-- *************** Release specific targets ************** -->
1050 <!-- ******************************************************* -->
1052 <!-- called through target 'release'. Only executed if the keystore and
1053 key alias are known but not their password. -->
1054 <target name="-release-prompt-for-password" if="has.keystore" unless="has.password">
1055 <!-- Gets passwords -->
1057 message="Please enter keystore password (store:${key.store}):"
1058 addproperty="key.store.password" />
1060 message="Please enter password for alias '${key.alias}':"
1061 addproperty="key.alias.password" />
1064 <!-- called through target 'release'. Only executed if there's no
1065 keystore/key alias set -->
1066 <target name="-release-nosign" unless="has.keystore">
1067 <!-- no release builds for library project -->
1068 <do-only-if-not-library elseText="" >
1070 <echo level="info">No key.store and key.alias properties found in build.properties.</echo>
1071 <echo level="info">Please sign ${out.packaged.file} manually</echo>
1072 <echo level="info">and run zipalign from the Android SDK tools.</echo>
1074 </do-only-if-not-library>
1075 <record-build-info />
1078 <target name="-release-obfuscation-check">
1079 <echo level="info">proguard.config is ${proguard.config}</echo>
1080 <condition property="proguard.enabled" value="true" else="false">
1082 <isset property="build.is.mode.release" />
1083 <isset property="proguard.config" />
1086 <if condition="${proguard.enabled}">
1088 <echo level="info">Proguard.config is enabled</echo>
1089 <!-- Secondary dx input (jar files) is empty since all the
1090 jar files will be in the obfuscated jar -->
1091 <path id="out.dex.jar.input.ref" />
1096 <target name="-set-release-mode" depends="-set-mode-check">
1097 <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-release-unsigned.apk" />
1098 <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-release.apk" />
1099 <property name="build.is.mode.set" value="true" />
1101 <!-- record the current build target -->
1102 <property name="build.target" value="release" />
1104 <property name="build.is.instrumented" value="false" />
1106 <!-- release mode is only valid if the manifest does not explicitly
1107 set debuggable to true. default is false. -->
1108 <xpath input="${manifest.abs.file}" expression="/manifest/application/@android:debuggable"
1109 output="build.is.packaging.debug" default="false"/>
1111 <!-- signing mode: release -->
1112 <property name="build.is.signing.debug" value="false" />
1114 <!-- Renderscript optimization level: aggressive -->
1115 <property name="renderscript.opt.level" value="${renderscript.release.opt.level}" />
1117 <if condition="${build.is.packaging.debug}">
1119 <echo>*************************************************</echo>
1120 <echo>**** Android Manifest has debuggable=true ****</echo>
1121 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo>
1122 <echo>*************************************************</echo>
1125 <!-- property only set in release mode.
1126 Useful for if/unless attributes in target node
1127 when using Ant before 1.8 -->
1128 <property name="build.is.mode.release" value="true"/>
1133 <target name="-release-sign" if="has.keystore" >
1134 <!-- only create apk if *not* a library project -->
1135 <do-only-if-not-library elseText="Library project: do not create apk..." >
1137 <property name="out.unaligned.file" location="${out.absolute.dir}/${ant.project.name}-release-unaligned.apk" />
1139 <!-- Signs the APK -->
1140 <echo level="info">Signing final apk...</echo>
1142 input="${out.packaged.file}"
1143 output="${out.unaligned.file}"
1144 keystore="${key.store}"
1145 storepass="${key.store.password}"
1146 alias="${key.alias}"
1147 keypass="${key.alias.password}"/>
1149 <!-- Zip aligns the APK -->
1151 in.package="${out.unaligned.file}"
1152 out.package="${out.final.file}" />
1153 <echo level="info">Release Package: ${out.final.file}</echo>
1155 </do-only-if-not-library>
1156 <record-build-info />
1159 <!-- This runs -package-release and -release-nosign first and then runs
1160 only if release-sign is true (set in -release-check,
1161 called by -release-no-sign)-->
1162 <target name="release"
1163 depends="-set-release-mode, -release-obfuscation-check, -package, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -post-build"
1164 description="Builds the application in release mode.">
1167 <!-- ******************************************************* -->
1168 <!-- ************ Instrumented specific targets ************ -->
1169 <!-- ******************************************************* -->
1171 <!-- These targets are specific for the project under test when it
1172 gets compiled by the test projects in a way that will make it
1173 support emma code coverage -->
1175 <target name="-set-instrumented-mode" depends="-set-mode-check">
1176 <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-instrumented-unaligned.apk" />
1177 <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-instrumented.apk" />
1178 <property name="build.is.mode.set" value="true" />
1180 <!-- whether the build is an instrumented build. -->
1181 <property name="build.is.instrumented" value="true" />
1184 <!-- Builds instrumented output package -->
1185 <target name="instrument" depends="-set-instrumented-mode, -do-debug"
1186 description="Builds an instrumented packaged.">
1187 <!-- only create apk if *not* a library project -->
1188 <do-only-if-not-library elseText="Library project: do not create apk..." >
1190 <zipalign-helper in.package="${out.packaged.file}" out.package="${out.final.file}" />
1191 <echo level="info">Instrumented Package: ${out.final.file}</echo>
1193 </do-only-if-not-library>
1194 <record-build-info />
1197 <!-- ******************************************************* -->
1198 <!-- ************ Test project specific targets ************ -->
1199 <!-- ******************************************************* -->
1201 <!-- enable code coverage -->
1202 <target name="emma">
1203 <property name="emma.enabled" value="true" />
1206 <!-- fails if the project is not a test project -->
1207 <target name="-test-project-check" depends="-setup">
1211 <isfalse value="${project.is.test}" />
1212 <isfalse value="${project.is.testapp}" />
1216 <fail message="Project is not a test project." />
1221 <target name="test" depends="-test-project-check"
1222 description="Runs tests from the package defined in test.package property">
1223 <property name="test.runner" value="android.test.InstrumentationTestRunner" />
1225 <if condition="${project.is.test}">
1227 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
1229 <!-- Application package of the tested project extracted from its manifest file -->
1230 <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
1231 expression="/manifest/@package" output="tested.project.app.package" />
1233 <if condition="${emma.enabled}">
1235 <getprojectpaths projectPath="${tested.project.absolute.dir}"
1236 binOut="tested.project.out.absolute.dir"
1237 srcOut="tested.project.source.absolute.dir" />
1239 <getlibpath projectPath="${tested.project.absolute.dir}"
1240 libraryFolderPathOut="tested.project.lib.source.path"
1241 leaf="@{source.dir}" />
1248 <!-- this is a test app, the tested package is the app's own package -->
1249 <property name="tested.project.app.package" value="${project.app.package}" />
1251 <if condition="${emma.enabled}">
1253 <property name="tested.project.out.absolute.dir" value="${out.absolute.dir}" />
1254 <property name="tested.project.source.absolute.dir" value="${source.absolute.dir}" />
1257 libraryFolderPathOut="tested.project.lib.source.path"
1258 leaf="@{source.dir}" />
1266 <property name="emma.dump.file"
1267 value="/data/data/${tested.project.app.package}/coverage.ec" />
1269 <if condition="${emma.enabled}">
1271 <echo>Running tests...</echo>
1272 <run-tests-helper emma.enabled="true">
1273 <extra-instrument-args>
1275 <arg value="coverageFile" />
1276 <arg value="${emma.dump.file}" />
1277 </extra-instrument-args>
1280 <echo level="info">Setting permission to download the coverage file...</echo>
1281 <exec executable="${adb}" failonerror="true">
1282 <arg line="${adb.device.arg}" />
1283 <arg value="shell" />
1284 <arg value="run-as" />
1285 <arg value="${tested.project.app.package}" />
1286 <arg value="chmod" />
1288 <arg value="${emma.dump.file}" />
1290 <echo level="info">Downloading coverage file into project directory...</echo>
1291 <exec executable="${adb}" failonerror="true">
1292 <arg line="${adb.device.arg}" />
1293 <arg value="pull" />
1294 <arg value="${emma.dump.file}" />
1295 <arg path="${out.absolute.dir}/coverage.ec" />
1298 <pathconvert property="tested.project.lib.source.path.value" refid="tested.project.lib.source.path">
1300 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
1305 <echo level="info">Extracting coverage report...</echo>
1307 <property name="report.html.out.encoding" value="UTF-8" />
1308 <report sourcepath="${tested.project.source.absolute.dir}:${tested.project.lib.source.path.value}"
1309 verbosity="${verbosity}">
1310 <!-- TODO: report.dir or something like should be introduced if necessary -->
1311 <infileset file="${out.absolute.dir}/coverage.ec" />
1312 <infileset file="${tested.project.out.absolute.dir}/coverage.em" />
1313 <!-- TODO: reports in other, indicated by user formats -->
1314 <html outfile="${out.absolute.dir}/coverage.html" />
1315 <txt outfile="${out.absolute.dir}/coverage.txt" />
1316 <xml outfile="${out.absolute.dir}/coverage.xml" />
1319 <echo level="info">Cleaning up temporary files...</echo>
1320 <delete file="${out.absolute.dir}/coverage.ec" />
1321 <delete file="${tested.project.out.absolute.dir}/coverage.em" />
1322 <exec executable="${adb}" failonerror="true">
1323 <arg line="${adb.device.arg}" />
1324 <arg value="shell" />
1325 <arg value="run-as" />
1326 <arg value="${tested.project.app.package}" />
1328 <arg value="${emma.dump.file}" />
1330 <echo level="info">Saving the coverage reports in ${out.absolute.dir}</echo>
1333 <run-tests-helper />
1338 <!-- ******************************************************* -->
1339 <!-- ********** Run Lint on the project ********* -->
1340 <!-- ******************************************************* -->
1343 description="Runs lint on the project to look for potential bugs" >
1344 <lint executable="${lint}"
1345 html="${lint.out.html}"
1346 xml="${lint.out.xml}"
1347 src="${source.absolute.dir}:${gen.absolute.dir}"
1348 classpath="${out.classes.absolute.dir}" />
1351 <!-- ******************************************************* -->
1352 <!-- ********** Install/uninstall specific targets ********* -->
1353 <!-- ******************************************************* -->
1355 <target name="install"
1356 description="Installs the newly build package. Must be used in conjunction with a build target
1357 (debug/release/instrument). If the application was previously installed, the application
1358 is reinstalled if the signature matches." >
1359 <!-- only do install if *not* a library project -->
1360 <do-only-if-not-library elseText="Library project: nothing to install!" >
1363 <isset property="out.final.file" />
1369 <file file="${out.final.file}"/>
1373 <echo level="info">Installing ${out.final.file} onto default emulator or device...</echo>
1374 <exec executable="${adb}" failonerror="true">
1375 <arg line="${adb.device.arg}" />
1376 <arg value="install" />
1378 <arg path="${out.final.file}" />
1381 <!-- now install the tested project if applicable -->
1382 <!-- can't use project.is.test since the setup target might not have run -->
1386 <isset property="tested.project.dir" />
1388 <isset property="dont.do.deps" />
1393 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
1395 <!-- figure out which tested package to install based on emma.enabled -->
1396 <condition property="tested.project.install.target" value="installi" else="installd">
1397 <isset property="emma.enabled" />
1399 <subant target="${tested.project.install.target}" failonerror="true">
1400 <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
1406 <fail message="File ${out.final.file} does not exist." />
1411 <echo>Install file not specified.</echo>
1413 <echo>'ant install' now requires the build target to be specified as well.</echo>
1416 <echo> ant debug install</echo>
1417 <echo> ant release install</echo>
1418 <echo> ant instrument install</echo>
1419 <echo>This will build the given package and install it.</echo>
1421 <echo>Alternatively, you can use</echo>
1422 <echo> ant installd</echo>
1423 <echo> ant installr</echo>
1424 <echo> ant installi</echo>
1425 <echo> ant installt</echo>
1426 <echo>to only install an existing package (this will not rebuild the package.)</echo>
1430 </do-only-if-not-library>
1433 <target name="installd" depends="-set-debug-files, install"
1434 description="Installs (only) the debug package." />
1435 <target name="installr" depends="-set-release-mode, install"
1436 description="Installs (only) the release package." />
1437 <target name="installi" depends="-set-instrumented-mode, install"
1438 description="Installs (only) the instrumented package." />
1439 <target name="installt" depends="-test-project-check, installd"
1440 description="Installs (only) the test and tested packages." />
1443 <!-- Uninstalls the package from the default emulator/device -->
1444 <target name="uninstall" depends="-setup"
1445 description="Uninstalls the application from a running emulator or device.">
1448 <isset property="project.app.package" />
1451 <uninstall-helper app.package="${project.app.package}" />
1454 <fail message="Could not find application package in manifest. Cannot run 'adb uninstall'." />
1458 <!-- Now uninstall the tested project, if applicable -->
1462 <istrue value="${project.is.test}" />
1464 <isset property="dont.do.deps" />
1469 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
1471 <!-- Application package of the tested project extracted from its manifest file -->
1472 <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
1473 expression="/manifest/@package" output="tested.project.app.package" />
1476 <isset property="tested.project.app.package" />
1479 <uninstall-helper app.package="${tested.project.app.package}" />
1482 <fail message="Could not find tested application package in manifest. Cannot run 'adb uninstall'." />
1491 <!-- ******************************************************* -->
1492 <!-- ************************* Help ************************ -->
1493 <!-- ******************************************************* -->
1495 <target name="help">
1496 <!-- displays starts at col 13
1498 <echo>Android Ant Build. Available targets:</echo>
1499 <echo> help: Displays this help.</echo>
1500 <echo> clean: Removes output files created by other targets.</echo>
1501 <echo> This calls the same target on all dependent projects.</echo>
1502 <echo> Use 'ant nodeps clean' to only clean the local project</echo>
1503 <echo> debug: Builds the application and signs it with a debug key.</echo>
1504 <echo> The 'nodeps' target can be used to only build the</echo>
1505 <echo> current project and ignore the libraries using:</echo>
1506 <echo> 'ant nodeps debug'</echo>
1507 <echo> release: Builds the application. The generated apk file must be</echo>
1508 <echo> signed before it is published.</echo>
1509 <echo> The 'nodeps' target can be used to only build the</echo>
1510 <echo> current project and ignore the libraries using:</echo>
1511 <echo> 'ant nodeps release'</echo>
1512 <echo> instrument:Builds an instrumented package and signs it with a</echo>
1513 <echo> debug key.</echo>
1514 <echo> test: Runs the tests. Project must be a test project and</echo>
1515 <echo> must have been built. Typical usage would be:</echo>
1516 <echo> ant [emma] debug install test</echo>
1517 <echo> emma: Transiently enables code coverage for subsequent</echo>
1518 <echo> targets.</echo>
1519 <echo> install: Installs the newly build package. Must either be used</echo>
1520 <echo> in conjunction with a build target (debug/release/</echo>
1521 <echo> instrument) or with the proper suffix indicating</echo>
1522 <echo> which package to install (see below).</echo>
1523 <echo> If the application was previously installed, the</echo>
1524 <echo> application is reinstalled if the signature matches.</echo>
1525 <echo> installd: Installs (only) the debug package.</echo>
1526 <echo> installr: Installs (only) the release package.</echo>
1527 <echo> installi: Installs (only) the instrumented package.</echo>
1528 <echo> installt: Installs (only) the test and tested packages (unless</echo>
1529 <echo> nodeps is used as well.</echo>
1530 <echo> uninstall: Uninstalls the application from a running emulator or</echo>
1531 <echo> device. Also uninstall tested package if applicable</echo>
1532 <echo> unless 'nodeps' is used as well.</echo>