Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: build/android/ant/apk-build.xml

Issue 12808004: Simplify ant targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delete_cruft6
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 -->
225 <xpath input="${manifest.abs.file}"
226 expression="/manifest/@package" output="project.app.package" />
227 </target>
228
229 <!-- Pre build setup -->
230 <target name="-build-setup" depends="-setup">
231
232 <!-- read the previous build mode --> 271 <!-- read the previous build mode -->
233 <property file="${out.build.prop.file}" /> 272 <property file="${out.build.prop.file}" />
234 273
235 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec ho> 274 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec ho>
236 <!-- load project properties, resolve Android target, library dependenci es 275 <!-- load project properties, resolve Android target, library dependenci es
237 and set some properties with the results. 276 and set some properties with the results.
238 All property names are passed as parameters ending in -Out --> 277 All property names are passed as parameters ending in -Out -->
239 <gettarget 278 <gettarget
240 androidJarFileOut="project.target.android.jar" 279 androidJarFileOut="project.target.android.jar"
241 androidAidlFileOut="project.target.framework.aidl" 280 androidAidlFileOut="project.target.framework.aidl"
242 bootClassPathOut="project.target.class.path" 281 bootClassPathOut="project.target.class.path"
243 targetApiOut="project.target.apilevel" 282 targetApiOut="project.target.apilevel"
244 minSdkVersionOut="project.minSdkVersion" /> 283 minSdkVersionOut="project.minSdkVersion" />
245 284
246 <property name="manifest.hasCode" value="true" /> 285 <property name="manifest.hasCode" value="true" />
247 286
248
249 <echo level="info">----------</echo> 287 <echo level="info">----------</echo>
250 <echo level="info">Creating output directories if needed...</echo> 288 <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}" /> 289 <mkdir dir="${out.absolute.dir}" />
254 <mkdir dir="${out.res.absolute.dir}" /> 290 <mkdir dir="${out.res.absolute.dir}" />
255 <mkdir dir="${gen.absolute.dir}" /> 291 <mkdir dir="${gen.absolute.dir}" />
256 <mkdir dir="${out.classes.absolute.dir}" /> 292 <mkdir dir="${out.classes.absolute.dir}" />
257 <mkdir dir="${out.dexed.absolute.dir}" /> 293 <mkdir dir="${out.dexed.absolute.dir}" />
258 </target> 294 </target>
259 295
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 --> 296 <!-- Code Generation: compile resources (aapt -> R.java), aidl -->
265 <target name="-code-gen"> 297 <target name="-code-gen">
266 <!-- always merge manifest --> 298 <!-- always merge manifest -->
267 <mergemanifest 299 <mergemanifest
268 appManifest="${manifest.abs.file}" 300 appManifest="${manifest.abs.file}"
269 outManifest="${out.manifest.abs.file}" 301 outManifest="${out.manifest.abs.file}"
270 enabled="${manifestmerger.enabled}"> 302 enabled="${manifestmerger.enabled}">
271 </mergemanifest> 303 </mergemanifest>
272 304
273 <echo level="info">----------</echo> 305 <echo level="info">----------</echo>
274 <echo level="info">Handling Resources...</echo> 306 <echo level="info">Handling Resources...</echo>
275 <aapt executable="${aapt}" 307 <aapt executable="${aapt}"
276 command="package" 308 command="package"
277 verbose="${verbose}" 309 verbose="${verbose}"
278 manifest="${out.manifest.abs.file}" 310 manifest="${out.manifest.abs.file}"
279 androidjar="${project.target.android.jar}" 311 androidjar="${project.target.android.jar}"
280 rfolder="${gen.absolute.dir}" 312 rfolder="${gen.absolute.dir}"
281 nonConstantId="${android.library}" 313 nonConstantId="${android.library}"
282 libraryResFolderPathRefid="project.library.res.folder.path" 314 libraryResFolderPathRefid="project.library.res.folder.path"
283 libraryPackagesRefid="project.library.packages" 315 libraryPackagesRefid="project.library.packages"
284 libraryRFileRefid="project.library.bin.r.file.path" 316 libraryRFileRefid="project.library.bin.r.file.path"
285 ignoreAssets="${aapt.ignore.assets}" 317 ignoreAssets="${aapt.ignore.assets}"
286 binFolder="${out.absolute.dir}" 318 binFolder="${out.absolute.dir}"
287 proguardFile="${out.absolute.dir}/proguard.txt"> 319 proguardFile="${out.absolute.dir}/proguard.txt">
288 <res path="${out.res.absolute.dir}" /> 320 <res path="${out.res.absolute.dir}" />
289 <res path="${resource.absolute.dir}" /> 321 <res path="${resource.absolute.dir}" />
Yaron 2013/03/13 18:58:30 This dir is no longer being created in -setup. See
cjhopman 2013/03/13 19:07:53 Yes, this always points to a directory that exists
290 </aapt> 322 </aapt>
291 323
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> 324 </target>
313 325
314 <!-- 326 <!--
315 Override the -compile target. 327 Override the -compile target.
316 This target requires 'javac.custom.classpath' to be set to reference 328 This target requires 'javac.custom.classpath' to be set to reference
317 of classpath to be used for javac. Also accepts custom path for 329 of classpath to be used for javac. Also accepts custom path for
318 sources: 'javac.custom.sourcepath'. 330 sources: 'javac.custom.sourcepath'.
319 --> 331 -->
320 <!-- Compiles this project's .java files into .class files. --> 332 <!-- Compiles this project's .java files into .class files. -->
321 <target 333 <target
Yaron 2013/03/13 18:58:30 Nit: definition can be one line
cjhopman 2013/03/13 19:07:53 Done.
322 name="-compile" 334 name="-compile"
323 depends="-build-setup, -pre-build, -code-gen, -pre-compile"> 335 depends="-setup, -code-gen">
336 <delete>
337 <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/>
338 </delete>
339
324 <javac 340 <javac
325 bootclasspathref="project.target.class.path" 341 bootclasspathref="project.target.class.path"
326 classpathref="javac.custom.classpath" 342 classpathref="javac.custom.classpath"
327 debug="true" 343 debug="true"
328 destdir="${out.classes.absolute.dir}" 344 destdir="${out.classes.absolute.dir}"
329 encoding="${java.encoding}" 345 encoding="${java.encoding}"
330 extdirs="" 346 extdirs=""
331 fork="${need.javac.fork}" 347 fork="${need.javac.fork}"
332 includeantruntime="false" 348 includeantruntime="false"
333 source="${java.source}" 349 source="${java.source}"
(...skipping 13 matching lines...) Expand all
347 project.is.testapp is set by Android's ant build system based on the 363 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. 364 target's manifest. It is true only for instrumentation apks.
349 --> 365 -->
350 <if condition="${project.is.testapp}"> 366 <if condition="${project.is.testapp}">
351 <then> 367 <then>
352 <property-location name="create.test.jar.file" 368 <property-location name="create.test.jar.file"
353 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/> 369 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/>
354 <script language="javascript" src="${create.test.jar.file}"/> 370 <script language="javascript" src="${create.test.jar.file}"/>
355 </then> 371 </then>
356 </if> 372 </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 <!-- 373 <!--
363 Copy gdbserver to main libs directory if building a non-instrumentation debug apk. 374 Copy gdbserver to main libs directory if building a non-instrumentation debug apk.
364 --> 375 -->
365 <if> 376 <if>
366 <condition> 377 <condition>
367 <and> 378 <and>
368 <equals arg1="${build.target}" arg2="debug"/> 379 <equals arg1="${build.target}" arg2="debug"/>
369 <isfalse value="${project.is.testapp}"/> 380 <isfalse value="${project.is.testapp}"/>
370 </and> 381 </and>
371 </condition> 382 </condition>
(...skipping 14 matching lines...) Expand all
386 397
387 <!-- Obfuscate target 398 <!-- Obfuscate target
388 This is only active in release builds when proguard.config is defined 399 This is only active in release builds when proguard.config is defined
389 in default.properties. 400 in default.properties.
390 401
391 --> 402 -->
392 <!-- 403 <!--
393 Override obfuscate target to pass javac.custom.classpath to Proguard. SDK tools do not provide 404 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. 405 any way to pass custom class paths to Proguard.
395 --> 406 -->
396 <target name="-obfuscate"> 407 <target name="-obfuscate" depends="-compile">
397 <if condition="${proguard.enabled}"> 408 <if condition="${proguard.enabled}">
398 <then> 409 <then>
399 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/ proguard"/> 410 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/ proguard"/>
400 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir }/original.jar"/> 411 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir }/original.jar"/>
401 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/ obfuscated.jar"/> 412 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/ obfuscated.jar"/>
402 <!-- input for dex will be proguard's output --> 413 <!-- input for dex will be proguard's output -->
403 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.fi le}"/> 414 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.fi le}"/>
404 415
405 <!-- Add Proguard Tasks --> 416 <!-- Add Proguard Tasks -->
406 <property name="proguard.jar" location="${android.tools.dir}/proguard/ lib/proguard.jar"/> 417 <property name="proguard.jar" location="${android.tools.dir}/proguard/ lib/proguard.jar"/>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 -dump "${obfuscate.absolute.dir}/dump.txt" 473 -dump "${obfuscate.absolute.dir}/dump.txt"
463 -printseeds "${obfuscate.absolute.dir}/seeds.txt" 474 -printseeds "${obfuscate.absolute.dir}/seeds.txt"
464 -printusage "${obfuscate.absolute.dir}/usage.txt" 475 -printusage "${obfuscate.absolute.dir}/usage.txt"
465 -printmapping "${obfuscate.absolute.dir}/mapping.txt" 476 -printmapping "${obfuscate.absolute.dir}/mapping.txt"
466 </proguard> 477 </proguard>
467 </then> 478 </then>
468 </if> 479 </if>
469 </target> 480 </target>
470 481
471 <!-- Converts this project's .class files into .dex files --> 482 <!-- Converts this project's .class files into .dex files -->
472 <target name="-dex" depends="-compile, -post-compile, -obfuscate"> 483 <target name="-dex" depends="-obfuscate">
473 <sequential> 484 <sequential>
474 <!-- sets the primary input for dex. If a pre-dex task sets it to 485 <!-- sets the primary input for dex. If a pre-dex task sets it to
475 something else this has no effect --> 486 something else this has no effect -->
476 <property name="out.dex.input.absolute.dir" value="${out.classes.abs olute.dir}" /> 487 <property name="out.dex.input.absolute.dir" value="${out.classes.abs olute.dir}" />
477 <property name="dex.force.jumbo" value="false" /> 488 <property name="dex.force.jumbo" value="false" />
478 489
479 <dex executable="${dx}" 490 <dex executable="${dx}"
480 output="${intermediate.dex.file}" 491 output="${intermediate.dex.file}"
481 dexedlibs="${out.dexed.absolute.dir}" 492 dexedlibs="${out.dexed.absolute.dir}"
482 nolocals="false" 493 nolocals="false"
483 forceJumbo="${dex.force.jumbo}" 494 forceJumbo="${dex.force.jumbo}"
484 verbose="${verbose}"> 495 verbose="${verbose}">
485 <path path="${out.dex.input.absolute.dir}"/> 496 <path path="${out.dex.input.absolute.dir}"/>
486 <path refid="out.dex.jar.input.ref" /> 497 <path refid="out.dex.jar.input.ref" />
487 </dex> 498 </dex>
488 </sequential> 499 </sequential>
489 </target> 500 </target>
490 501
491 <!-- Updates the pre-processed PNG cache --> 502 <!-- Puts the project's resources into the output package file
492 <target name="-crunch"> 503 This actually can create multiple resource package in case
504 Some custom apk with specific configuration have been
505 declared in default.properties.
506 -->
507 <target name="-package-resources">
508 <!-- Updates the pre-processed PNG cache -->
493 <exec executable="${aapt}" taskName="crunch"> 509 <exec executable="${aapt}" taskName="crunch">
494 <arg value="crunch" /> 510 <arg value="crunch" />
495 <arg value="-v" /> 511 <arg value="-v" />
496 <arg value="-S" /> 512 <arg value="-S" />
497 <arg path="${resource.absolute.dir}" /> 513 <arg path="${resource.absolute.dir}" />
498 <arg value="-C" /> 514 <arg value="-C" />
499 <arg path="${out.res.absolute.dir}" /> 515 <arg path="${out.res.absolute.dir}" />
500 </exec> 516 </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}" 517 <aapt executable="${aapt}"
510 command="package" 518 command="package"
511 versioncode="${version.code}" 519 versioncode="${version.code}"
512 versionname="${version.name}" 520 versionname="${version.name}"
513 debug="${build.is.packaging.debug}" 521 debug="${build.is.packaging.debug}"
514 manifest="${out.manifest.abs.file}" 522 manifest="${out.manifest.abs.file}"
515 assets="${asset.absolute.dir}" 523 assets="${asset.absolute.dir}"
516 androidjar="${project.target.android.jar}" 524 androidjar="${project.target.android.jar}"
517 apkfolder="${out.absolute.dir}" 525 apkfolder="${out.absolute.dir}"
518 nocrunch="${build.packaging.nocrunch}" 526 nocrunch="${build.packaging.nocrunch}"
(...skipping 23 matching lines...) Expand all
542 verbose="${verbose}" 550 verbose="${verbose}"
543 hascode="${manifest.hasCode}" 551 hascode="${manifest.hasCode}"
544 previousBuildType="/" 552 previousBuildType="/"
545 buildType="${build.is.packaging.debug}/${build.is.signing.debug} "> 553 buildType="${build.is.packaging.debug}/${build.is.signing.debug} ">
546 <dex path="${intermediate.dex.file}"/> 554 <dex path="${intermediate.dex.file}"/>
547 <sourcefolder path="${source.absolute.dir}"/> 555 <sourcefolder path="${source.absolute.dir}"/>
548 <nativefolder path="${native.libs.absolute.dir}" /> 556 <nativefolder path="${native.libs.absolute.dir}" />
549 </apkbuilder> 557 </apkbuilder>
550 </target> 558 </target>
551 559
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. --> 560 <!-- Signs and zipaligns the apk. -->
585 <target name="-do-sign" 561 <target name="-do-sign"
Yaron 2013/03/13 18:58:30 Nit: oneline
cjhopman 2013/03/13 19:07:54 Done.
586 depends="-package, -post-package"> 562 depends="-package">
587 <sequential> 563 <sequential>
588 <echo level="info">Signing final apk...</echo> 564 <echo level="info">Signing final apk...</echo>
589 <signapk 565 <signapk
590 input="${out.packaged.file}" 566 input="${out.packaged.file}"
591 output="${out.unaligned.file}" 567 output="${out.unaligned.file}"
592 keystore="${key.store}" 568 keystore="${key.store}"
593 storepass="${key.store.password}" 569 storepass="${key.store.password}"
594 alias="${key.alias}" 570 alias="${key.alias}"
595 keypass="${key.alias.password}"/> 571 keypass="${key.alias.password}"/>
596 572
597 <zipalign 573 <zipalign
598 executable="${zipalign}" 574 executable="${zipalign}"
599 input="${out.unaligned.file}" 575 input="${out.unaligned.file}"
600 output="${out.final.file}" 576 output="${out.final.file}"
601 verbose="${verbose}" /> 577 verbose="${verbose}" />
602 <echo level="info">Release Package: ${out.final.file}</echo> 578 <echo level="info">Release Package: ${out.final.file}</echo>
603 </sequential> 579 </sequential>
604 </target> 580 </target>
605 581
606 <target name="-do-debug"
607 depends="-set-debug-mode, -debug-obfuscation-check, -do-sign">
608 </target>
609
610 <!-- Builds debug output package --> 582 <!-- Builds debug output package -->
611 <target name="debug" depends="-set-debug-files, -do-debug, -post-build" 583 <target name="debug"
612 description="Builds the application and signs it with a debug ke y."> 584 depends="-set-debug-mode, -do-sign"
613 </target> 585 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> 586 </target>
669 587
670 <!-- This runs -package-release first and then runs 588 <!-- This runs -package-release first and then runs
671 only if release-sign is true (set in -release-check, 589 only if release-sign is true (set in -release-check,
672 called by -release-no-sign)--> 590 called by -release-no-sign)-->
673 <target name="release" 591 <target name="release"
674 depends="-set-release-mode, -release-obfuscation-check, -package , -post-package, -release-sign, -post-build" 592 depends="-set-release-mode, -do-sign"
675 description="Builds the application in release mode."> 593 description="Builds the application in release mode.">
676 </target> 594 </target>
677 595
678 </project> 596 </project>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698