OLD | NEW |
1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="UTF-8"?> |
2 <!-- | 2 <!-- |
3 Copyright (C) 2005-2008 The Android Open Source Project | 3 Copyright (C) 2005-2008 The Android Open Source Project |
4 | 4 |
5 Licensed under the Apache License, Version 2.0 (the "License"); | 5 Licensed under the Apache License, Version 2.0 (the "License"); |
6 you may not use this file except in compliance with the License. | 6 you may not use this file except in compliance with the License. |
7 You may obtain a copy of the License at | 7 You may obtain a copy of the License at |
8 | 8 |
9 http://www.apache.org/licenses/LICENSE-2.0 | 9 http://www.apache.org/licenses/LICENSE-2.0 |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 <property-value name="target.abi" value="${APP_ABI}"/> | 67 <property-value name="target.abi" value="${APP_ABI}"/> |
68 | 68 |
69 <!-- | 69 <!-- |
70 We use the PROGUARD_ENABLED flag for enabling proguard. By default proguar
d is enabled for | 70 We use the PROGUARD_ENABLED flag for enabling proguard. By default proguar
d is enabled for |
71 Release builds if proguard.config is set. Setting proguard.config even to
an empty string will | 71 Release builds if proguard.config is set. Setting proguard.config even to
an empty string will |
72 enable proguard. Set this property only when we have explicitly enabled pr
oguard. | 72 enable proguard. Set this property only when we have explicitly enabled pr
oguard. |
73 --> | 73 --> |
74 <condition property="proguard.config" value="${PROGUARD_FLAGS}"> | 74 <condition property="proguard.config" value="${PROGUARD_FLAGS}"> |
75 <istrue value="${PROGUARD_ENABLED}"/> | 75 <istrue value="${PROGUARD_ENABLED}"/> |
76 </condition> | 76 </condition> |
77 <!-- TODO(shashishekhar): Enable emma and code-coverage filters. --> | |
78 | 77 |
79 <!-- Set the output directory for the final apk to the ${apks.dir}. --> | 78 <!-- Set the output directory for the final apk to the ${apks.dir}. --> |
80 <property-location name="out.final.file" | 79 <property-location name="out.final.file" |
81 location="${apks.dir}/${ant.project.name}.apk" | 80 location="${apks.dir}/${ant.project.name}.apk" |
82 check-exists="false"/> | 81 check-exists="false"/> |
83 | 82 |
84 <!-- Classpath for javac --> | 83 <!-- Classpath for javac --> |
85 <path id="javac.custom.classpath"> | 84 <path id="javac.custom.classpath"> |
86 <filelist files="${INPUT_JARS_PATHS}"/> | 85 <filelist files="${INPUT_JARS_PATHS}"/> |
87 </path> | 86 </path> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 ... | 138 ... |
140 --> | 139 --> |
141 <property name="dex.force.jumbo" value="false" /> | 140 <property name="dex.force.jumbo" value="false" /> |
142 | 141 |
143 <!-- compilation options --> | 142 <!-- compilation options --> |
144 <property name="java.encoding" value="UTF-8" /> | 143 <property name="java.encoding" value="UTF-8" /> |
145 <property name="java.target" value="1.5" /> | 144 <property name="java.target" value="1.5" /> |
146 <property name="java.source" value="1.5" /> | 145 <property name="java.source" value="1.5" /> |
147 <property name="java.compilerargs" value="" /> | 146 <property name="java.compilerargs" value="" /> |
148 | 147 |
149 <!-- Renderscript options --> | |
150 <property name="renderscript.debug.opt.level" value="O0" /> | |
151 <property name="renderscript.release.opt.level" value="O3" /> | |
152 | |
153 <!-- manifest merger default value --> | 148 <!-- manifest merger default value --> |
154 <property name="manifestmerger.enabled" value="false" /> | 149 <property name="manifestmerger.enabled" value="false" /> |
155 | 150 |
156 <!-- instrumentation options --> | |
157 <property name="emma.filter" value="" /> | |
158 | |
159 <!-- Verbosity --> | 151 <!-- Verbosity --> |
160 <property name="verbose" value="false" /> | 152 <property name="verbose" value="false" /> |
161 | 153 |
162 <!-- Output location of the HTML report for the "lint" target. | |
163 Ideally this would be specified as | |
164 value="${out.dir}/lint.html" | |
165 but we can't make a forward reference to the definition for | |
166 ${out.dir}, and it is not a configurable property (yet). | |
167 --> | |
168 <property name="lint.out.html" value="bin/lint.html" /> | |
169 | |
170 <!-- Output location of the XML report for the "lint" target --> | |
171 <property name="lint.out.xml" value="bin/lint.xml" /> | |
172 | |
173 <!-- ******************************************************* --> | 154 <!-- ******************************************************* --> |
174 <!-- ********************* Custom Tasks ******************** --> | 155 <!-- ********************* Custom Tasks ******************** --> |
175 <!-- ******************************************************* --> | 156 <!-- ******************************************************* --> |
176 | 157 |
177 <!-- jar file from where the tasks are loaded --> | 158 <!-- jar file from where the tasks are loaded --> |
178 <path id="android.antlibs"> | 159 <path id="android.antlibs"> |
179 <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" /> | 160 <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" /> |
180 </path> | 161 </path> |
181 | 162 |
182 <!-- Custom tasks --> | 163 <!-- Custom tasks --> |
183 <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> | 164 <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> |
184 | 165 |
185 <!-- Emma configuration --> | |
186 <property name="emma.dir" value="${sdk.dir}/tools/lib" /> | |
187 <path id="emma.lib"> | |
188 <pathelement location="${emma.dir}/emma.jar" /> | |
189 <pathelement location="${emma.dir}/emma_ant.jar" /> | |
190 </path> | |
191 <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> | |
192 <!-- End of emma configuration --> | |
193 | |
194 | |
195 <!-- ******************************************************* --> | 166 <!-- ******************************************************* --> |
196 <!-- ******************* Other Properties ****************** --> | 167 <!-- ******************* Other Properties ****************** --> |
197 <!-- ******************************************************* --> | 168 <!-- ******************************************************* --> |
198 <!-- overriding these properties may break the build | 169 <!-- overriding these properties may break the build |
199 unless the whole file is updated --> | 170 unless the whole file is updated --> |
200 | 171 |
201 <!-- Input directories --> | 172 <!-- Input directories --> |
202 <property name="source.dir" value="src" /> | 173 <property name="source.dir" value="src" /> |
203 <property name="source.absolute.dir" location="${source.dir}" /> | 174 <property name="source.absolute.dir" location="${source.dir}" /> |
204 <property-value name="gen.absolute.dir" value="${out.dir}/gen"/> | 175 <property-value name="gen.absolute.dir" value="${out.dir}/gen"/> |
(...skipping 18 matching lines...) Expand all Loading... |
223 <property name="out.absolute.dir" location="${out.dir}" /> | 194 <property name="out.absolute.dir" location="${out.dir}" /> |
224 <property name="out.classes.absolute.dir" location="${out.dir}/classes" /> | 195 <property name="out.classes.absolute.dir" location="${out.dir}/classes" /> |
225 <property name="out.res.absolute.dir" location="${out.dir}/res" /> | 196 <property name="out.res.absolute.dir" location="${out.dir}/res" /> |
226 <property name="out.aidl.absolute.dir" location="${out.dir}/aidl" /> | 197 <property name="out.aidl.absolute.dir" location="${out.dir}/aidl" /> |
227 <property name="out.dexed.absolute.dir" location="${out.dir}/dexedLibs" /> | 198 <property name="out.dexed.absolute.dir" location="${out.dir}/dexedLibs" /> |
228 <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.
xml" /> | 199 <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.
xml" /> |
229 | 200 |
230 <!-- tools location --> | 201 <!-- tools location --> |
231 <property name="android.tools.dir" location="${sdk.dir}/tools" /> | 202 <property name="android.tools.dir" location="${sdk.dir}/tools" /> |
232 <property name="android.platform.tools.dir" location="${sdk.dir}/platform-to
ols" /> | 203 <property name="android.platform.tools.dir" location="${sdk.dir}/platform-to
ols" /> |
233 <condition property="exe" value=".exe" else=""><os family="windows" /></cond
ition> | 204 <property name="exe" value="" /> |
234 <condition property="bat" value=".bat" else=""><os family="windows" /></cond
ition> | 205 <property name="bat" value="" /> |
235 <property name="adb" location="${android.platform.tools.dir}/adb${exe}" /> | 206 <property name="adb" location="${android.platform.tools.dir}/adb${exe}" /> |
236 <property name="zipalign" location="${android.tools.dir}/zipalign${exe}" /> | 207 <property name="zipalign" location="${android.tools.dir}/zipalign${exe}" /> |
237 <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" /> | 208 <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" /> |
238 <property name="aapt" location="${android.platform.tools.dir}/aapt${exe}" /> | 209 <property name="aapt" location="${android.platform.tools.dir}/aapt${exe}" /> |
239 <property name="dx" location="${android.platform.tools.dir}/dx${bat}" /> | 210 <property name="dx" location="${android.platform.tools.dir}/dx${bat}" /> |
240 <property name="renderscript" location="${android.platform.tools.dir}/llvm-r
s-cc${exe}"/> | |
241 <property name="lint" location="${android.tools.dir}/lint${bat}" /> | |
242 | |
243 <!-- Renderscript include Path --> | |
244 <path id="android.renderscript.include.path"> | |
245 <pathelement location="${android.platform.tools.dir}/renderscript/includ
e" /> | |
246 <pathelement location="${android.platform.tools.dir}/renderscript/clang-
include" /> | |
247 </path> | |
248 | 211 |
249 <!-- Intermediate files --> | 212 <!-- Intermediate files --> |
250 <property name="dex.file.name" value="classes.dex" /> | 213 <property name="dex.file.name" value="classes.dex" /> |
251 <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.f
ile.name}" /> | 214 <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.f
ile.name}" /> |
252 <property name="resource.package.file.name" value="${ant.project.name}.ap_"
/> | 215 <property name="resource.package.file.name" value="${ant.project.name}.ap_"
/> |
253 | 216 |
254 <!-- Build property file --> | 217 <!-- Build property file --> |
255 <property name="out.build.prop.file" location="${out.absolute.dir}/build.pro
p" /> | 218 <property name="out.build.prop.file" location="${out.absolute.dir}/build.pro
p" /> |
256 | 219 |
257 | |
258 <!-- This is needed by emma as it uses multilevel verbosity instead of simpl
e 'true' or 'false' | |
259 The property 'verbosity' is not user configurable and depends exclusive
ly on 'verbose' | |
260 value.--> | |
261 <condition property="verbosity" value="verbose" else="quiet"> | |
262 <istrue value="${verbose}" /> | |
263 </condition> | |
264 | |
265 <!-- | 220 <!-- |
266 For debug builds, the Android SDK tools create a key in ~/.android and sig
n the build with it. | 221 For debug builds, the Android SDK tools create a key in ~/.android and sig
n the build with it. |
267 This has caused all kinds of issues. Instead, the debug build should be si
gned with a key in | 222 This has caused all kinds of issues. Instead, the debug build should be si
gned with a key in |
268 build/android/ant. The SDK tools do not provide any support for overriding
that behavior and so | 223 build/android/ant. The SDK tools do not provide any support for overriding
that behavior and so |
269 instead one must use the hack below. | 224 instead one must use the hack below. |
270 --> | 225 --> |
271 <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium
-debug.keystore"/> | 226 <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium
-debug.keystore"/> |
272 <property name="key.store.password" value="chromium"/> | 227 <property name="key.store.password" value="chromium"/> |
273 <property name="key.alias" value="chromiumdebugkey"/> | 228 <property name="key.alias" value="chromiumdebugkey"/> |
274 <property name="key.alias.password" value="chromium"/> | 229 <property name="key.alias.password" value="chromium"/> |
275 | 230 |
276 | |
277 <!-- properties for signing in release mode --> | 231 <!-- properties for signing in release mode --> |
278 <condition property="has.keystore"> | 232 <condition property="has.keystore"> |
279 <and> | 233 <and> |
280 <isset property="key.store" /> | 234 <isset property="key.store" /> |
281 <length string="${key.store}" when="greater" length="0" /> | 235 <length string="${key.store}" when="greater" length="0" /> |
282 <isset property="key.alias" /> | 236 <isset property="key.alias" /> |
283 </and> | 237 </and> |
284 </condition> | 238 </condition> |
285 <condition property="has.password"> | 239 <condition property="has.password"> |
286 <and> | 240 <and> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 <sourcefolder path="${source.absolute.dir}"/> | 366 <sourcefolder path="${source.absolute.dir}"/> |
413 <jarfile refid="project.all.jars.path" /> | 367 <jarfile refid="project.all.jars.path" /> |
414 <nativefolder path="${native.libs.absolute.dir}" /> | 368 <nativefolder path="${native.libs.absolute.dir}" /> |
415 <nativefolder refid="project.library.native.folder.path" /> | 369 <nativefolder refid="project.library.native.folder.path" /> |
416 <extra-jars/> | 370 <extra-jars/> |
417 </apkbuilder> | 371 </apkbuilder> |
418 </sequential> | 372 </sequential> |
419 </macrodef> | 373 </macrodef> |
420 | 374 |
421 <!-- This is macro which zipaligns in.package and outputs it to out.package.
Used by targets | 375 <!-- This is macro which zipaligns in.package and outputs it to out.package.
Used by targets |
422 debug, -debug-with-emma and release.--> | 376 debug and release.--> |
423 <macrodef name="zipalign-helper"> | 377 <macrodef name="zipalign-helper"> |
424 <attribute name="in.package" /> | 378 <attribute name="in.package" /> |
425 <attribute name="out.package" /> | 379 <attribute name="out.package" /> |
426 <sequential> | 380 <sequential> |
427 <zipalign | 381 <zipalign |
428 executable="${zipalign}" | 382 executable="${zipalign}" |
429 input="@{in.package}" | 383 input="@{in.package}" |
430 output="@{out.package}" | 384 output="@{out.package}" |
431 verbose="${verbose}" /> | 385 verbose="${verbose}" /> |
432 </sequential> | 386 </sequential> |
433 </macrodef> | 387 </macrodef> |
434 | 388 |
435 <macrodef name="run-tests-helper"> | |
436 <attribute name="emma.enabled" default="false" /> | |
437 <element name="extra-instrument-args" optional="yes" /> | |
438 <sequential> | |
439 <echo level="info">Running tests ...</echo> | |
440 <exec executable="${adb}" failonerror="true"> | |
441 <arg line="${adb.device.arg}" /> | |
442 <arg value="shell" /> | |
443 <arg value="am" /> | |
444 <arg value="instrument" /> | |
445 <arg value="-w" /> | |
446 <arg value="-e" /> | |
447 <arg value="coverage" /> | |
448 <arg value="@{emma.enabled}" /> | |
449 <extra-instrument-args /> | |
450 <arg value="${project.app.package}/${test.runner}" /> | |
451 </exec> | |
452 </sequential> | |
453 </macrodef> | |
454 | |
455 <macrodef name="record-build-key"> | 389 <macrodef name="record-build-key"> |
456 <attribute name="key" default="false" /> | 390 <attribute name="key" default="false" /> |
457 <attribute name="value" default="false" /> | 391 <attribute name="value" default="false" /> |
458 <sequential> | 392 <sequential> |
459 <propertyfile file="${out.build.prop.file}" comment="Last build type
"> | 393 <propertyfile file="${out.build.prop.file}" comment="Last build type
"> |
460 <entry key="@{key}" value="@{value}"/> | 394 <entry key="@{key}" value="@{value}"/> |
461 </propertyfile> | 395 </propertyfile> |
462 </sequential> | 396 </sequential> |
463 </macrodef> | 397 </macrodef> |
464 | 398 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 libraryPackagesOut="project.library.packages" | 588 libraryPackagesOut="project.library.packages" |
655 libraryManifestFilePathOut="project.library.manifest.file.path" | 589 libraryManifestFilePathOut="project.library.manifest.file.path" |
656 libraryResFolderPathOut="project.library.res.folder.path" | 590 libraryResFolderPathOut="project.library.res.folder.path" |
657 libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.pat
h" | 591 libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.pat
h" |
658 libraryRFilePathOut="project.library.bin.r.file.path" | 592 libraryRFilePathOut="project.library.bin.r.file.path" |
659 libraryNativeFolderPathOut="project.library.native.folder.path" | 593 libraryNativeFolderPathOut="project.library.native.folder.path" |
660 jarLibraryPathOut="project.all.jars.path" | 594 jarLibraryPathOut="project.all.jars.path" |
661 targetApi="${project.target.apilevel}" | 595 targetApi="${project.target.apilevel}" |
662 verbose="${verbose}" /> | 596 verbose="${verbose}" /> |
663 | 597 |
664 <!-- compile the libraries if any --> | 598 <!-- no tested project, make an empty Path object so that javac doesn't |
665 <if> | 599 complain --> |
666 <condition> | 600 <path id="tested.project.classpath" /> |
667 <and> | |
668 <isreference refid="project.library.folder.path" /> | |
669 <not><isset property="dont.do.deps" /></not> | |
670 </and> | |
671 </condition> | |
672 <then> | |
673 <!-- figure out which target must be used to build the library p
rojects. | |
674 If emma is enabled, then use 'instrument' otherwise, use 'd
ebug' --> | |
675 <condition property="project.libraries.target" value="instrument
" else="${build.target}"> | |
676 <istrue value="${build.is.instrumented}" /> | |
677 </condition> | |
678 | |
679 <echo level="info">----------</echo> | |
680 <echo level="info">Building Libraries with '${project.libraries.
target}'...</echo> | |
681 | |
682 <!-- no need to build the deps as we have already | |
683 the full list of libraries --> | |
684 <subant failonerror="true" | |
685 buildpathref="project.library.folder.path" | |
686 antfile="build.xml"> | |
687 <target name="nodeps" /> | |
688 <target name="${project.libraries.target}" /> | |
689 <property name="emma.coverage.absolute.file" location="${out
.absolute.dir}/coverage.em" /> | |
690 </subant> | |
691 </then> | |
692 </if> | |
693 | |
694 <!-- compile the main project if this is a test project --> | |
695 <if condition="${project.is.test}"> | |
696 <then> | |
697 <!-- figure out which target must be used to build the tested pr
oject. | |
698 If emma is enabled, then use 'instrument' otherwise, use 'd
ebug' --> | |
699 <condition property="tested.project.target" value="instrument" e
lse="debug"> | |
700 <isset property="emma.enabled" /> | |
701 </condition> | |
702 | |
703 <echo level="info">----------</echo> | |
704 <echo level="info">Building tested project at ${tested.project.a
bsolute.dir} with '${tested.project.target}'...</echo> | |
705 <subant target="${tested.project.target}" failonerror="true"> | |
706 <fileset dir="${tested.project.absolute.dir}" includes="buil
d.xml" /> | |
707 </subant> | |
708 | |
709 <!-- get the tested project full classpath to be able to build | |
710 the test project --> | |
711 <testedprojectclasspath | |
712 projectLocation="${tested.project.absolute.dir}" | |
713 projectClassPathOut="tested.project.classpath"/> | |
714 </then> | |
715 <else> | |
716 <!-- no tested project, make an empty Path object so that javac
doesn't | |
717 complain --> | |
718 <path id="tested.project.classpath" /> | |
719 </else> | |
720 </if> | |
721 </target> | 601 </target> |
722 | 602 |
723 <!-- empty default pre-build target. Create a similar target in | 603 <!-- empty default pre-build target. Create a similar target in |
724 your build.xml and it'll be called instead of this one. --> | 604 your build.xml and it'll be called instead of this one. --> |
725 <target name="-pre-build"/> | 605 <target name="-pre-build"/> |
726 | 606 |
727 <!-- Code Generation: compile resources (aapt -> R.java), aidl, renderscript
--> | 607 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> |
728 <target name="-code-gen"> | 608 <target name="-code-gen"> |
729 <!-- always merge manifest --> | 609 <!-- always merge manifest --> |
730 <mergemanifest | 610 <mergemanifest |
731 appManifest="${manifest.abs.file}" | 611 appManifest="${manifest.abs.file}" |
732 outManifest="${out.manifest.abs.file}" | 612 outManifest="${out.manifest.abs.file}" |
733 enabled="${manifestmerger.enabled}"> | 613 enabled="${manifestmerger.enabled}"> |
734 <library refid="project.library.manifest.file.path" /> | 614 <library refid="project.library.manifest.file.path" /> |
735 </mergemanifest> | 615 </mergemanifest> |
736 | 616 |
737 <do-only-if-manifest-hasCode | 617 <do-only-if-manifest-hasCode |
738 elseText="hasCode = false. Skipping aidl/renderscript/R.java"> | 618 elseText="hasCode = false. Skipping aidl/R.java"> |
739 <echo level="info">Handling aidl files...</echo> | |
740 <aidl executable="${aidl}" | |
741 framework="${project.target.framework.aidl}" | |
742 libraryBinAidlFolderPathRefid="project.library.bin.aidl.fold
er.path" | |
743 genFolder="${gen.absolute.dir}" | |
744 aidlOutFolder="${out.aidl.absolute.dir}"> | |
745 <source path="${source.absolute.dir}"/> | |
746 </aidl> | |
747 | |
748 <!-- renderscript generates resources so it must be called before aa
pt --> | |
749 <echo level="info">----------</echo> | |
750 <echo level="info">Handling RenderScript files...</echo> | |
751 <renderscript executable="${renderscript}" | |
752 includePathRefId="android.renderscript.include.path" | |
753 genFolder="${gen.absolute.dir}" | |
754 resFolder="${out.res.absolute.dir}/raw" | |
755 targetApi="${project.minSdkVersion}" | |
756 optLevel="${renderscript.opt.level}" | |
757 buildType="${build.is.packaging.debug}" | |
758 previousBuildType="${build.last.is.packaging.debug}"> | |
759 <source path="${source.absolute.dir}"/> | |
760 </renderscript> | |
761 | |
762 <echo level="info">----------</echo> | 619 <echo level="info">----------</echo> |
763 <echo level="info">Handling Resources...</echo> | 620 <echo level="info">Handling Resources...</echo> |
764 <aapt executable="${aapt}" | 621 <aapt executable="${aapt}" |
765 command="package" | 622 command="package" |
766 verbose="${verbose}" | 623 verbose="${verbose}" |
767 manifest="${out.manifest.abs.file}" | 624 manifest="${out.manifest.abs.file}" |
768 androidjar="${project.target.android.jar}" | 625 androidjar="${project.target.android.jar}" |
769 rfolder="${gen.absolute.dir}" | 626 rfolder="${gen.absolute.dir}" |
770 nonConstantId="${android.library}" | 627 nonConstantId="${android.library}" |
771 libraryResFolderPathRefid="project.library.res.folder.path" | 628 libraryResFolderPathRefid="project.library.res.folder.path" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 Override the -compile target. | 663 Override the -compile target. |
807 This target requires 'javac.custom.classpath' to be set to reference | 664 This target requires 'javac.custom.classpath' to be set to reference |
808 of classpath to be used for javac. Also accepts custom path for | 665 of classpath to be used for javac. Also accepts custom path for |
809 sources: 'javac.custom.sourcepath'. | 666 sources: 'javac.custom.sourcepath'. |
810 --> | 667 --> |
811 <!-- Compiles this project's .java files into .class files. --> | 668 <!-- Compiles this project's .java files into .class files. --> |
812 <target | 669 <target |
813 name="-compile" | 670 name="-compile" |
814 depends="-build-setup, -pre-build, -code-gen, -pre-compile"> | 671 depends="-build-setup, -pre-build, -code-gen, -pre-compile"> |
815 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." > | 672 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." > |
816 <!-- If javac.srcdirs.additional isn't set, set it to an empty path. --> | |
817 <if> | |
818 <condition> | |
819 <not> | |
820 <isreference refid="javac.srcdirs.additional"/> | |
821 </not> | |
822 </condition> | |
823 <then> | |
824 <path id="javac.srcdirs.additional"/> | |
825 </then> | |
826 </if> | |
827 <javac | 673 <javac |
828 bootclasspathref="project.target.class.path" | 674 bootclasspathref="project.target.class.path" |
829 classpathref="javac.custom.classpath" | 675 classpathref="javac.custom.classpath" |
830 debug="true" | 676 debug="true" |
831 destdir="${out.classes.absolute.dir}" | 677 destdir="${out.classes.absolute.dir}" |
832 encoding="${java.encoding}" | 678 encoding="${java.encoding}" |
833 extdirs="" | 679 extdirs="" |
834 fork="${need.javac.fork}" | 680 fork="${need.javac.fork}" |
835 includeantruntime="false" | 681 includeantruntime="false" |
836 source="${java.source}" | 682 source="${java.source}" |
837 target="${java.target}" | 683 target="${java.target}" |
838 verbose="${verbose}"> | 684 verbose="${verbose}"> |
839 <src path="${source.absolute.dir}"/> | 685 <src path="${source.absolute.dir}"/> |
840 <src path="${gen.absolute.dir}"/> | 686 <src path="${gen.absolute.dir}"/> |
841 <src> | 687 <src> |
842 <path refid="javac.srcdirs.additional"/> | 688 <path refid="javac.srcdirs.additional"/> |
843 </src> | 689 </src> |
844 <compilerarg value="-Xlint:unchecked"/> | 690 <compilerarg value="-Xlint:unchecked"/> |
845 <compilerarg line="${java.compilerargs}"/> | 691 <compilerarg line="${java.compilerargs}"/> |
846 </javac> | 692 </javac> |
847 <!-- | 693 <!-- |
848 If the project is instrumented, then instrument the classes | |
849 TODO(shashishekhar): Add option to override emma filter. | |
850 --> | |
851 <if condition="${build.is.instrumented}"> | |
852 <then> | |
853 <echo level="info"> | |
854 Instrumenting classes from ${out.absolute.dir}/classes... | |
855 </echo> | |
856 <!-- build the default filter to remove R, Manifest, BuildConfig --> | |
857 <getemmafilter | |
858 appPackage="${project.app.package}" | |
859 filterOut="emma.default.filter" | |
860 libraryPackagesRefId="project.library.packages"/> | |
861 <!-- | |
862 Define where the .em file is output. | |
863 This may have been setup already if this is a library. | |
864 --> | |
865 <property name="emma.coverage.absolute.file" | |
866 location="${out.absolute.dir}/coverage.em"/> | |
867 <!-- It only instruments class files, not any external libs --> | |
868 | |
869 <emma enabled="true"> | |
870 <instr | |
871 instrpath="${out.absolute.dir}/classes" | |
872 metadatafile="${emma.coverage.absolute.file}" | |
873 mode="overwrite" | |
874 outdir="${out.absolute.dir}/classes" | |
875 verbosity="${verbosity}"> | |
876 <filter excludes="${emma.default.filter}"/> | |
877 <filter value="${emma.filter}"/> | |
878 </instr> | |
879 </emma> | |
880 </then> | |
881 </if> | |
882 <!-- | |
883 If the project needs a test jar then generate a jar containing | 694 If the project needs a test jar then generate a jar containing |
884 all compiled classes and referenced jars. | 695 all compiled classes and referenced jars. |
885 project.is.testapp is set by Android's ant build system based on the | 696 project.is.testapp is set by Android's ant build system based on the |
886 target's manifest. It is true only for instrumentation apks. | 697 target's manifest. It is true only for instrumentation apks. |
887 --> | 698 --> |
888 <if condition="${project.is.testapp}"> | 699 <if condition="${project.is.testapp}"> |
889 <then> | 700 <then> |
890 <property-location name="create.test.jar.file" | 701 <property-location name="create.test.jar.file" |
891 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/
> | 702 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/
> |
892 <script language="javascript" src="${create.test.jar.file}"/> | 703 <script language="javascript" src="${create.test.jar.file}"/> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 </proguard> | 829 </proguard> |
1019 </then> | 830 </then> |
1020 </if> | 831 </if> |
1021 </target> | 832 </target> |
1022 | 833 |
1023 <!-- Converts this project's .class files into .dex files --> | 834 <!-- Converts this project's .class files into .dex files --> |
1024 <target name="-dex" depends="-compile, -post-compile, -obfuscate"> | 835 <target name="-dex" depends="-compile, -post-compile, -obfuscate"> |
1025 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> | 836 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> |
1026 <!-- only convert to dalvik bytecode is *not* a library --> | 837 <!-- only convert to dalvik bytecode is *not* a library --> |
1027 <do-only-if-not-library elseText="Library project: do not convert by
tecode..." > | 838 <do-only-if-not-library elseText="Library project: do not convert by
tecode..." > |
1028 <!-- special case for instrumented builds: need to use no-locals
and need | 839 <dex-helper /> |
1029 to pass in the emma jar. --> | |
1030 <if condition="${build.is.instrumented}"> | |
1031 <then> | |
1032 <dex-helper nolocals="true"> | |
1033 <external-libs> | |
1034 <fileset file="${emma.dir}/emma_device.jar" /> | |
1035 </external-libs> | |
1036 </dex-helper> | |
1037 </then> | |
1038 <else> | |
1039 <dex-helper /> | |
1040 </else> | |
1041 </if> | |
1042 </do-only-if-not-library> | 840 </do-only-if-not-library> |
1043 </do-only-if-manifest-hasCode> | 841 </do-only-if-manifest-hasCode> |
1044 </target> | 842 </target> |
1045 | 843 |
1046 <!-- Updates the pre-processed PNG cache --> | 844 <!-- Updates the pre-processed PNG cache --> |
1047 <target name="-crunch"> | 845 <target name="-crunch"> |
1048 <exec executable="${aapt}" taskName="crunch"> | 846 <exec executable="${aapt}" taskName="crunch"> |
1049 <arg value="crunch" /> | 847 <arg value="crunch" /> |
1050 <arg value="-v" /> | 848 <arg value="-v" /> |
1051 <arg value="-S" /> | 849 <arg value="-S" /> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 <!-- <nocompress /> forces no compression on any files in assets
or res/raw --> | 884 <!-- <nocompress /> forces no compression on any files in assets
or res/raw --> |
1087 <!-- <nocompress extension="xml" /> forces no compression on spe
cific file extensions in assets and res/raw --> | 885 <!-- <nocompress extension="xml" /> forces no compression on spe
cific file extensions in assets and res/raw --> |
1088 </aapt> | 886 </aapt> |
1089 </do-only-if-not-library> | 887 </do-only-if-not-library> |
1090 </target> | 888 </target> |
1091 | 889 |
1092 <!-- Packages the application. --> | 890 <!-- Packages the application. --> |
1093 <target name="-package" depends="-dex, -package-resources"> | 891 <target name="-package" depends="-dex, -package-resources"> |
1094 <!-- only package apk if *not* a library project --> | 892 <!-- only package apk if *not* a library project --> |
1095 <do-only-if-not-library elseText="Library project: do not package apk...
" > | 893 <do-only-if-not-library elseText="Library project: do not package apk...
" > |
1096 <if condition="${build.is.instrumented}"> | 894 <package-helper /> |
1097 <then> | |
1098 <package-helper> | |
1099 <extra-jars> | |
1100 <!-- Injected from external file --> | |
1101 <jarfile path="${emma.dir}/emma_device.jar" /> | |
1102 </extra-jars> | |
1103 </package-helper> | |
1104 </then> | |
1105 <else> | |
1106 <package-helper /> | |
1107 </else> | |
1108 </if> | |
1109 </do-only-if-not-library> | 895 </do-only-if-not-library> |
1110 </target> | 896 </target> |
1111 | 897 |
1112 <target name="-post-package" /> | 898 <target name="-post-package" /> |
1113 <target name="-post-build" /> | 899 <target name="-post-build" /> |
1114 | 900 |
1115 <target name="-set-mode-check"> | 901 <target name="-set-mode-check"> |
1116 <fail if="build.is.mode.set" | 902 <fail if="build.is.mode.set" |
1117 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." /> | 903 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." /> |
1118 </target> | 904 </target> |
1119 | 905 |
1120 <!-- ******************************************************* --> | 906 <!-- ******************************************************* --> |
1121 <!-- **************** Debug specific targets *************** --> | 907 <!-- **************** Debug specific targets *************** --> |
1122 <!-- ******************************************************* --> | 908 <!-- ******************************************************* --> |
1123 | 909 |
1124 <target name="-set-debug-files" depends="-set-mode-check"> | 910 <target name="-set-debug-files" depends="-set-mode-check"> |
1125 | 911 |
1126 <property name="out.packaged.file" location="${out.absolute.dir}/${ant.p
roject.name}-debug-unaligned.apk" /> | 912 <property name="out.packaged.file" location="${out.absolute.dir}/${ant.p
roject.name}-debug-unaligned.apk" /> |
1127 <property name="out.final.file" location="${out.absolute.dir}/${ant.proj
ect.name}-debug.apk" /> | 913 <property name="out.final.file" location="${out.absolute.dir}/${ant.proj
ect.name}-debug.apk" /> |
1128 <property name="build.is.mode.set" value="true" /> | 914 <property name="build.is.mode.set" value="true" /> |
1129 </target> | 915 </target> |
1130 | 916 |
1131 | 917 |
1132 <target name="-set-debug-mode" depends="-setup"> | 918 <target name="-set-debug-mode" depends="-setup"> |
1133 <!-- record the current build target --> | 919 <!-- record the current build target --> |
1134 <property name="build.target" value="debug" /> | 920 <property name="build.target" value="debug" /> |
1135 | 921 |
1136 <if> | 922 <property name="build.is.instrumented" value="false" /> |
1137 <condition> | |
1138 <and> | |
1139 <istrue value="${project.is.testapp}" /> | |
1140 <istrue value="${emma.enabled}" /> | |
1141 </and> | |
1142 </condition> | |
1143 <then> | |
1144 <property name="build.is.instrumented" value="true" /> | |
1145 </then> | |
1146 <else> | |
1147 <property name="build.is.instrumented" value="false" /> | |
1148 </else> | |
1149 </if> | |
1150 | 923 |
1151 <!-- whether the build is a debug build. always set. --> | 924 <!-- whether the build is a debug build. always set. --> |
1152 <property name="build.is.packaging.debug" value="true" /> | 925 <property name="build.is.packaging.debug" value="true" /> |
1153 | 926 |
1154 <!-- signing mode: debug --> | 927 <!-- signing mode: debug --> |
1155 <property name="build.is.signing.debug" value="true" /> | 928 <property name="build.is.signing.debug" value="true" /> |
1156 | |
1157 <!-- Renderscript optimization level: none --> | |
1158 <property name="renderscript.opt.level" value="${renderscript.debug.opt.
level}" /> | |
1159 | |
1160 </target> | 929 </target> |
1161 | 930 |
1162 <target name="-debug-obfuscation-check"> | 931 <target name="-debug-obfuscation-check"> |
1163 <!-- proguard is never enabled in debug mode --> | 932 <!-- proguard is never enabled in debug mode --> |
1164 <property name="proguard.enabled" value="false"/> | 933 <property name="proguard.enabled" value="false"/> |
1165 </target> | 934 </target> |
1166 | 935 |
1167 <!-- SDK tools assume that out.packaged.file is signed and name it "...-unal
igned" --> | 936 <!-- SDK tools assume that out.packaged.file is signed and name it "...-unal
igned" --> |
1168 <property name="out.packaged.file" | 937 <property name="out.packaged.file" |
1169 value="${apks.dir}/${ant.project.name}-unsigned.apk" /> | 938 value="${apks.dir}/${ant.project.name}-unsigned.apk" /> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 </target> | 972 </target> |
1204 | 973 |
1205 | 974 |
1206 <!-- ******************************************************* --> | 975 <!-- ******************************************************* --> |
1207 <!-- *************** Release specific targets ************** --> | 976 <!-- *************** Release specific targets ************** --> |
1208 <!-- ******************************************************* --> | 977 <!-- ******************************************************* --> |
1209 | 978 |
1210 <!-- called through target 'release'. Only executed if the keystore and | 979 <!-- called through target 'release'. Only executed if the keystore and |
1211 key alias are known but not their password. --> | 980 key alias are known but not their password. --> |
1212 <target name="-release-prompt-for-password" if="has.keystore" unless="has.pa
ssword"> | 981 <target name="-release-prompt-for-password" if="has.keystore" unless="has.pa
ssword"> |
1213 <!-- Gets passwords --> | |
1214 <input | |
1215 message="Please enter keystore password (store:${key.store}):" | |
1216 addproperty="key.store.password" /> | |
1217 <input | |
1218 message="Please enter password for alias '${key.alias}':" | |
1219 addproperty="key.alias.password" /> | |
1220 </target> | 982 </target> |
1221 | 983 |
1222 <!-- called through target 'release'. Only executed if there's no | 984 <!-- called through target 'release'. Only executed if there's no |
1223 keystore/key alias set --> | 985 keystore/key alias set --> |
1224 <target name="-release-nosign" unless="has.keystore"> | 986 <target name="-release-nosign" unless="has.keystore"> |
1225 <!-- no release builds for library project --> | |
1226 <do-only-if-not-library elseText="" > | |
1227 <sequential> | |
1228 <echo level="info">No key.store and key.alias properties found i
n build.properties.</echo> | |
1229 <echo level="info">Please sign ${out.packaged.file} manually</ec
ho> | |
1230 <echo level="info">and run zipalign from the Android SDK tools.<
/echo> | |
1231 </sequential> | |
1232 </do-only-if-not-library> | |
1233 <record-build-info /> | 987 <record-build-info /> |
1234 </target> | 988 </target> |
1235 | 989 |
1236 <target name="-release-obfuscation-check"> | 990 <target name="-release-obfuscation-check"> |
1237 <echo level="info">proguard.config is ${proguard.config}</echo> | 991 <echo level="info">proguard.config is ${proguard.config}</echo> |
1238 <condition property="proguard.enabled" value="true" else="false"> | 992 <condition property="proguard.enabled" value="true" else="false"> |
1239 <and> | 993 <and> |
1240 <isset property="build.is.mode.release" /> | 994 <isset property="build.is.mode.release" /> |
1241 <isset property="proguard.config" /> | 995 <isset property="proguard.config" /> |
1242 </and> | 996 </and> |
(...skipping 19 matching lines...) Expand all Loading... |
1262 <property name="build.is.instrumented" value="false" /> | 1016 <property name="build.is.instrumented" value="false" /> |
1263 | 1017 |
1264 <!-- release mode is only valid if the manifest does not explicitly | 1018 <!-- release mode is only valid if the manifest does not explicitly |
1265 set debuggable to true. default is false. --> | 1019 set debuggable to true. default is false. --> |
1266 <xpath input="${manifest.abs.file}" expression="/manifest/application/@a
ndroid:debuggable" | 1020 <xpath input="${manifest.abs.file}" expression="/manifest/application/@a
ndroid:debuggable" |
1267 output="build.is.packaging.debug" default="false"/> | 1021 output="build.is.packaging.debug" default="false"/> |
1268 | 1022 |
1269 <!-- signing mode: release --> | 1023 <!-- signing mode: release --> |
1270 <property name="build.is.signing.debug" value="false" /> | 1024 <property name="build.is.signing.debug" value="false" /> |
1271 | 1025 |
1272 <!-- Renderscript optimization level: aggressive --> | |
1273 <property name="renderscript.opt.level" value="${renderscript.release.op
t.level}" /> | |
1274 | |
1275 <if condition="${build.is.packaging.debug}"> | 1026 <if condition="${build.is.packaging.debug}"> |
1276 <then> | 1027 <then> |
1277 <echo>*************************************************</echo> | 1028 <echo>*************************************************</echo> |
1278 <echo>**** Android Manifest has debuggable=true ****</echo> | 1029 <echo>**** Android Manifest has debuggable=true ****</echo> |
1279 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo> | 1030 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo> |
1280 <echo>*************************************************</echo> | 1031 <echo>*************************************************</echo> |
1281 </then> | 1032 </then> |
1282 <else> | 1033 <else> |
1283 <!-- property only set in release mode. | 1034 <!-- property only set in release mode. |
1284 Useful for if/unless attributes in target node | 1035 Useful for if/unless attributes in target node |
(...skipping 30 matching lines...) Expand all Loading... |
1315 </target> | 1066 </target> |
1316 | 1067 |
1317 <!-- This runs -package-release and -release-nosign first and then runs | 1068 <!-- This runs -package-release and -release-nosign first and then runs |
1318 only if release-sign is true (set in -release-check, | 1069 only if release-sign is true (set in -release-check, |
1319 called by -release-no-sign)--> | 1070 called by -release-no-sign)--> |
1320 <target name="release" | 1071 <target name="release" |
1321 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -
post-build" | 1072 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -
post-build" |
1322 description="Builds the application in release mode."> | 1073 description="Builds the application in release mode."> |
1323 </target> | 1074 </target> |
1324 | 1075 |
1325 <!-- ******************************************************* --> | |
1326 <!-- ************ Instrumented specific targets ************ --> | |
1327 <!-- ******************************************************* --> | |
1328 | |
1329 <!-- These targets are specific for the project under test when it | |
1330 gets compiled by the test projects in a way that will make it | |
1331 support emma code coverage --> | |
1332 | |
1333 <target name="-set-instrumented-mode" depends="-set-mode-check"> | |
1334 <property name="out.packaged.file" location="${out.absolute.dir}/${ant.p
roject.name}-instrumented-unaligned.apk" /> | |
1335 <property name="out.final.file" location="${out.absolute.dir}/${ant.proj
ect.name}-instrumented.apk" /> | |
1336 <property name="build.is.mode.set" value="true" /> | |
1337 | |
1338 <!-- whether the build is an instrumented build. --> | |
1339 <property name="build.is.instrumented" value="true" /> | |
1340 </target> | |
1341 | |
1342 <!-- Builds instrumented output package --> | |
1343 <target name="instrument" depends="-set-instrumented-mode, -do-debug" | |
1344 description="Builds an instrumented packaged."> | |
1345 <!-- only create apk if *not* a library project --> | |
1346 <do-only-if-not-library elseText="Library project: do not create apk..."
> | |
1347 <sequential> | |
1348 <zipalign-helper in.package="${out.packaged.file}" out.package="
${out.final.file}" /> | |
1349 <echo level="info">Instrumented Package: ${out.final.file}</echo
> | |
1350 </sequential> | |
1351 </do-only-if-not-library> | |
1352 <record-build-info /> | |
1353 </target> | |
1354 | |
1355 <!-- ******************************************************* --> | |
1356 <!-- ************ Test project specific targets ************ --> | |
1357 <!-- ******************************************************* --> | |
1358 | |
1359 <!-- enable code coverage --> | |
1360 <target name="emma"> | |
1361 <property name="emma.enabled" value="true" /> | |
1362 </target> | |
1363 | |
1364 <!-- fails if the project is not a test project --> | |
1365 <target name="-test-project-check" depends="-setup"> | |
1366 <if> | |
1367 <condition> | |
1368 <and> | |
1369 <isfalse value="${project.is.test}" /> | |
1370 <isfalse value="${project.is.testapp}" /> | |
1371 </and> | |
1372 </condition> | |
1373 <then> | |
1374 <fail message="Project is not a test project." /> | |
1375 </then> | |
1376 </if> | |
1377 </target> | |
1378 | |
1379 <target name="test" depends="-test-project-check" | |
1380 description="Runs tests from the package defined in test.package
property"> | |
1381 <property name="test.runner" value="android.test.InstrumentationTestRunn
er" /> | |
1382 | |
1383 <if condition="${project.is.test}"> | |
1384 <then> | |
1385 <property name="tested.project.absolute.dir" location="${tested.proj
ect.dir}" /> | |
1386 | |
1387 <!-- Application package of the tested project extracted from its ma
nifest file --> | |
1388 <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml" | |
1389 expression="/manifest/@package" output="tested.project.app.p
ackage" /> | |
1390 | |
1391 <if condition="${emma.enabled}"> | |
1392 <then> | |
1393 <getprojectpaths projectPath="${tested.project.absolute.dir}
" | |
1394 binOut="tested.project.out.absolute.dir" | |
1395 srcOut="tested.project.source.absolute.dir" /> | |
1396 | |
1397 <getlibpath projectPath="${tested.project.absolute.dir}" | |
1398 libraryFolderPathOut="tested.project.lib.source.path
" | |
1399 leaf="@{source.dir}" /> | |
1400 | |
1401 </then> | |
1402 </if> | |
1403 | |
1404 </then> | |
1405 <else> | |
1406 <!-- this is a test app, the tested package is the app's own package
--> | |
1407 <property name="tested.project.app.package" value="${project.app.pac
kage}" /> | |
1408 | |
1409 <if condition="${emma.enabled}"> | |
1410 <then> | |
1411 <property name="tested.project.out.absolute.dir" value="${ou
t.absolute.dir}" /> | |
1412 <property name="tested.project.source.absolute.dir" value="$
{source.absolute.dir}" /> | |
1413 | |
1414 <getlibpath | |
1415 libraryFolderPathOut="tested.project.lib.source.path
" | |
1416 leaf="@{source.dir}" /> | |
1417 | |
1418 </then> | |
1419 </if> | |
1420 | |
1421 </else> | |
1422 </if> | |
1423 | |
1424 <property name="emma.dump.file" | |
1425 value="/data/data/${tested.project.app.package}/coverage.ec" /> | |
1426 | |
1427 <if condition="${emma.enabled}"> | |
1428 <then> | |
1429 <echo>Running tests...</echo> | |
1430 <run-tests-helper emma.enabled="true"> | |
1431 <extra-instrument-args> | |
1432 <arg value="-e" /> | |
1433 <arg value="coverageFile" /> | |
1434 <arg value="${emma.dump.file}" /> | |
1435 </extra-instrument-args> | |
1436 </run-tests-helper> | |
1437 | |
1438 <echo level="info">Settting permission to download the coverage
file...</echo> | |
1439 <exec executable="${adb}" failonerror="true"> | |
1440 <arg line="${adb.device.arg}" /> | |
1441 <arg value="shell" /> | |
1442 <arg value="run-as" /> | |
1443 <arg value="${tested.project.app.package}" /> | |
1444 <arg value="chmod" /> | |
1445 <arg value="644" /> | |
1446 <arg value="${emma.dump.file}" /> | |
1447 </exec> | |
1448 <echo level="info">Downloading coverage file into project direct
ory...</echo> | |
1449 <exec executable="${adb}" failonerror="true"> | |
1450 <arg line="${adb.device.arg}" /> | |
1451 <arg value="pull" /> | |
1452 <arg value="${emma.dump.file}" /> | |
1453 <arg path="${out.absolute.dir}/coverage.ec" /> | |
1454 </exec> | |
1455 | |
1456 <pathconvert property="tested.project.lib.source.path.value" ref
id="tested.project.lib.source.path"> | |
1457 <firstmatchmapper> | |
1458 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | |
1459 <identitymapper/> | |
1460 </firstmatchmapper> | |
1461 </pathconvert> | |
1462 | |
1463 <echo level="info">Extracting coverage report...</echo> | |
1464 <emma> | |
1465 <property name="report.html.out.encoding" value="UTF-8" /> | |
1466 <report sourcepath="${tested.project.source.absolute.dir}:${
tested.project.lib.source.path.value}" | |
1467 verbosity="${verbosity}"> | |
1468 <!-- TODO: report.dir or something like should be introd
uced if necessary --> | |
1469 <infileset file="${out.absolute.dir}/coverage.ec" /> | |
1470 <infileset file="${tested.project.out.absolute.dir}/cove
rage.em" /> | |
1471 <!-- TODO: reports in other, indicated by user formats -
-> | |
1472 <html outfile="${out.absolute.dir}/coverage.html" /> | |
1473 <txt outfile="${out.absolute.dir}/coverage.txt" /> | |
1474 <xml outfile="${out.absolute.dir}/coverage.xml" /> | |
1475 </report> | |
1476 </emma> | |
1477 <echo level="info">Cleaning up temporary files...</echo> | |
1478 <delete file="${out.absolute.dir}/coverage.ec" /> | |
1479 <delete file="${tested.project.out.absolute.dir}/coverage.em" /> | |
1480 <exec executable="${adb}" failonerror="true"> | |
1481 <arg line="${adb.device.arg}" /> | |
1482 <arg value="shell" /> | |
1483 <arg value="run-as" /> | |
1484 <arg value="${tested.project.app.package}" /> | |
1485 <arg value="rm" /> | |
1486 <arg value="${emma.dump.file}" /> | |
1487 </exec> | |
1488 <echo level="info">Saving the coverage reports in ${out.absolute
.dir}</echo> | |
1489 </then> | |
1490 <else> | |
1491 <run-tests-helper /> | |
1492 </else> | |
1493 </if> | |
1494 </target> | |
1495 | |
1496 <!-- ******************************************************* --> | |
1497 <!-- ********** Run Lint on the project ********* --> | |
1498 <!-- ******************************************************* --> | |
1499 | |
1500 <target name="lint" | |
1501 description="Runs lint on the project to look for potential bugs" > | |
1502 <lint executable="${lint}" | |
1503 html="${lint.out.html}" | |
1504 xml="${lint.out.xml}" | |
1505 src="${source.absolute.dir}:${gen.absolute.dir}" | |
1506 classpath="${out.classes.absolute.dir}" /> | |
1507 </target> | |
1508 | |
1509 <!-- ******************************************************* --> | |
1510 <!-- ********** Install/uninstall specific targets ********* --> | |
1511 <!-- ******************************************************* --> | |
1512 | |
1513 <target name="install" | |
1514 description="Installs the newly build package. Must be used in c
onjunction with a build target | |
1515 (debug/release/instrument). If the application was p
reviously installed, the application | |
1516 is reinstalled if the signature matches." > | |
1517 <!-- only do install if *not* a library project --> | |
1518 <do-only-if-not-library elseText="Library project: nothing to install!"
> | |
1519 <if> | |
1520 <condition> | |
1521 <isset property="out.final.file" /> | |
1522 </condition> | |
1523 <then> | |
1524 <if> | |
1525 <condition> | |
1526 <resourceexists> | |
1527 <file file="${out.final.file}"/> | |
1528 </resourceexists> | |
1529 </condition> | |
1530 <then> | |
1531 <echo level="info">Installing ${out.final.file} onto
default emulator or device...</echo> | |
1532 <exec executable="${adb}" failonerror="true"> | |
1533 <arg line="${adb.device.arg}" /> | |
1534 <arg value="install" /> | |
1535 <arg value="-r" /> | |
1536 <arg path="${out.final.file}" /> | |
1537 </exec> | |
1538 | |
1539 <!-- now install the tested project if applicable --
> | |
1540 <!-- can't use project.is.test since the setup targe
t might not have run --> | |
1541 <if> | |
1542 <condition> | |
1543 <and> | |
1544 <isset property="tested.project.dir" /> | |
1545 <not> | |
1546 <isset property="dont.do.deps" /> | |
1547 </not> | |
1548 </and> | |
1549 </condition> | |
1550 <then> | |
1551 <property name="tested.project.absolute.dir"
location="${tested.project.dir}" /> | |
1552 | |
1553 <!-- figure out which tested package to inst
all based on emma.enabled --> | |
1554 <condition property="tested.project.install.
target" value="installi" else="installd"> | |
1555 <isset property="emma.enabled" /> | |
1556 </condition> | |
1557 <subant target="${tested.project.install.tar
get}" failonerror="true"> | |
1558 <fileset dir="${tested.project.absolute.
dir}" includes="build.xml" /> | |
1559 </subant> | |
1560 </then> | |
1561 </if> | |
1562 </then> | |
1563 <else> | |
1564 <fail message="File ${out.final.file} does not exist
." /> | |
1565 </else> | |
1566 </if> | |
1567 </then> | |
1568 <else> | |
1569 <echo>Install file not specified.</echo> | |
1570 <echo></echo> | |
1571 <echo>'ant install' now requires the build target to be spec
ified as well.</echo> | |
1572 <echo></echo> | |
1573 <echo></echo> | |
1574 <echo> ant debug install</echo> | |
1575 <echo> ant release install</echo> | |
1576 <echo> ant instrument install</echo> | |
1577 <echo>This will build the given package and install it.</ech
o> | |
1578 <echo></echo> | |
1579 <echo>Alternatively, you can use</echo> | |
1580 <echo> ant installd</echo> | |
1581 <echo> ant installr</echo> | |
1582 <echo> ant installi</echo> | |
1583 <echo> ant installt</echo> | |
1584 <echo>to only install an existing package (this will not reb
uild the package.)</echo> | |
1585 <fail /> | |
1586 </else> | |
1587 </if> | |
1588 </do-only-if-not-library> | |
1589 </target> | |
1590 | |
1591 <target name="installd" depends="-set-debug-files, install" | |
1592 description="Installs (only) the debug package." /> | |
1593 <target name="installr" depends="-set-release-mode, install" | |
1594 description="Installs (only) the release package." /> | |
1595 <target name="installi" depends="-set-instrumented-mode, install" | |
1596 description="Installs (only) the instrumented package." /> | |
1597 <target name="installt" depends="-test-project-check, installd" | |
1598 description="Installs (only) the test and tested packages." /> | |
1599 | |
1600 | |
1601 <!-- Uninstalls the package from the default emulator/device --> | |
1602 <target name="uninstall" depends="-setup" | |
1603 description="Uninstalls the application from a running emulator
or device."> | |
1604 <if> | |
1605 <condition> | |
1606 <isset property="project.app.package" /> | |
1607 </condition> | |
1608 <then> | |
1609 <uninstall-helper app.package="${project.app.package}" /> | |
1610 </then> | |
1611 <else> | |
1612 <fail message="Could not find application package in manifest. C
annot run 'adb uninstall'." /> | |
1613 </else> | |
1614 </if> | |
1615 | |
1616 <!-- Now uninstall the tested project, if applicable --> | |
1617 <if> | |
1618 <condition> | |
1619 <and> | |
1620 <istrue value="${project.is.test}" /> | |
1621 <not> | |
1622 <isset property="dont.do.deps" /> | |
1623 </not> | |
1624 </and> | |
1625 </condition> | |
1626 <then> | |
1627 <property name="tested.project.absolute.dir" location="${tested.
project.dir}" /> | |
1628 | |
1629 <!-- Application package of the tested project extracted from it
s manifest file --> | |
1630 <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml
" | |
1631 expression="/manifest/@package" output="tested.project.app.p
ackage" /> | |
1632 <if> | |
1633 <condition> | |
1634 <isset property="tested.project.app.package" /> | |
1635 </condition> | |
1636 <then> | |
1637 <uninstall-helper app.package="${tested.project.app.pack
age}" /> | |
1638 </then> | |
1639 <else> | |
1640 <fail message="Could not find tested application package
in manifest. Cannot run 'adb uninstall'." /> | |
1641 </else> | |
1642 </if> | |
1643 </then> | |
1644 </if> | |
1645 | |
1646 </target> | |
1647 | |
1648 | |
1649 <!-- ******************************************************* --> | |
1650 <!-- ************************* Help ************************ --> | |
1651 <!-- ******************************************************* --> | |
1652 | |
1653 <target name="help"> | |
1654 <!-- displays starts at col 13 | |
1655 |13 8
0| --> | |
1656 <echo>Android Ant Build. Available targets:</echo> | |
1657 <echo> help: Displays this help.</echo> | |
1658 <echo> clean: Removes output files created by other targets.</echo
> | |
1659 <echo> The 'all' target can be used to clean dependencies</
echo> | |
1660 <echo> (tested projects and libraries)at the same time</ech
o> | |
1661 <echo> using: 'ant all clean'</echo> | |
1662 <echo> debug: Builds the application and signs it with a debug key
.</echo> | |
1663 <echo> The 'nodeps' target can be used to only build the</e
cho> | |
1664 <echo> current project and ignore the libraries using:</ech
o> | |
1665 <echo> 'ant nodeps debug'</echo> | |
1666 <echo> release: Builds the application. The generated apk file must
be</echo> | |
1667 <echo> signed before it is published.</echo> | |
1668 <echo> The 'nodeps' target can be used to only build the</e
cho> | |
1669 <echo> current project and ignore the libraries using:</ech
o> | |
1670 <echo> 'ant nodeps release'</echo> | |
1671 <echo> instrument:Builds an instrumented package and signs it with a</
echo> | |
1672 <echo> debug key.</echo> | |
1673 <echo> test: Runs the tests. Project must be a test project and</
echo> | |
1674 <echo> must have been built. Typical usage would be:</echo> | |
1675 <echo> ant [emma] debug install test</echo> | |
1676 <echo> emma: Transiently enables code coverage for subsequent</ec
ho> | |
1677 <echo> targets.</echo> | |
1678 <echo> install: Installs the newly build package. Must either be use
d</echo> | |
1679 <echo> in conjunction with a build target (debug/release/</
echo> | |
1680 <echo> instrument) or with the proper suffix indicating</ec
ho> | |
1681 <echo> which package to install (see below).</echo> | |
1682 <echo> If the application was previously installed, the</ec
ho> | |
1683 <echo> application is reinstalled if the signature matches.
</echo> | |
1684 <echo> installd: Installs (only) the debug package.</echo> | |
1685 <echo> installr: Installs (only) the release package.</echo> | |
1686 <echo> installi: Installs (only) the instrumented package.</echo> | |
1687 <echo> installt: Installs (only) the test and tested packages (unless
</echo> | |
1688 <echo> nodeps is used as well.</echo> | |
1689 <echo> uninstall: Uninstalls the application from a running emulator o
r</echo> | |
1690 <echo> device. Also uninstall tested package if applicable<
/echo> | |
1691 <echo> unless 'nodeps' is used as well.</echo> | |
1692 </target> | |
1693 </project> | 1076 </project> |
OLD | NEW |