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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 <!-- Custom tasks --> | 132 <!-- Custom tasks --> |
133 <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> | 133 <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> |
134 | 134 |
135 <!-- ******************************************************* --> | 135 <!-- ******************************************************* --> |
136 <!-- ******************* Other Properties ****************** --> | 136 <!-- ******************* Other Properties ****************** --> |
137 <!-- ******************************************************* --> | 137 <!-- ******************************************************* --> |
138 <!-- overriding these properties may break the build | 138 <!-- overriding these properties may break the build |
139 unless the whole file is updated --> | 139 unless the whole file is updated --> |
140 | 140 |
| 141 <target name="-set-release-mode"> |
| 142 <!-- record the current build target --> |
| 143 <property name="build.target" value="release" /> |
| 144 |
| 145 <!-- release mode is only valid if the manifest does not explicitly |
| 146 set debuggable to true. default is false. --> |
| 147 <xpath input="${manifest.abs.file}" expression="/manifest/application/@a
ndroid:debuggable" |
| 148 output="build.is.packaging.debug" default="false"/> |
| 149 |
| 150 <if condition="${build.is.packaging.debug}"> |
| 151 <then> |
| 152 <echo>*************************************************</echo> |
| 153 <echo>**** Android Manifest has debuggable=true ****</echo> |
| 154 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo> |
| 155 <echo>*************************************************</echo> |
| 156 </then> |
| 157 <else> |
| 158 <!-- property only set in release mode. |
| 159 Useful for if/unless attributes in target node |
| 160 when using Ant before 1.8 --> |
| 161 <property name="build.is.mode.release" value="true"/> |
| 162 </else> |
| 163 </if> |
| 164 |
| 165 <echo level="info">proguard.config is ${proguard.config}</echo> |
| 166 <condition property="proguard.enabled" value="true" else="false"> |
| 167 <and> |
| 168 <isset property="build.is.mode.release" /> |
| 169 <isset property="proguard.config" /> |
| 170 </and> |
| 171 </condition> |
| 172 <if condition="${proguard.enabled}"> |
| 173 <then> |
| 174 <echo level="info">Proguard.config is enabled</echo> |
| 175 <!-- Secondary dx input (jar files) is empty since all the |
| 176 jar files will be in the obfuscated jar --> |
| 177 <path id="out.dex.jar.input.ref" /> |
| 178 </then> |
| 179 </if> |
| 180 </target> |
| 181 |
| 182 <target name="-set-debug-mode"> |
| 183 <!-- record the current build target --> |
| 184 <property name="build.target" value="debug" /> |
| 185 |
| 186 <!-- whether the build is a debug build. always set. --> |
| 187 <property name="build.is.packaging.debug" value="true" /> |
| 188 |
| 189 <!-- proguard is never enabled in debug mode --> |
| 190 <property name="proguard.enabled" value="false"/> |
| 191 </target> |
| 192 |
| 193 |
141 <!-- Input directories --> | 194 <!-- Input directories --> |
142 <property name="source.dir" value="src" /> | 195 <property name="source.dir" value="src" /> |
143 <property name="source.absolute.dir" location="${source.dir}" /> | 196 <property name="source.absolute.dir" location="${source.dir}" /> |
144 <property-value name="gen.absolute.dir" value="${out.dir}/gen"/> | 197 <property-value name="gen.absolute.dir" value="${out.dir}/gen"/> |
145 <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/> | 198 <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/> |
146 <property name="asset.dir" value="assets" /> | 199 <property name="asset.dir" value="assets" /> |
147 <condition property="asset.absolute.dir" | 200 <condition property="asset.absolute.dir" |
148 value="${out.dir}/assets" | 201 value="${out.dir}/assets" |
149 else="${ASSET_DIR}"> | 202 else="${ASSET_DIR}"> |
150 <equals arg1="${ASSET_DIR}" arg2=""/> | 203 <equals arg1="${ASSET_DIR}" arg2=""/> |
151 </condition> | 204 </condition> |
152 | 205 |
153 <property name="jar.libs.dir" value="libs" /> | |
154 <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" /> | |
155 <property-location name="native.libs.absolute.dir" location="${out.dir}/libs
" | 206 <property-location name="native.libs.absolute.dir" location="${out.dir}/libs
" |
156 check-exists="false"/> | 207 check-exists="false"/> |
157 | 208 |
158 <property name="manifest.file" value="AndroidManifest.xml" /> | 209 <property name="manifest.file" value="AndroidManifest.xml" /> |
159 <property name="manifest.abs.file" location="${manifest.file}" /> | 210 <property name="manifest.abs.file" location="${manifest.file}" /> |
160 | 211 |
161 <!-- Output directories --> | 212 <!-- Output directories --> |
162 <property name="out.dir" value="bin" /> | 213 <property name="out.dir" value="bin" /> |
163 <property name="out.absolute.dir" location="${out.dir}" /> | 214 <property name="out.absolute.dir" location="${out.dir}" /> |
164 <property name="out.classes.absolute.dir" location="${out.dir}/classes" /> | 215 <property name="out.classes.absolute.dir" location="${out.dir}/classes" /> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 249 |
199 <!-- properties for packaging --> | 250 <!-- properties for packaging --> |
200 <property name="build.packaging.nocrunch" value="true" /> | 251 <property name="build.packaging.nocrunch" value="true" /> |
201 | 252 |
202 <property name="need.javac.fork" value="false" /> | 253 <property name="need.javac.fork" value="false" /> |
203 | 254 |
204 <!-- ******************************************************* --> | 255 <!-- ******************************************************* --> |
205 <!-- ******************** Build Targets ******************** --> | 256 <!-- ******************** Build Targets ******************** --> |
206 <!-- ******************************************************* --> | 257 <!-- ******************************************************* --> |
207 | 258 |
208 <!-- Basic Ant + SDK check --> | 259 <!-- generic setup --> |
209 <target name="-check-env"> | 260 <target name="-setup"> |
210 <checkenv /> | 261 <checkenv /> |
211 </target> | |
212 | |
213 <!-- generic setup --> | |
214 <target name="-setup" depends="-check-env"> | |
215 <echo level="info">Project Name: ${ant.project.name}</echo> | 262 <echo level="info">Project Name: ${ant.project.name}</echo> |
216 <gettype projectTypeOut="project.type" /> | 263 <gettype projectTypeOut="project.type" /> |
217 | 264 |
218 <!-- sets a few boolean based on project.type | 265 <!-- sets a few boolean based on project.type |
219 to make the if task easier --> | 266 to make the if task easier --> |
220 <condition property="project.is.testapp" value="true" else="false"> | 267 <condition property="project.is.testapp" value="true" else="false"> |
221 <equals arg1="${project.type}" arg2="test-app" /> | 268 <equals arg1="${project.type}" arg2="test-app" /> |
222 </condition> | 269 </condition> |
223 | 270 |
224 <!-- get the project manifest package --> | 271 <!-- get the project manifest package --> |
225 <xpath input="${manifest.abs.file}" | 272 <xpath input="${manifest.abs.file}" |
226 expression="/manifest/@package" output="project.app.package" /> | 273 expression="/manifest/@package" output="project.app.package" /> |
227 </target> | |
228 | |
229 <!-- Pre build setup --> | |
230 <target name="-build-setup" depends="-setup"> | |
231 | 274 |
232 <!-- read the previous build mode --> | 275 <!-- read the previous build mode --> |
233 <property file="${out.build.prop.file}" /> | 276 <property file="${out.build.prop.file}" /> |
234 | 277 |
235 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec
ho> | 278 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec
ho> |
236 <!-- load project properties, resolve Android target, library dependenci
es | 279 <!-- load project properties, resolve Android target, library dependenci
es |
237 and set some properties with the results. | 280 and set some properties with the results. |
238 All property names are passed as parameters ending in -Out --> | 281 All property names are passed as parameters ending in -Out --> |
239 <gettarget | 282 <gettarget |
240 androidJarFileOut="project.target.android.jar" | 283 androidJarFileOut="project.target.android.jar" |
241 androidAidlFileOut="project.target.framework.aidl" | 284 androidAidlFileOut="project.target.framework.aidl" |
242 bootClassPathOut="project.target.class.path" | 285 bootClassPathOut="project.target.class.path" |
243 targetApiOut="project.target.apilevel" | 286 targetApiOut="project.target.apilevel" |
244 minSdkVersionOut="project.minSdkVersion" /> | 287 minSdkVersionOut="project.minSdkVersion" /> |
245 | 288 |
246 <property name="manifest.hasCode" value="true" /> | 289 <property name="manifest.hasCode" value="true" /> |
247 | 290 |
248 | |
249 <echo level="info">----------</echo> | 291 <echo level="info">----------</echo> |
250 <echo level="info">Creating output directories if needed...</echo> | 292 <echo level="info">Creating output directories if needed...</echo> |
251 <mkdir dir="${resource.absolute.dir}" /> | |
252 <mkdir dir="${jar.libs.absolute.dir}" /> | |
253 <mkdir dir="${out.absolute.dir}" /> | 293 <mkdir dir="${out.absolute.dir}" /> |
254 <mkdir dir="${out.res.absolute.dir}" /> | 294 <mkdir dir="${out.res.absolute.dir}" /> |
255 <mkdir dir="${gen.absolute.dir}" /> | 295 <mkdir dir="${gen.absolute.dir}" /> |
256 <mkdir dir="${out.classes.absolute.dir}" /> | 296 <mkdir dir="${out.classes.absolute.dir}" /> |
257 <mkdir dir="${out.dexed.absolute.dir}" /> | 297 <mkdir dir="${out.dexed.absolute.dir}" /> |
258 </target> | 298 </target> |
259 | 299 |
260 <!-- empty default pre-build target. Create a similar target in | |
261 your build.xml and it'll be called instead of this one. --> | |
262 <target name="-pre-build"/> | |
263 | |
264 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> | 300 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> |
265 <target name="-code-gen"> | 301 <target name="-code-gen" depends="-setup"> |
266 <!-- always merge manifest --> | 302 <!-- always merge manifest --> |
267 <mergemanifest | 303 <mergemanifest |
268 appManifest="${manifest.abs.file}" | 304 appManifest="${manifest.abs.file}" |
269 outManifest="${out.manifest.abs.file}" | 305 outManifest="${out.manifest.abs.file}" |
270 enabled="${manifestmerger.enabled}"> | 306 enabled="${manifestmerger.enabled}"> |
271 </mergemanifest> | 307 </mergemanifest> |
272 | 308 |
273 <echo level="info">----------</echo> | 309 <echo level="info">----------</echo> |
274 <echo level="info">Handling Resources...</echo> | 310 <echo level="info">Handling Resources...</echo> |
275 <aapt executable="${aapt}" | 311 <aapt executable="${aapt}" |
276 command="package" | 312 command="package" |
277 verbose="${verbose}" | 313 verbose="${verbose}" |
278 manifest="${out.manifest.abs.file}" | 314 manifest="${out.manifest.abs.file}" |
279 androidjar="${project.target.android.jar}" | 315 androidjar="${project.target.android.jar}" |
280 rfolder="${gen.absolute.dir}" | 316 rfolder="${gen.absolute.dir}" |
281 nonConstantId="${android.library}" | 317 nonConstantId="${android.library}" |
282 libraryResFolderPathRefid="project.library.res.folder.path" | 318 libraryResFolderPathRefid="project.library.res.folder.path" |
283 libraryPackagesRefid="project.library.packages" | 319 libraryPackagesRefid="project.library.packages" |
284 libraryRFileRefid="project.library.bin.r.file.path" | 320 libraryRFileRefid="project.library.bin.r.file.path" |
285 ignoreAssets="${aapt.ignore.assets}" | 321 ignoreAssets="${aapt.ignore.assets}" |
286 binFolder="${out.absolute.dir}" | 322 binFolder="${out.absolute.dir}" |
287 proguardFile="${out.absolute.dir}/proguard.txt"> | 323 proguardFile="${out.absolute.dir}/proguard.txt"> |
288 <res path="${out.res.absolute.dir}" /> | 324 <res path="${out.res.absolute.dir}" /> |
289 <res path="${resource.absolute.dir}" /> | 325 <res path="${resource.absolute.dir}" /> |
290 </aapt> | 326 </aapt> |
291 | 327 |
292 <echo level="info">----------</echo> | |
293 <echo level="info">Handling BuildConfig class...</echo> | |
294 <buildconfig | |
295 genFolder="${gen.absolute.dir}" | |
296 package="${project.app.package}" | |
297 buildType="${build.is.packaging.debug}" | |
298 previousBuildType=""/> | |
299 </target> | |
300 | |
301 <!-- empty default pre-compile target. Create a similar target in | |
302 your build.xml and it'll be called instead of this one. --> | |
303 <target name="-pre-compile"> | |
304 <!-- | |
305 Remove all .class files from the output directory. This prevents inclusi
on of incorrect .class | |
306 files in the final apk. For example, if a .java file was deleted, the ap
k should not contain | |
307 the .class files for that .java from previous builds. | |
308 --> | |
309 <delete> | |
310 <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/> | |
311 </delete> | |
312 </target> | 328 </target> |
313 | 329 |
314 <!-- | 330 <!-- |
315 Override the -compile target. | 331 Override the -compile target. |
316 This target requires 'javac.custom.classpath' to be set to reference | 332 This target requires 'javac.custom.classpath' to be set to reference |
317 of classpath to be used for javac. Also accepts custom path for | 333 of classpath to be used for javac. Also accepts custom path for |
318 sources: 'javac.custom.sourcepath'. | 334 sources: 'javac.custom.sourcepath'. |
319 --> | 335 --> |
320 <!-- Compiles this project's .java files into .class files. --> | 336 <!-- Compiles this project's .java files into .class files. --> |
321 <target | 337 <target name="-compile" depends="-code-gen"> |
322 name="-compile" | 338 <delete> |
323 depends="-build-setup, -pre-build, -code-gen, -pre-compile"> | 339 <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/> |
| 340 </delete> |
| 341 |
324 <javac | 342 <javac |
325 bootclasspathref="project.target.class.path" | 343 bootclasspathref="project.target.class.path" |
326 classpathref="javac.custom.classpath" | 344 classpathref="javac.custom.classpath" |
327 debug="true" | 345 debug="true" |
328 destdir="${out.classes.absolute.dir}" | 346 destdir="${out.classes.absolute.dir}" |
329 encoding="${java.encoding}" | 347 encoding="${java.encoding}" |
330 extdirs="" | 348 extdirs="" |
331 fork="${need.javac.fork}" | 349 fork="${need.javac.fork}" |
332 includeantruntime="false" | 350 includeantruntime="false" |
333 source="${java.source}" | 351 source="${java.source}" |
(...skipping 13 matching lines...) Expand all Loading... |
347 project.is.testapp is set by Android's ant build system based on the | 365 project.is.testapp is set by Android's ant build system based on the |
348 target's manifest. It is true only for instrumentation apks. | 366 target's manifest. It is true only for instrumentation apks. |
349 --> | 367 --> |
350 <if condition="${project.is.testapp}"> | 368 <if condition="${project.is.testapp}"> |
351 <then> | 369 <then> |
352 <property-location name="create.test.jar.file" | 370 <property-location name="create.test.jar.file" |
353 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/> | 371 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/> |
354 <script language="javascript" src="${create.test.jar.file}"/> | 372 <script language="javascript" src="${create.test.jar.file}"/> |
355 </then> | 373 </then> |
356 </if> | 374 </if> |
357 </target> | |
358 | |
359 <!-- empty default post-compile target. Create a similar target in | |
360 your build.xml and it'll be called instead of this one. --> | |
361 <target name="-post-compile"> | |
362 <!-- | 375 <!-- |
363 Copy gdbserver to main libs directory if building a non-instrumentation
debug apk. | 376 Copy gdbserver to main libs directory if building a non-instrumentation
debug apk. |
364 --> | 377 --> |
365 <if> | 378 <if> |
366 <condition> | 379 <condition> |
367 <and> | 380 <and> |
368 <equals arg1="${build.target}" arg2="debug"/> | 381 <equals arg1="${build.target}" arg2="debug"/> |
369 <isfalse value="${project.is.testapp}"/> | 382 <isfalse value="${project.is.testapp}"/> |
370 </and> | 383 </and> |
371 </condition> | 384 </condition> |
(...skipping 14 matching lines...) Expand all Loading... |
386 | 399 |
387 <!-- Obfuscate target | 400 <!-- Obfuscate target |
388 This is only active in release builds when proguard.config is defined | 401 This is only active in release builds when proguard.config is defined |
389 in default.properties. | 402 in default.properties. |
390 | 403 |
391 --> | 404 --> |
392 <!-- | 405 <!-- |
393 Override obfuscate target to pass javac.custom.classpath to Proguard. SDK
tools do not provide | 406 Override obfuscate target to pass javac.custom.classpath to Proguard. SDK
tools do not provide |
394 any way to pass custom class paths to Proguard. | 407 any way to pass custom class paths to Proguard. |
395 --> | 408 --> |
396 <target name="-obfuscate"> | 409 <target name="-obfuscate" depends="-compile"> |
397 <if condition="${proguard.enabled}"> | 410 <if condition="${proguard.enabled}"> |
398 <then> | 411 <then> |
399 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/
proguard"/> | 412 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/
proguard"/> |
400 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir
}/original.jar"/> | 413 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir
}/original.jar"/> |
401 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/
obfuscated.jar"/> | 414 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/
obfuscated.jar"/> |
402 <!-- input for dex will be proguard's output --> | 415 <!-- input for dex will be proguard's output --> |
403 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.fi
le}"/> | 416 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.fi
le}"/> |
404 | 417 |
405 <!-- Add Proguard Tasks --> | 418 <!-- Add Proguard Tasks --> |
406 <property name="proguard.jar" location="${android.tools.dir}/proguard/
lib/proguard.jar"/> | 419 <property name="proguard.jar" location="${android.tools.dir}/proguard/
lib/proguard.jar"/> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 -dump "${obfuscate.absolute.dir}/dump.txt" | 475 -dump "${obfuscate.absolute.dir}/dump.txt" |
463 -printseeds "${obfuscate.absolute.dir}/seeds.txt" | 476 -printseeds "${obfuscate.absolute.dir}/seeds.txt" |
464 -printusage "${obfuscate.absolute.dir}/usage.txt" | 477 -printusage "${obfuscate.absolute.dir}/usage.txt" |
465 -printmapping "${obfuscate.absolute.dir}/mapping.txt" | 478 -printmapping "${obfuscate.absolute.dir}/mapping.txt" |
466 </proguard> | 479 </proguard> |
467 </then> | 480 </then> |
468 </if> | 481 </if> |
469 </target> | 482 </target> |
470 | 483 |
471 <!-- Converts this project's .class files into .dex files --> | 484 <!-- Converts this project's .class files into .dex files --> |
472 <target name="-dex" depends="-compile, -post-compile, -obfuscate"> | 485 <target name="-dex" depends="-obfuscate"> |
473 <sequential> | 486 <sequential> |
474 <!-- sets the primary input for dex. If a pre-dex task sets it to | 487 <!-- sets the primary input for dex. If a pre-dex task sets it to |
475 something else this has no effect --> | 488 something else this has no effect --> |
476 <property name="out.dex.input.absolute.dir" value="${out.classes.abs
olute.dir}" /> | 489 <property name="out.dex.input.absolute.dir" value="${out.classes.abs
olute.dir}" /> |
477 <property name="dex.force.jumbo" value="false" /> | 490 <property name="dex.force.jumbo" value="false" /> |
478 | 491 |
479 <dex executable="${dx}" | 492 <dex executable="${dx}" |
480 output="${intermediate.dex.file}" | 493 output="${intermediate.dex.file}" |
481 dexedlibs="${out.dexed.absolute.dir}" | 494 dexedlibs="${out.dexed.absolute.dir}" |
482 nolocals="false" | 495 nolocals="false" |
483 forceJumbo="${dex.force.jumbo}" | 496 forceJumbo="${dex.force.jumbo}" |
484 verbose="${verbose}"> | 497 verbose="${verbose}"> |
485 <path path="${out.dex.input.absolute.dir}"/> | 498 <path path="${out.dex.input.absolute.dir}"/> |
486 <path refid="out.dex.jar.input.ref" /> | 499 <path refid="out.dex.jar.input.ref" /> |
487 </dex> | 500 </dex> |
488 </sequential> | 501 </sequential> |
489 </target> | 502 </target> |
490 | 503 |
491 <!-- Updates the pre-processed PNG cache --> | 504 <!-- Puts the project's resources into the output package file |
492 <target name="-crunch"> | 505 This actually can create multiple resource package in case |
| 506 Some custom apk with specific configuration have been |
| 507 declared in default.properties. |
| 508 --> |
| 509 <target name="-package-resources" depends="-setup"> |
| 510 <!-- Updates the pre-processed PNG cache --> |
493 <exec executable="${aapt}" taskName="crunch"> | 511 <exec executable="${aapt}" taskName="crunch"> |
494 <arg value="crunch" /> | 512 <arg value="crunch" /> |
495 <arg value="-v" /> | 513 <arg value="-v" /> |
496 <arg value="-S" /> | 514 <arg value="-S" /> |
497 <arg path="${resource.absolute.dir}" /> | 515 <arg path="${resource.absolute.dir}" /> |
498 <arg value="-C" /> | 516 <arg value="-C" /> |
499 <arg path="${out.res.absolute.dir}" /> | 517 <arg path="${out.res.absolute.dir}" /> |
500 </exec> | 518 </exec> |
501 </target> | |
502 | |
503 <!-- Puts the project's resources into the output package file | |
504 This actually can create multiple resource package in case | |
505 Some custom apk with specific configuration have been | |
506 declared in default.properties. | |
507 --> | |
508 <target name="-package-resources" depends="-crunch"> | |
509 <aapt executable="${aapt}" | 519 <aapt executable="${aapt}" |
510 command="package" | 520 command="package" |
511 versioncode="${version.code}" | 521 versioncode="${version.code}" |
512 versionname="${version.name}" | 522 versionname="${version.name}" |
513 debug="${build.is.packaging.debug}" | 523 debug="${build.is.packaging.debug}" |
514 manifest="${out.manifest.abs.file}" | 524 manifest="${out.manifest.abs.file}" |
515 assets="${asset.absolute.dir}" | 525 assets="${asset.absolute.dir}" |
516 androidjar="${project.target.android.jar}" | 526 androidjar="${project.target.android.jar}" |
517 apkfolder="${out.absolute.dir}" | 527 apkfolder="${out.absolute.dir}" |
518 nocrunch="${build.packaging.nocrunch}" | 528 nocrunch="${build.packaging.nocrunch}" |
(...skipping 23 matching lines...) Expand all Loading... |
542 verbose="${verbose}" | 552 verbose="${verbose}" |
543 hascode="${manifest.hasCode}" | 553 hascode="${manifest.hasCode}" |
544 previousBuildType="/" | 554 previousBuildType="/" |
545 buildType="${build.is.packaging.debug}/${build.is.signing.debug}
"> | 555 buildType="${build.is.packaging.debug}/${build.is.signing.debug}
"> |
546 <dex path="${intermediate.dex.file}"/> | 556 <dex path="${intermediate.dex.file}"/> |
547 <sourcefolder path="${source.absolute.dir}"/> | 557 <sourcefolder path="${source.absolute.dir}"/> |
548 <nativefolder path="${native.libs.absolute.dir}" /> | 558 <nativefolder path="${native.libs.absolute.dir}" /> |
549 </apkbuilder> | 559 </apkbuilder> |
550 </target> | 560 </target> |
551 | 561 |
552 <target name="-post-package" /> | |
553 <target name="-post-build" /> | |
554 | |
555 <target name="-set-mode-check"> | |
556 </target> | |
557 | |
558 <!-- ******************************************************* --> | |
559 <!-- **************** Debug specific targets *************** --> | |
560 <!-- ******************************************************* --> | |
561 | |
562 <target name="-set-debug-files" depends="-set-mode-check"> | |
563 </target> | |
564 | |
565 | |
566 <target name="-set-debug-mode" depends="-setup"> | |
567 <!-- record the current build target --> | |
568 <property name="build.target" value="debug" /> | |
569 | |
570 <property name="build.is.instrumented" value="false" /> | |
571 | |
572 <!-- whether the build is a debug build. always set. --> | |
573 <property name="build.is.packaging.debug" value="true" /> | |
574 | |
575 <!-- signing mode: debug --> | |
576 <property name="build.is.signing.debug" value="true" /> | |
577 </target> | |
578 | |
579 <target name="-debug-obfuscation-check"> | |
580 <!-- proguard is never enabled in debug mode --> | |
581 <property name="proguard.enabled" value="false"/> | |
582 </target> | |
583 | |
584 <!-- Signs and zipaligns the apk. --> | 562 <!-- Signs and zipaligns the apk. --> |
585 <target name="-do-sign" | 563 <target name="-do-sign" depends="-package"> |
586 depends="-package, -post-package"> | |
587 <sequential> | 564 <sequential> |
588 <echo level="info">Signing final apk...</echo> | 565 <echo level="info">Signing final apk...</echo> |
589 <signapk | 566 <signapk |
590 input="${out.packaged.file}" | 567 input="${out.packaged.file}" |
591 output="${out.unaligned.file}" | 568 output="${out.unaligned.file}" |
592 keystore="${key.store}" | 569 keystore="${key.store}" |
593 storepass="${key.store.password}" | 570 storepass="${key.store.password}" |
594 alias="${key.alias}" | 571 alias="${key.alias}" |
595 keypass="${key.alias.password}"/> | 572 keypass="${key.alias.password}"/> |
596 | 573 |
597 <zipalign | 574 <zipalign |
598 executable="${zipalign}" | 575 executable="${zipalign}" |
599 input="${out.unaligned.file}" | 576 input="${out.unaligned.file}" |
600 output="${out.final.file}" | 577 output="${out.final.file}" |
601 verbose="${verbose}" /> | 578 verbose="${verbose}" /> |
602 <echo level="info">Release Package: ${out.final.file}</echo> | 579 <echo level="info">Release Package: ${out.final.file}</echo> |
603 </sequential> | 580 </sequential> |
604 </target> | 581 </target> |
605 | 582 |
606 <target name="-do-debug" | |
607 depends="-set-debug-mode, -debug-obfuscation-check, -do-sign"> | |
608 </target> | |
609 | |
610 <!-- Builds debug output package --> | 583 <!-- Builds debug output package --> |
611 <target name="debug" depends="-set-debug-files, -do-debug, -post-build" | 584 <target name="debug" |
612 description="Builds the application and signs it with a debug ke
y."> | 585 depends="-set-debug-mode, -do-sign" |
613 </target> | 586 description="Builds the application and signs it with a debug key."> |
614 | |
615 <!-- ******************************************************* --> | |
616 <!-- *************** Release specific targets ************** --> | |
617 <!-- ******************************************************* --> | |
618 | |
619 <target name="-release-obfuscation-check"> | |
620 <echo level="info">proguard.config is ${proguard.config}</echo> | |
621 <condition property="proguard.enabled" value="true" else="false"> | |
622 <and> | |
623 <isset property="build.is.mode.release" /> | |
624 <isset property="proguard.config" /> | |
625 </and> | |
626 </condition> | |
627 <if condition="${proguard.enabled}"> | |
628 <then> | |
629 <echo level="info">Proguard.config is enabled</echo> | |
630 <!-- Secondary dx input (jar files) is empty since all the | |
631 jar files will be in the obfuscated jar --> | |
632 <path id="out.dex.jar.input.ref" /> | |
633 </then> | |
634 </if> | |
635 </target> | |
636 | |
637 <target name="-set-release-mode" depends="-set-mode-check"> | |
638 <!-- record the current build target --> | |
639 <property name="build.target" value="release" /> | |
640 | |
641 <property name="build.is.instrumented" value="false" /> | |
642 | |
643 <!-- release mode is only valid if the manifest does not explicitly | |
644 set debuggable to true. default is false. --> | |
645 <xpath input="${manifest.abs.file}" expression="/manifest/application/@a
ndroid:debuggable" | |
646 output="build.is.packaging.debug" default="false"/> | |
647 | |
648 <!-- signing mode: release --> | |
649 <property name="build.is.signing.debug" value="false" /> | |
650 | |
651 <if condition="${build.is.packaging.debug}"> | |
652 <then> | |
653 <echo>*************************************************</echo> | |
654 <echo>**** Android Manifest has debuggable=true ****</echo> | |
655 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo> | |
656 <echo>*************************************************</echo> | |
657 </then> | |
658 <else> | |
659 <!-- property only set in release mode. | |
660 Useful for if/unless attributes in target node | |
661 when using Ant before 1.8 --> | |
662 <property name="build.is.mode.release" value="true"/> | |
663 </else> | |
664 </if> | |
665 </target> | |
666 | |
667 <target name="-release-sign" depends="-do-sign" > | |
668 </target> | 587 </target> |
669 | 588 |
670 <!-- This runs -package-release first and then runs | 589 <!-- This runs -package-release first and then runs |
671 only if release-sign is true (set in -release-check, | 590 only if release-sign is true (set in -release-check, |
672 called by -release-no-sign)--> | 591 called by -release-no-sign)--> |
673 <target name="release" | 592 <target name="release" |
674 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-sign, -post-build" | 593 depends="-set-release-mode, -do-sign" |
675 description="Builds the application in release mode."> | 594 description="Builds the application in release mode."> |
676 </target> | 595 </target> |
677 | 596 |
678 </project> | 597 </project> |
OLD | NEW |