OSDN Git Service

f5c1e302cd989e1a5c6527df9542adc5534b4e58
[android-x86/sdk.git] / files / ant / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="" default="debug">
3
4     <!--
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.
8
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).
12
13         Follows:
14         - custom task definitions,
15         - more properties (do not override those unless the whole build system is modified).
16         - macros used throughout the build,
17         - base build targets,
18         - debug-specific build targets,
19         - release-specific build targets,
20         - instrument-specific build targets,
21         - test project-specific build targets,
22         - install targets,
23         - help target
24     -->
25
26     <!-- ******************************************************* -->
27     <!-- **************** Overridable Properties *************** -->
28     <!-- ******************************************************* -->
29
30     <!-- You can override these values in your build.xml or build.properties.
31          Overriding any other properties may result in broken build. -->
32
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
35          the emulator. -->
36     <property name="adb.device.arg" value="" />
37
38     <!-- fileset exclude patterns (space separated) to prevent
39          files inside src/ from being packaged. -->
40     <property name="android.package.excludes" value="" />
41
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
49     <!-- compilation options -->
50     <property name="java.encoding" value="UTF-8" />
51     <property name="java.target" value="1.5" />
52     <property name="java.source" value="1.5" />
53
54     <!-- Verbosity -->
55     <property name="verbose" value="false" />
56
57     <!-- ******************************************************* -->
58     <!-- ********************* Custom Tasks ******************** -->
59     <!-- ******************************************************* -->
60
61     <!-- jar file from where the tasks are loaded -->
62     <path id="android.antlibs">
63         <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
64     </path>
65
66     <!-- Custom tasks -->
67     <taskdef name="setup"
68             classname="com.android.ant.NewSetupTask"
69             classpathref="android.antlibs" />
70
71     <taskdef name="aapt"
72             classname="com.android.ant.AaptExecTask"
73             classpathref="android.antlibs" />
74
75     <taskdef name="aidl"
76             classname="com.android.ant.AidlExecTask"
77             classpathref="android.antlibs" />
78
79     <taskdef name="renderscript"
80             classname="com.android.ant.RenderScriptTask"
81             classpathref="android.antlibs" />
82
83     <taskdef name="buildconfig"
84             classname="com.android.ant.BuildConfigTask"
85             classpathref="android.antlibs" />
86
87     <taskdef name="dex"
88             classname="com.android.ant.DexExecTask"
89             classpathref="android.antlibs" />
90
91     <taskdef name="apkbuilder"
92             classname="com.android.ant.ApkBuilderTask"
93             classpathref="android.antlibs" />
94
95     <taskdef name="zipalign"
96             classname="com.android.ant.ZipAlignTask"
97             classpathref="android.antlibs" />
98
99     <taskdef name="xpath"
100             classname="com.android.ant.XPathTask"
101             classpathref="android.antlibs" />
102
103     <taskdef name="if"
104             classname="com.android.ant.IfElseTask"
105             classpathref="android.antlibs" />
106
107     <!-- Emma configuration -->
108     <property name="emma.dir" value="${sdk.dir}/tools/lib" />
109     <path id="emma.lib">
110         <pathelement location="${emma.dir}/emma.jar" />
111         <pathelement location="${emma.dir}/emma_ant.jar" />
112     </path>
113     <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
114     <!-- End of emma configuration -->
115
116
117     <!-- ******************************************************* -->
118     <!-- ******************* Other Properties ****************** -->
119     <!-- ******************************************************* -->
120     <!-- overriding these properties may break the build
121          unless the whole file is updated -->
122
123     <!-- Input directories -->
124     <property name="source.dir" value="src" />
125     <property name="source.absolute.dir" location="${source.dir}" />
126     <property name="gen.absolute.dir" location="gen" />
127     <property name="resource.absolute.dir" location="res" />
128     <property name="asset.absolute.dir" location="assets" />
129     <property name="jar.libs.dir" value="libs" />
130     <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" />
131     <property name="native.libs.absolute.dir" location="libs" />
132
133     <!-- Output directories -->
134     <property name="out.dir" value="bin" />
135     <property name="out.absolute.dir" location="${out.dir}" />
136     <property name="out.classes.absolute.dir" location="${out.dir}/classes" />
137     <property name="out.res.absolute.dir" location="${out.dir}/res" />
138
139     <!-- tools location -->
140     <property name="android.tools.dir" location="${sdk.dir}/tools" />
141     <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
142     <condition property="exe" value=".exe" else=""><os family="windows" /></condition>
143     <condition property="bat" value=".bat" else=""><os family="windows" /></condition>
144     <property name="adb" location="${android.platform.tools.dir}/adb${exe}" />
145     <property name="zipalign" location="${android.tools.dir}/zipalign${exe}" />
146     <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" />
147     <property name="aapt" location="${android.platform.tools.dir}/aapt${exe}" />
148     <property name="dx" location="${android.platform.tools.dir}/dx${bat}" />
149     <!-- renderscript location is set by NewSetupTask since we have a choice of
150          several executables based on minSdkVersion -->
151
152     <!-- Intermediate files -->
153     <property name="dex.file.name" value="classes.dex" />
154     <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
155     <property name="resource.package.file.name" value="${ant.project.name}.ap_" />
156
157     <!-- Build property file -->
158     <property name="out.build.prop.file" location="${out.absolute.dir}/build.prop" />
159
160
161     <!-- This is needed by emma as it uses multilevel verbosity instead of simple 'true' or 'false'
162          The property 'verbosity' is not user configurable and depends exclusively on 'verbose'
163          value.-->
164     <condition property="verbosity" value="verbose" else="quiet">
165         <istrue value="${verbose}" />
166     </condition>
167
168     <!-- properties for signing in release mode -->
169     <condition property="has.keystore">
170         <and>
171             <isset property="key.store" />
172             <length string="${key.store}" when="greater" length="0" />
173             <isset property="key.alias" />
174         </and>
175     </condition>
176     <condition property="has.password">
177         <and>
178             <isset property="has.keystore" />
179             <isset property="key.store.password" />
180             <isset property="key.alias.password" />
181         </and>
182     </condition>
183
184     <!-- properties for packaging -->
185     <property name="build.packaging.nocrunch" value="true" />
186
187     <!-- ******************************************************* -->
188     <!-- ************************ Macros *********************** -->
189     <!-- ******************************************************* -->
190
191     <!-- macro to do a task on if project.is.library is false.
192          elseText attribute is displayed otherwise -->
193     <macrodef name="do-only-if-not-library">
194         <attribute name="elseText" />
195         <element name="task-to-do" implicit="yes" />
196         <sequential>
197         <if condition="${project.is.library}">
198             <else>
199                 <task-to-do />
200             </else>
201             <then>
202                 <echo>@{elseText}</echo>
203             </then>
204         </if>
205         </sequential>
206     </macrodef>
207
208     <!-- macro to do a task on if manifest.hasCode is true.
209          elseText attribute is displayed otherwise -->
210     <macrodef name="do-only-if-manifest-hasCode">
211         <attribute name="elseText" default=""/>
212         <element name="task-to-do" implicit="yes" />
213         <sequential>
214         <if condition="${manifest.hasCode}">
215             <then>
216                 <task-to-do />
217             </then>
218             <else>
219                 <if>
220                     <condition>
221                         <length string="@{elseText}" trim="true" when="greater" length="0" />
222                     </condition>
223                     <then>
224                         <echo>@{elseText}</echo>
225                     </then>
226                 </if>
227             </else>
228         </if>
229         </sequential>
230     </macrodef>
231
232
233     <!-- Configurable macro, which allows to pass as parameters output directory,
234          output dex filename and external libraries to dex (optional) -->
235     <macrodef name="dex-helper">
236         <element name="external-libs" optional="yes" />
237         <attribute name="nolocals" default="false" />
238         <sequential>
239             <!-- sets the primary input for dex. If a pre-dex task sets it to
240                  something else this has no effect -->
241             <property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" />
242
243             <!-- set the secondary dx input: the project (and library) jar files
244                  If a pre-dex task sets it to something else this has no effect -->
245             <if>
246                 <condition>
247                     <isreference refid="out.dex.jar.input.ref" />
248                 </condition>
249                 <else>
250                     <path id="out.dex.jar.input.ref">
251                         <path refid="jar.libs.ref" />
252                     </path>
253                 </else>
254             </if>
255
256             <dex executable="${dx}"
257                     output="${intermediate.dex.file}"
258                     nolocals="@{nolocals}"
259                     verbose="${verbose}">
260                 <path path="${out.dex.input.absolute.dir}"/>
261                 <path refid="out.dex.jar.input.ref" />
262                 <external-libs />
263             </dex>
264         </sequential>
265     </macrodef>
266
267     <!-- This is macro that enable passing variable list of external jar files to ApkBuilder
268          Example of use:
269          <package-helper>
270              <extra-jars>
271                 <jarfolder path="my_jars" />
272                 <jarfile path="foo/bar.jar" />
273                 <jarfolder path="your_jars" />
274              </extra-jars>
275          </package-helper> -->
276     <macrodef name="package-helper">
277         <element name="extra-jars" optional="yes" />
278         <sequential>
279             <apkbuilder
280                     outfolder="${out.absolute.dir}"
281                     resourcefile="${resource.package.file.name}"
282                     apkfilepath="${out.packaged.file}"
283                     debugpackaging="${build.is.packaging.debug}"
284                     debugsigning="${build.is.signing.debug}"
285                     verbose="${verbose}"
286                     hascode="${manifest.hasCode}"
287                     previousBuildType="${build.last.is.packaging.debug}/${build.last.is.signing.debug}"
288                     buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
289                 <dex path="${intermediate.dex.file}"/>
290                 <sourcefolder path="${source.absolute.dir}"/>
291                 <jarfile refid="jar.libs.ref" />
292                 <nativefolder path="${native.libs.absolute.dir}" />
293                 <nativefolder refid="project.libraries.libs" />
294                 <extra-jars/>
295             </apkbuilder>
296         </sequential>
297     </macrodef>
298
299     <!-- This is macro which zipaligns in.package and outputs it to out.package. Used by targets
300          debug, -debug-with-emma and release.-->
301     <macrodef name="zipalign-helper">
302         <attribute name="in.package" />
303         <attribute name="out.package" />
304         <sequential>
305             <zipalign
306                     executable="${zipalign}"
307                     input="@{in.package}"
308                     output="@{out.package}"
309                     verbose="${verbose}" />
310         </sequential>
311     </macrodef>
312
313     <macrodef name="run-tests-helper">
314         <attribute name="emma.enabled" default="false" />
315         <element name="extra-instrument-args" optional="yes" />
316         <sequential>
317             <echo>Running tests ...</echo>
318             <exec executable="${adb}" failonerror="true">
319                 <arg line="${adb.device.arg}" />
320                 <arg value="shell" />
321                 <arg value="am" />
322                 <arg value="instrument" />
323                 <arg value="-w" />
324                 <arg value="-e" />
325                 <arg value="coverage" />
326                 <arg value="@{emma.enabled}" />
327                 <extra-instrument-args />
328                 <arg value="${manifest.package}/${test.runner}" />
329             </exec>
330         </sequential>
331     </macrodef>
332
333     <macrodef name="record-build-key">
334         <attribute name="key" default="false" />
335         <attribute name="value" default="false" />
336         <sequential>
337             <propertyfile file="${out.build.prop.file}" comment="Last build type">
338                 <entry key="@{key}" value="@{value}"/>
339             </propertyfile>
340         </sequential>
341     </macrodef>
342
343     <macrodef name="record-build-info">
344         <sequential>
345             <record-build-key key="build.last.target" value="${build.target}" />
346             <record-build-key key="build.last.is.instrumented" value="${build.is.instrumented}" />
347             <record-build-key key="build.last.is.packaging.debug" value="${build.is.packaging.debug}" />
348             <record-build-key key="build.last.is.signing.debug" value="${build.is.signing.debug}" />
349         </sequential>
350     </macrodef>
351
352     <macrodef name="uninstall-helper">
353         <attribute name="app.package" default="false" />
354         <sequential>
355             <echo>Uninstalling @{app.package} from the default emulator or device...</echo>
356             <exec executable="${adb}" failonerror="true">
357                 <arg line="${adb.device.arg}" />
358                 <arg value="uninstall" />
359                 <arg value="@{app.package}" />
360             </exec>
361         </sequential>
362     </macrodef>
363
364     <!-- ******************************************************* -->
365     <!-- ******************** Build Targets ******************** -->
366     <!-- ******************************************************* -->
367
368     <!-- target to disable building dependencies -->
369     <target name="nodeps">
370         <property name="dont.build.deps" value="true" />
371     </target>
372
373     <!-- this target simply force running -setup making
374          the project info be read. To be used as
375              ant all clean
376          to clean the main project as well as the libraries and tested project -->
377     <target name="all" depends="-setup"/>
378
379     <!-- clean target -->
380     <target name="clean" description="Removes output files created by other targets.">
381         <delete dir="${out.absolute.dir}" verbose="${verbose}" />
382         <delete dir="${gen.absolute.dir}" verbose="${verbose}" />
383
384         <!-- if we know about a tested project or libraries, we clean them too. This
385              will only work if the target 'all' was called first -->
386         <if condition="${project.is.test}">
387             <then>
388                 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
389                 <subant failonerror="true">
390                     <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
391                     <target name="all" />
392                     <target name="clean" />
393                 </subant>
394             </then>
395         </if>
396
397         <if>
398             <condition>
399                 <isreference refid="project.libraries" />
400             </condition>
401             <then>
402                 <subant
403                         buildpathref="project.libraries"
404                         antfile="build.xml"
405                         failonerror="true">
406                     <target name="all" />
407                     <target name="clean" />
408                 </subant>
409             </then>
410         </if>
411     </target>
412
413     <!-- generic setup -->
414     <target name="-setup">
415         <if>
416             <condition>
417                 <not><isset property="setup.done" /></not>
418             </condition>
419             <then>
420                 <property name="setup.done" value="true" />
421                 <echo>Gathering info for ${ant.project.name}...</echo>
422                 <!-- load project properties, resolve Android target, library dependencies
423                      and set some properties with the results.
424                      All property names are passed as parameters ending in -Out -->
425                 <setup
426                         projectTypeOut="android.project.type"
427                         androidJarFileOut="android.jar"
428                         androidAidlFileOut="android.aidl"
429                         renderScriptExeOut="renderscript"
430                         renderScriptIncludeDirOut="android.rs"
431                         bootclasspathrefOut="android.target.classpath"
432                         projectLibrariesRootOut="project.libraries"
433                         projectLibrariesJarsOut="project.libraries.jars"
434                         projectLibrariesResOut="project.libraries.res"
435                         projectLibrariesPackageOut="project.libraries.package"
436                         projectLibrariesLibsOut="project.libraries.libs"
437                         targetApiOut="target.api"
438                 />
439
440                 <!-- sets a few boolean based on android.project.type
441                      to make the if task easier -->
442                 <condition property="project.is.library" else="false">
443                     <equals arg1="${android.project.type}" arg2="library" />
444                 </condition>
445                 <condition property="project.is.test" else="false">
446                     <equals arg1="${android.project.type}" arg2="test" />
447                 </condition>
448
449                 <!-- If a test project, resolve absolute path to tested project. -->
450                 <if condition="${project.is.test}">
451                     <then>
452                         <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
453                     </then>
454                 </if>
455             </then>
456         </if>
457     </target>
458
459     <!-- Pre build setup -->
460     <target name="-build-setup" depends="-setup">
461
462         <!-- read the previous build mode -->
463         <property file="${out.build.prop.file}" />
464         <!-- if empty the props won't be set, meaning it's a new build.
465              To force a build, set the prop to empty values. -->
466         <property name="build.last.target" value="" />
467         <property name="build.last.is.instrumented" value="" />
468         <property name="build.last.is.packaging.debug" value="" />
469         <property name="build.last.is.signing.debug" value="" />
470
471         <!-- compile the libraries if any -->
472         <if>
473             <condition>
474                 <and>
475                     <isreference refid="project.libraries" />
476                     <not><isset property="dont.build.deps" /></not>
477                 </and>
478             </condition>
479             <then>
480                 <echo>Building Libraries</echo>
481                 <subant failonerror="true"
482                         buildpathref="project.libraries"
483                         antfile="build.xml">
484                     <target name="nodeps" />
485                     <target name="${build.target}" />
486                 </subant>
487                 <echo></echo>
488                 <echo>############################################</echo>
489                 <echo>**** Back to project ${ant.project.name} ****</echo>
490                 <echo>############################################</echo>
491             </then>
492         </if>
493
494         <!-- compile the main project if this is a test project -->
495         <if condition="${project.is.test}">
496             <then>
497                 <!-- figure out which target must be used to build the tested project.
498                      If emma is enabled, then use 'instrument' otherwise, use 'debug' -->
499                 <condition property="tested.project.target" value="instrument" else="debug">
500                     <isset property="emma.enabled" />
501                 </condition>
502
503                 <echo>Building tested project at ${tested.project.absolute.dir}</echo>
504                 <subant target="${tested.project.target}" failonerror="true">
505                     <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
506                 </subant>
507                 <echo></echo>
508                 <echo>############################################</echo>
509                 <echo>**** Back to project ${ant.project.name} ****</echo>
510                 <echo>############################################</echo>
511             </then>
512         </if>
513
514         <!-- Value of the hasCode attribute (Application node) extracted from manifest file -->
515         <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:hasCode"
516                     output="manifest.hasCode" default="true"/>
517
518         <!-- create a path with all the jar files, from the main project and the
519              libraries -->
520         <path id="jar.libs.ref">
521             <fileset dir="${jar.libs.absolute.dir}" includes="*.jar" />
522             <path refid="project.libraries.jars" />
523         </path>
524
525         <!-- If the "debug" build type changed, clear out the compiled code.
526              This is to make sure the new BuildConfig.DEBUG value is picked up
527              as javac can't deal with this type of change in its dependency computation. -->
528         <if>
529             <condition>
530                 <and>
531                     <length string="${build.last.is.packaging.debug}" trim="true" when="greater" length="0" />
532                     <not><equals
533                             arg1="${build.is.packaging.debug}"
534                             arg2="${build.last.is.packaging.debug}" /></not>
535                 </and>
536             </condition>
537             <then>
538                 <echo>Switching between debug and non debug build: Deleting previous compilation output...</echo>
539                 <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" />
540             </then>
541             <else>
542                 <!-- Else, we may still need to clean the code, for another reason.
543                      special case for instrumented: if the previous build was
544                      instrumented but not this one, clear out the compiled code -->
545                 <if>
546                     <condition>
547                         <and>
548                             <istrue value="${build.last.is.instrumented}" />
549                             <isfalse value="${build.is.instrumented}" />
550                         </and>
551                     </condition>
552                     <then>
553                         <echo>Switching from instrumented to non-instrumented build: Deleting previous compilation output...</echo>
554                         <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" />
555                     </then>
556                 </if>
557             </else>
558         </if>
559
560         <echo>Creating output directories if needed...</echo>
561         <mkdir dir="${resource.absolute.dir}" />
562         <mkdir dir="${jar.libs.absolute.dir}" />
563         <mkdir dir="${out.absolute.dir}" />
564         <mkdir dir="${out.res.absolute.dir}" />
565         <do-only-if-manifest-hasCode>
566             <mkdir dir="${gen.absolute.dir}" />
567             <mkdir dir="${out.classes.absolute.dir}" />
568         </do-only-if-manifest-hasCode>
569     </target>
570
571     <!-- empty default pre-build target. Create a similar target in
572          your build.xml and it'll be called instead of this one. -->
573     <target name="-pre-build"/>
574
575     <!-- Code Generation: compile resources (aapt -> R.java), aidl, renderscript -->
576     <target name="-code-gen">
577         <do-only-if-manifest-hasCode
578                 elseText="hasCode = false. Skipping aidl/renderscript/R.java">
579             <echo>----------</echo>
580             <echo>Handling aidl files...</echo>
581             <aidl executable="${aidl}" framework="${android.aidl}"
582                     genFolder="${gen.absolute.dir}">
583                 <source path="${source.absolute.dir}"/>
584             </aidl>
585
586             <!-- renderscript generates resources so it must be called before aapt -->
587             <echo>----------</echo>
588             <echo>Handling RenderScript files...</echo>
589             <renderscript executable="${renderscript}"
590                     framework="${android.rs}"
591                     genFolder="${gen.absolute.dir}"
592                     resFolder="${out.res.absolute.dir}/raw"
593                     targetApi="${target.api}">
594                 <source path="${source.absolute.dir}"/>
595             </renderscript>
596
597             <echo>----------</echo>
598             <echo>Handling Resources...</echo>
599             <aapt executable="${aapt}"
600                     command="package"
601                     verbose="${verbose}"
602                     manifest="AndroidManifest.xml"
603                     androidjar="${android.jar}"
604                     rfolder="${gen.absolute.dir}"
605                     nonConstantId="${android.library}"
606                     projectLibrariesResName="project.libraries.res"
607                     projectLibrariesPackageName="project.libraries.package">
608                 <res path="${out.res.absolute.dir}" />
609                 <res path="${resource.absolute.dir}" />
610             </aapt>
611
612             <echo>----------</echo>
613             <echo>Handling BuildConfig class...</echo>
614             <xpath input="AndroidManifest.xml" expression="/manifest/@package"
615                     output="manifest.package" />
616             <buildconfig
617                     genFolder="${gen.absolute.dir}"
618                     package="${manifest.package}"
619                     buildType="${build.is.packaging.debug}"
620                     previousBuildType="${build.last.is.packaging.debug}"/>
621
622         </do-only-if-manifest-hasCode>
623     </target>
624
625     <!-- empty default pre-compile target. Create a similar target in
626          your build.xml and it'll be called instead of this one. -->
627     <target name="-pre-compile"/>
628
629     <!-- Compiles this project's .java files into .class files. -->
630     <target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
631         <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
632             <!-- If android rules are used for a test project, its classpath should include
633                  tested project's location -->
634             <condition property="extensible.classpath"
635                     value="${tested.project.absolute.dir}/bin/classes"
636                     else=".">
637                 <isset property="tested.project.absolute.dir" />
638             </condition>
639             <condition property="extensible.libs.classpath"
640                     value="${tested.project.absolute.dir}/${jar.libs.dir}"
641                     else="${jar.libs.dir}">
642                 <isset property="tested.project.absolute.dir" />
643             </condition>
644             <javac encoding="${java.encoding}"
645                     source="${java.source}" target="${java.target}"
646                     debug="true" extdirs="" includeantruntime="false"
647                     destdir="${out.classes.absolute.dir}"
648                     bootclasspathref="android.target.classpath"
649                     verbose="${verbose}"
650                     classpath="${extensible.classpath}"
651                     classpathref="jar.libs.ref">
652                 <src path="${source.absolute.dir}" />
653                 <src path="${gen.absolute.dir}" />
654                 <classpath>
655                     <fileset dir="${extensible.libs.classpath}" includes="*.jar" />
656                 </classpath>
657             </javac>
658             <!-- if the project is a library then we generate a jar file -->
659             <if condition="${project.is.library}">
660                 <then>
661                     <echo>Creating library output jar file...</echo>
662                     <property name="out.library.jar.file" location="${out.absolute.dir}/classes.jar" />
663                     <if>
664                         <condition>
665                             <length string="${android.package.excludes}" trim="true" when="greater" length="0" />
666                         </condition>
667                         <then>
668                             <echo>Custom jar packaging exclusion: ${android.package.excludes}</echo>
669                         </then>
670                     </if>
671                     <jar destfile="${out.library.jar.file}">
672                         <fileset dir="${out.classes.absolute.dir}" excludes="**/R.class **/R$*.class"/>
673                         <fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" />
674                     </jar>
675                 </then>
676             </if>
677
678             <!-- if the project is instrumented, intrument the classes -->
679             <if condition="${build.is.instrumented}">
680                 <then>
681                     <echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
682                     <!-- It only instruments class files, not any external libs -->
683                     <emma enabled="true">
684                         <instr verbosity="${verbosity}"
685                                mode="overwrite"
686                                instrpath="${out.absolute.dir}/classes"
687                                outdir="${out.absolute.dir}/classes">
688                         </instr>
689                         <!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
690                              user defined file -->
691                     </emma>
692                 </then>
693             </if>
694         </do-only-if-manifest-hasCode>
695     </target>
696
697     <!-- empty default post-compile target. Create a similar target in
698          your build.xml and it'll be called instead of this one. -->
699     <target name="-post-compile"/>
700
701     <!-- Obfuscate target
702         This is only active in release builds when proguard.config is defined
703         in default.properties.
704
705         To replace Proguard with a different obfuscation engine:
706         Override the following targets in your build.xml, before the call to <setup>
707             -release-obfuscation-check
708                 Check whether obfuscation should happen, and put the result in a property.
709             -debug-obfuscation-check
710                 Obfuscation should not happen. Set the same property to false.
711             -obfuscate
712                 check if the property set in -debug/release-obfuscation-check is set to true.
713                 If true:
714                     Perform obfuscation
715                     Set property out.dex.input.absolute.dir to be the output of the obfuscation
716     -->
717     <target name="-obfuscate">
718         <if condition="${proguard.enabled}">
719             <then>
720                 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard" />
721                 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/original.jar" />
722                 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar" />
723                 <!-- input for dex will be proguard's output -->
724                 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}" />
725
726                 <!-- Add Proguard Tasks -->
727                 <property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar" />
728                 <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}" />
729
730                 <!-- Set the android classpath Path object into a single property. It'll be
731                      all the jar files separated by a platform path-separator.
732                      Each path must be quoted if it contains spaces.
733                 -->
734                 <pathconvert property="android.libraryjars" refid="android.target.classpath">
735                     <firstmatchmapper>
736                         <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
737                         <identitymapper/>
738                     </firstmatchmapper>
739                 </pathconvert>
740
741                 <!-- Build a path object with all the jar files that must be obfuscated.
742                      This include the project compiled source code and any 3rd party jar
743                      files. -->
744                 <path id="project.jars.ref">
745                     <pathelement location="${preobfuscate.jar.file}" />
746                     <path refid="jar.libs.ref" />
747                 </path>
748                 <!-- Set the project jar files Path object into a single property. It'll be
749                      all the jar files separated by a platform path-separator.
750                      Each path must be quoted if it contains spaces.
751                 -->
752                 <pathconvert property="project.jars" refid="project.jars.ref">
753                     <firstmatchmapper>
754                         <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
755                         <identitymapper/>
756                     </firstmatchmapper>
757                 </pathconvert>
758
759                 <mkdir   dir="${obfuscate.absolute.dir}" />
760                 <delete file="${preobfuscate.jar.file}"/>
761                 <delete file="${obfuscated.jar.file}"/>
762                 <jar basedir="${out.classes.absolute.dir}"
763                     destfile="${preobfuscate.jar.file}" />
764                 <proguard>
765                     @${proguard.config}
766                     -injars       ${project.jars}
767                     -outjars      "${obfuscated.jar.file}"
768                     -libraryjars  ${android.libraryjars}
769                     -dump         "${obfuscate.absolute.dir}/dump.txt"
770                     -printseeds   "${obfuscate.absolute.dir}/seeds.txt"
771                     -printusage   "${obfuscate.absolute.dir}/usage.txt"
772                     -printmapping "${obfuscate.absolute.dir}/mapping.txt"
773                 </proguard>
774             </then>
775         </if>
776     </target>
777
778     <!-- Converts this project's .class files into .dex files -->
779     <target name="-dex" depends="-compile, -post-compile, -obfuscate">
780         <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
781             <!-- only convert to dalvik bytecode is *not* a library -->
782             <do-only-if-not-library elseText="Library project: do not convert bytecode..." >
783                 <!-- special case for instrumented builds: need to use no-locals and need
784                      to pass in the emma jar. -->
785                 <if condition="${build.is.instrumented}">
786                     <then>
787                         <dex-helper nolocals="true">
788                             <external-libs>
789                                 <fileset file="${emma.dir}/emma_device.jar" />
790                             </external-libs>
791                         </dex-helper>
792                     </then>
793                     <else>
794                         <dex-helper />
795                     </else>
796                 </if>
797             </do-only-if-not-library>
798         </do-only-if-manifest-hasCode>
799     </target>
800
801 <!-- Updates the pre-processed PNG cache -->
802     <target name="-crunch">
803         <exec executable="${aapt}" taskName="crunch">
804             <arg value="crunch" />
805             <arg value="-v" />
806             <arg value="-S" />
807             <arg path="${resource.absolute.dir}" />
808             <arg value="-C" />
809             <arg path="${out.res.absolute.dir}" />
810         </exec>
811     </target>
812
813     <!-- Puts the project's resources into the output package file
814          This actually can create multiple resource package in case
815          Some custom apk with specific configuration have been
816          declared in default.properties.
817          -->
818     <target name="-package-resources" depends="-crunch">
819         <!-- only package resources if *not* a library project -->
820         <do-only-if-not-library elseText="Library project: do not package resources..." >
821             <aapt executable="${aapt}"
822                     command="package"
823                     versioncode="${version.code}"
824                     versionname="${version.name}"
825                     debug="${build.is.packaging.debug}"
826                     manifest="AndroidManifest.xml"
827                     assets="${asset.absolute.dir}"
828                     androidjar="${android.jar}"
829                     apkfolder="${out.absolute.dir}"
830                     nocrunch="${build.packaging.nocrunch}"
831                     resourcefilename="${resource.package.file.name}"
832                     resourcefilter="${aapt.resource.filter}"
833                     projectLibrariesResName="project.libraries.res"
834                     projectLibrariesPackageName="project.libraries.package"
835                     previousBuildType="${build.last.target}"
836                     buildType="${build.target}">
837                 <res path="${out.res.absolute.dir}" />
838                 <res path="${resource.absolute.dir}" />
839                 <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
840                 <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
841             </aapt>
842         </do-only-if-not-library>
843     </target>
844
845     <!-- Packages the application. -->
846     <target name="-package" depends="-dex, -package-resources">
847         <!-- only package apk if *not* a library project -->
848         <do-only-if-not-library elseText="Library project: do not package apk..." >
849             <if condition="${build.is.instrumented}">
850                 <then>
851                     <package-helper>
852                         <extra-jars>
853                             <!-- Injected from external file -->
854                             <jarfile path="${emma.dir}/emma_device.jar" />
855                         </extra-jars>
856                     </package-helper>
857                 </then>
858                 <else>
859                     <package-helper />
860                 </else>
861             </if>
862         </do-only-if-not-library>
863     </target>
864
865     <target name="-set-mode-check">
866         <fail if="out.final.file"
867                 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." />
868     </target>
869
870     <!-- ******************************************************* -->
871     <!-- **************** Debug specific targets *************** -->
872     <!-- ******************************************************* -->
873
874     <target name="-set-debug-files" depends="-set-mode-check">
875
876         <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk" />
877         <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-debug.apk" />
878     </target>
879
880
881     <target name="-set-debug-mode">
882         <!-- record the current build target -->
883         <property name="build.target" value="debug" />
884
885         <property name="build.is.instrumented" value="false" />
886
887         <!-- whether the build is a debug build. always set. -->
888         <property name="build.is.packaging.debug" value="true" />
889
890         <!-- signing mode: debug -->
891         <property name="build.is.signing.debug" value="true" />
892
893     </target>
894
895     <target name="-debug-obfuscation-check">
896         <!-- proguard is never enabled in debug mode -->
897         <property name="proguard.enabled" value="false"/>
898     </target>
899
900     <!-- Builds debug output package -->
901     <target name="-do-debug" depends="-set-debug-mode, -debug-obfuscation-check, -package">
902         <!-- only create apk if *not* a library project -->
903         <do-only-if-not-library elseText="Library project: do not create apk..." >
904             <sequential>
905                 <zipalign-helper in.package="${out.packaged.file}" out.package="${out.final.file}" />
906                 <echo>Debug Package: ${out.final.file}</echo>
907             </sequential>
908         </do-only-if-not-library>
909     </target>
910
911     <!-- Builds debug output package -->
912     <target name="debug" depends="-set-debug-files, -do-debug"
913                 description="Builds the application and signs it with a debug key.">
914         <record-build-info />
915     </target>
916
917
918     <!-- ******************************************************* -->
919     <!-- *************** Release specific targets ************** -->
920     <!-- ******************************************************* -->
921
922     <!-- called through target 'release'. Only executed if the keystore and
923          key alias are known but not their password. -->
924     <target name="-release-prompt-for-password" if="has.keystore" unless="has.password">
925         <!-- Gets passwords -->
926         <input
927                 message="Please enter keystore password (store:${key.store}):"
928                 addproperty="key.store.password" />
929         <input
930                 message="Please enter password for alias '${key.alias}':"
931                 addproperty="key.alias.password" />
932     </target>
933
934     <!-- called through target 'release'. Only executed if there's no
935          keystore/key alias set -->
936     <target name="-release-nosign" unless="has.keystore">
937         <!-- no release builds for library project -->
938         <do-only-if-not-library elseText="" >
939             <sequential>
940                 <echo>No key.store and key.alias properties found in build.properties.</echo>
941                 <echo>Please sign ${out.packaged.file} manually</echo>
942                 <echo>and run zipalign from the Android SDK tools.</echo>
943             </sequential>
944         </do-only-if-not-library>
945         <record-build-info />
946     </target>
947
948     <target name="-release-obfuscation-check">
949         <condition property="proguard.enabled" value="true" else="false">
950             <and>
951                 <isset property="build.is.mode.release" />
952                 <isset property="proguard.config" />
953             </and>
954         </condition>
955         <if condition="${proguard.enabled}">
956             <then>
957                 <!-- Secondary dx input (jar files) is empty since all the
958                      jar files will be in the obfuscated jar -->
959                 <path id="out.dex.jar.input.ref" />
960             </then>
961         </if>
962     </target>
963
964     <target name="-set-release-mode" depends="-set-mode-check">
965         <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-release-unsigned.apk" />
966         <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-release.apk" />
967
968         <!-- record the current build target -->
969         <property name="build.target" value="release" />
970
971         <property name="build.is.instrumented" value="false" />
972
973         <!-- release mode is only valid if the manifest does not explicitly
974              set debuggable to true. default is false. -->
975         <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:debuggable"
976                 output="build.is.packaging.debug" default="false"/>
977
978         <!-- signing mode: release -->
979         <property name="build.is.signing.debug" value="false" />
980
981         <if condition="${build.is.packaging.debug}">
982             <then>
983                 <echo>*************************************************</echo>
984                 <echo>****  Android Manifest has debuggable=true   ****</echo>
985                 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo>
986                 <echo>*************************************************</echo>
987             </then>
988             <else>
989                 <!-- property only set in release mode.
990                      Useful for if/unless attributes in target node
991                      when using Ant before 1.8 -->
992                 <property name="build.is.mode.release" value="true"/>
993             </else>
994         </if>
995     </target>
996
997     <!-- This runs -package-release and -release-nosign first and then runs
998          only if release-sign is true (set in -release-check,
999          called by -release-no-sign)-->
1000     <target name="release"
1001                 depends="-set-release-mode, -release-obfuscation-check, -package, -release-prompt-for-password, -release-nosign"
1002                 if="has.keystore"
1003                 description="Builds the application. The generated apk file must be signed before
1004                             it is published.">
1005
1006         <!-- only create apk if *not* a library project -->
1007         <do-only-if-not-library elseText="Library project: do not create apk..." >
1008             <sequential>
1009                 <property name="out.unaligned.file" location="${out.absolute.dir}/${ant.project.name}-release-unaligned.apk" />
1010
1011                 <!-- Signs the APK -->
1012                 <echo>Signing final apk...</echo>
1013                 <signjar
1014                         jar="${out.packaged.file}"
1015                         signedjar="${out.unaligned.file}"
1016                         keystore="${key.store}"
1017                         storepass="${key.store.password}"
1018                         alias="${key.alias}"
1019                         keypass="${key.alias.password}"
1020                         verbose="${verbose}" />
1021
1022                 <!-- Zip aligns the APK -->
1023                 <zipalign-helper in.package="${out.unaligned.file}"
1024                                            out.package="${out.final.file}" />
1025                 <echo>Release Package: ${out.final.file}</echo>
1026             </sequential>
1027         </do-only-if-not-library>
1028         <record-build-info />
1029     </target>
1030
1031     <!-- ******************************************************* -->
1032     <!-- ************ Instrumented specific targets ************ -->
1033     <!-- ******************************************************* -->
1034
1035     <!-- These targets are specific for the project under test when it
1036          gets compiled by the test projects in a way that will make it
1037          support emma code coverage -->
1038
1039     <target name="-set-instrumented-mode" depends="-set-mode-check">
1040         <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-instrumented-unaligned.apk" />
1041         <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-instrumented.apk" />
1042
1043         <!-- whether the build is an instrumented build. -->
1044         <property name="build.is.instrumented" value="true" />
1045     </target>
1046
1047     <!-- Builds instrumented output package -->
1048     <target name="instrument" depends="-set-instrumented-mode, -do-debug"
1049                 description="Builds an instrumented packaged.">
1050         <!-- only create apk if *not* a library project -->
1051         <do-only-if-not-library elseText="Library project: do not create apk..." >
1052             <sequential>
1053                 <zipalign-helper in.package="${out.packaged.file}" out.package="${out.final.file}" />
1054                 <echo>Instrumented Package: ${out.final.file}</echo>
1055             </sequential>
1056         </do-only-if-not-library>
1057         <record-build-info />
1058     </target>
1059
1060     <!-- ******************************************************* -->
1061     <!-- ************ Test project specific targets ************ -->
1062     <!-- ******************************************************* -->
1063
1064     <!-- enable code coverage -->
1065     <target name="emma">
1066         <property name="emma.enabled" value="true" />
1067     </target>
1068
1069     <!-- fails if the project is not a test project -->
1070     <target name="-test-project-check">
1071         <!-- can't use project.is.test since the setup target is not run -->
1072         <if>
1073             <condition>
1074                 <isset property="tested.project.dir" />
1075             </condition>
1076             <else>
1077                 <fail message="Project is not a test project." />
1078             </else>
1079         </if>
1080     </target>
1081
1082     <!-- Installs the tested project. This make sure to install the proper package based on
1083          the value of emma.enabled -->
1084     <target name="-install-tested-project" depends="-test-project-check, -setup">
1085         <!-- figure out which tested package to install based on emma.enabled -->
1086         <condition property="tested.project.install.target" value="installi" else="installd">
1087             <isset property="emma.enabled" />
1088         </condition>
1089         <subant target="${tested.project.install.target}" failonerror="true">
1090             <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
1091         </subant>
1092     </target>
1093
1094     <target name="test" depends="-test-project-check"
1095                 description="Runs tests from the package defined in test.package property">
1096
1097         <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
1098
1099         <property name="test.runner" value="android.test.InstrumentationTestRunner" />
1100
1101         <!-- Application package of the tested project extracted from its manifest file -->
1102         <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
1103                 expression="/manifest/@package" output="tested.manifest.package" />
1104
1105         <property name="emma.dump.file"
1106                 value="/data/data/${tested.manifest.package}/coverage.ec" />
1107
1108         <if condition="${emma.enabled}">
1109             <then>
1110                 <echo>WARNING: Code Coverage is currently only supported on the emulator and rooted devices.</echo>
1111                 <run-tests-helper emma.enabled="true">
1112                     <extra-instrument-args>
1113                         <arg value="-e" />
1114                            <arg value="coverageFile" />
1115                            <arg value="${emma.dump.file}" />
1116                     </extra-instrument-args>
1117                 </run-tests-helper>
1118                 <echo>Downloading coverage file into project directory...</echo>
1119                 <exec executable="${adb}" failonerror="true">
1120                     <arg line="${adb.device.arg}" />
1121                     <arg value="pull" />
1122                     <arg value="${emma.dump.file}" />
1123                     <arg value="coverage.ec" />
1124                 </exec>
1125                 <echo>Extracting coverage report...</echo>
1126                 <emma>
1127                     <report sourcepath="${tested.project.absolute.dir}/${source.dir}"
1128                                       verbosity="${verbosity}">
1129                         <!-- TODO: report.dir or something like should be introduced if necessary -->
1130                         <infileset dir=".">
1131                             <include name="coverage.ec" />
1132                             <include name="coverage.em" />
1133                         </infileset>
1134                         <!-- TODO: reports in other, indicated by user formats -->
1135                         <html outfile="coverage.html" />
1136                    </report>
1137                 </emma>
1138                 <echo>Cleaning up temporary files...</echo>
1139                 <delete file="coverage.ec" />
1140                 <delete file="coverage.em" />
1141                 <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
1142             </then>
1143             <else>
1144                 <run-tests-helper />
1145             </else>
1146         </if>
1147     </target>
1148
1149
1150     <!-- ******************************************************* -->
1151     <!-- ********** Install/uninstall specific targets ********* -->
1152     <!-- ******************************************************* -->
1153
1154     <target name="install"
1155                 description="Installs the newly build package. Must be used in conjunction with a build target
1156                             (debug/release/instrument). If the application was previously installed, the application
1157                             is reinstalled if the signature matches." >
1158         <!-- only do install if *not* a library project -->
1159         <do-only-if-not-library elseText="Library project: nothing to install!" >
1160             <if>
1161                 <condition>
1162                     <isset property="out.final.file" />
1163                 </condition>
1164                 <then>
1165                     <if>
1166                         <condition>
1167                             <resourceexists>
1168                                 <file file="${out.final.file}"/>
1169                             </resourceexists>
1170                         </condition>
1171                         <then>
1172                             <echo>Installing ${out.final.file} onto default emulator or device...</echo>
1173                             <exec executable="${adb}" failonerror="true">
1174                                 <arg line="${adb.device.arg}" />
1175                                 <arg value="install" />
1176                                 <arg value="-r" />
1177                                 <arg path="${out.final.file}" />
1178                             </exec>
1179                         </then>
1180                         <else>
1181                             <fail message="File {out.final.file} does not exist." />
1182                         </else>
1183                     </if>
1184                 </then>
1185                 <else>
1186                     <echo>Install file not specified.</echo>
1187                     <echo></echo>
1188                     <echo>'ant install' now requires the build target to be specified as well.</echo>
1189                     <echo></echo>
1190                     <echo></echo>
1191                     <echo>    ant debug install</echo>
1192                     <echo>    ant release install</echo>
1193                     <echo>    ant instrument install</echo>
1194                     <echo>This will build the given package and install it.</echo>
1195                     <echo></echo>
1196                     <echo>Alternatively, you can use</echo>
1197                     <echo>    ant installd</echo>
1198                     <echo>    ant installr</echo>
1199                     <echo>    ant installi</echo>
1200                     <echo>    ant installt</echo>
1201                     <echo>to only install an existing package (this will not rebuild the package.)</echo>
1202                     <fail />
1203                 </else>
1204             </if>
1205         </do-only-if-not-library>
1206     </target>
1207
1208     <target name="installd" depends="-set-debug-files, install"
1209             description="Installs (only) the debug package." />
1210     <target name="installr" depends="-set-release-mode, install"
1211             description="Installs (only) the release package." />
1212     <target name="installi" depends="-set-instrumented-mode, install"
1213             description="Installs (only) the instrumented package." />
1214     <target name="installt" depends="-install-tested-project, installd"
1215             description="Installs (only) the test and tested packages." />
1216
1217
1218     <!-- Uninstalls the package from the default emulator/device -->
1219     <target name="uninstall"
1220                 description="Uninstalls the application from a running emulator or device.">
1221         <!-- Name of the application package extracted from manifest file -->
1222         <xpath input="AndroidManifest.xml" expression="/manifest/@package"
1223                 output="manifest.package" />
1224
1225         <if>
1226             <condition>
1227                 <isset property="manifest.package" />
1228             </condition>
1229             <then>
1230                 <uninstall-helper app.package="${manifest.package}" />
1231             </then>
1232             <else>
1233                 <echo>Could not find application package in manifest. Cannot run 'adb uninstall'.</echo>
1234             </else>
1235         </if>
1236
1237         <if condition="${project.is.test}">
1238             <then>
1239                 <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
1240
1241                 <!-- Application package of the tested project extracted from its manifest file -->
1242                 <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
1243                     expression="/manifest/@package" output="tested.manifest.package" />
1244                 <if>
1245                     <condition>
1246                         <isset property="tested.manifest.package" />
1247                     </condition>
1248                     <then>
1249                         <uninstall-helper app.package="${tested.manifest.package}" />
1250                     </then>
1251                     <else>
1252                         <echo>Could not find tested application package in manifest. Cannot run 'adb uninstall'.</echo>
1253                     </else>
1254                 </if>
1255             </then>
1256         </if>
1257
1258     </target>
1259
1260
1261     <!-- ******************************************************* -->
1262     <!-- ************************* Help ************************ -->
1263     <!-- ******************************************************* -->
1264
1265     <target name="help">
1266         <!-- displays starts at col 13
1267               |13                                                              80| -->
1268         <echo>Android Ant Build. Available targets:</echo>
1269         <echo>   help:      Displays this help.</echo>
1270         <echo>   clean:     Removes output files created by other targets.</echo>
1271         <echo>              The 'all' target can be used to clean dependencies</echo>
1272         <echo>              (tested projects and libraries)at the same time</echo>
1273         <echo>              using: 'ant all clean'</echo>
1274         <echo>   debug:     Builds the application and signs it with a debug key.</echo>
1275         <echo>              The 'nodeps' target can be used to only build the</echo>
1276         <echo>              current project and ignore the libraries using:</echo>
1277         <echo>              'ant nodeps debug'</echo>
1278         <echo>   release:   Builds the application. The generated apk file must be</echo>
1279         <echo>              signed before it is published.</echo>
1280         <echo>              The 'nodeps' target can be used to only build the</echo>
1281         <echo>              current project and ignore the libraries using:</echo>
1282         <echo>              'ant nodeps release'</echo>
1283         <echo>   instrument:Builds an instrumented package and signs it with a</echo>
1284         <echo>              debug key.</echo>
1285         <echo>   test:      Runs the tests. Project must be a test project and</echo>
1286         <echo>              must have been built. Typical usage would be:</echo>
1287         <echo>                  ant [emma] debug installt test</echo>
1288         <echo>   emma:      Transiently enables code coverage for subsequent</echo>
1289         <echo>              targets.</echo>
1290         <echo>   install:   Installs the newly build package. Must either be used</echo>
1291         <echo>              in conjunction with a build target (debug/release/</echo>
1292         <echo>              instrument) or with the proper suffix indicating</echo>
1293         <echo>              which package to install (see below).</echo>
1294         <echo>              If the application was previously installed, the</echo>
1295         <echo>              application is reinstalled if the signature matches.</echo>
1296         <echo>   installd:  Installs (only) the debug package.</echo>
1297         <echo>   installr:  Installs (only) the release package.</echo>
1298         <echo>   installi:  Installs (only) the instrumented package.</echo>
1299         <echo>   installt:  Installs (only) the test and tested packages.</echo>
1300         <echo>   uninstall: Uninstalls the application from a running emulator or</echo>
1301         <echo>              device.</echo>
1302     </target>
1303 </project>