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