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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 <condition else="false" property="need.javac.fork"> | 218 <condition else="false" property="need.javac.fork"> |
219 <and> | 219 <and> |
220 <matches pattern="1\.[56]" string="${java.specification.version}"/> | 220 <matches pattern="1\.[56]" string="${java.specification.version}"/> |
221 <not> | 221 <not> |
222 <os family="unix"/> | 222 <os family="unix"/> |
223 </not> | 223 </not> |
224 </and> | 224 </and> |
225 </condition> | 225 </condition> |
226 | 226 |
227 <!-- ******************************************************* --> | 227 <!-- ******************************************************* --> |
228 <!-- ************************ Macros *********************** --> | |
229 <!-- ******************************************************* --> | |
230 | |
231 <macrodef name="record-build-key"> | |
232 <attribute name="key" default="false" /> | |
233 <attribute name="value" default="false" /> | |
234 <sequential> | |
235 <propertyfile file="${out.build.prop.file}" comment="Last build type
"> | |
236 <entry key="@{key}" value="@{value}"/> | |
237 </propertyfile> | |
238 </sequential> | |
239 </macrodef> | |
240 | |
241 <macrodef name="record-build-info"> | |
242 <sequential> | |
243 <record-build-key key="build.last.target" value="${build.target}" /> | |
244 <record-build-key key="build.last.is.instrumented" value="${build.is
.instrumented}" /> | |
245 <record-build-key key="build.last.is.packaging.debug" value="${build
.is.packaging.debug}" /> | |
246 <record-build-key key="build.last.is.signing.debug" value="${build.i
s.signing.debug}" /> | |
247 </sequential> | |
248 </macrodef> | |
249 | |
250 <macrodef name="uninstall-helper"> | |
251 <attribute name="app.package" default="false" /> | |
252 <sequential> | |
253 <echo level="info">Uninstalling @{app.package} from the default emul
ator or device...</echo> | |
254 <exec executable="${adb}" failonerror="true"> | |
255 <arg line="${adb.device.arg}" /> | |
256 <arg value="uninstall" /> | |
257 <arg value="@{app.package}" /> | |
258 </exec> | |
259 </sequential> | |
260 </macrodef> | |
261 | |
262 <!-- ******************************************************* --> | |
263 <!-- ******************** Build Targets ******************** --> | 228 <!-- ******************** Build Targets ******************** --> |
264 <!-- ******************************************************* --> | 229 <!-- ******************************************************* --> |
265 | 230 |
266 <!-- Basic Ant + SDK check --> | 231 <!-- Basic Ant + SDK check --> |
267 <target name="-check-env"> | 232 <target name="-check-env"> |
268 <checkenv /> | 233 <checkenv /> |
269 </target> | 234 </target> |
270 | 235 |
271 <!-- generic setup --> | 236 <!-- generic setup --> |
272 <target name="-setup" depends="-check-env"> | 237 <target name="-setup" depends="-check-env"> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 </then> | 284 </then> |
320 </if> | 285 </if> |
321 | 286 |
322 </target> | 287 </target> |
323 | 288 |
324 <!-- Pre build setup --> | 289 <!-- Pre build setup --> |
325 <target name="-build-setup" depends="-setup"> | 290 <target name="-build-setup" depends="-setup"> |
326 | 291 |
327 <!-- read the previous build mode --> | 292 <!-- read the previous build mode --> |
328 <property file="${out.build.prop.file}" /> | 293 <property file="${out.build.prop.file}" /> |
329 <!-- if empty the props won't be set, meaning it's a new build. | |
330 To force a build, set the prop to empty values. --> | |
331 <property name="build.last.target" value="" /> | |
332 <property name="build.last.is.instrumented" value="" /> | |
333 <property name="build.last.is.packaging.debug" value="" /> | |
334 <property name="build.last.is.signing.debug" value="" /> | |
335 | |
336 <!-- If the "debug" build type changed, clear out the compiled code. | |
337 This is to make sure the new BuildConfig.DEBUG value is picked up | |
338 as javac can't deal with this type of change in its dependency comp
utation. --> | |
339 <if> | |
340 <condition> | |
341 <and> | |
342 <length string="${build.last.is.packaging.debug}" trim="true
" when="greater" length="0" /> | |
343 <not><equals | |
344 arg1="${build.is.packaging.debug}" | |
345 arg2="${build.last.is.packaging.debug}" /></not> | |
346 </and> | |
347 </condition> | |
348 <then> | |
349 <echo level="info">Switching between debug and non debug build:
Deleting previous compilation output...</echo> | |
350 <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" /
> | |
351 </then> | |
352 <else> | |
353 <!-- Else, we may still need to clean the code, for another reas
on. | |
354 special case for instrumented: if the previous build was | |
355 instrumented but not this one, clear out the compiled code
--> | |
356 <if> | |
357 <condition> | |
358 <and> | |
359 <istrue value="${build.last.is.instrumented}" /> | |
360 <isfalse value="${build.is.instrumented}" /> | |
361 </and> | |
362 </condition> | |
363 <then> | |
364 <echo level="info">Switching from instrumented to non-in
strumented build: Deleting previous compilation output...</echo> | |
365 <delete dir="${out.classes.absolute.dir}" verbose="${ver
bose}" /> | |
366 </then> | |
367 </if> | |
368 </else> | |
369 </if> | |
370 | 294 |
371 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec
ho> | 295 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec
ho> |
372 <!-- load project properties, resolve Android target, library dependenci
es | 296 <!-- load project properties, resolve Android target, library dependenci
es |
373 and set some properties with the results. | 297 and set some properties with the results. |
374 All property names are passed as parameters ending in -Out --> | 298 All property names are passed as parameters ending in -Out --> |
375 <gettarget | 299 <gettarget |
376 androidJarFileOut="project.target.android.jar" | 300 androidJarFileOut="project.target.android.jar" |
377 androidAidlFileOut="project.target.framework.aidl" | 301 androidAidlFileOut="project.target.framework.aidl" |
378 bootClassPathOut="project.target.class.path" | 302 bootClassPathOut="project.target.class.path" |
379 targetApiOut="project.target.apilevel" | 303 targetApiOut="project.target.apilevel" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 <res path="${out.res.absolute.dir}" /> | 349 <res path="${out.res.absolute.dir}" /> |
426 <res path="${resource.absolute.dir}" /> | 350 <res path="${resource.absolute.dir}" /> |
427 </aapt> | 351 </aapt> |
428 | 352 |
429 <echo level="info">----------</echo> | 353 <echo level="info">----------</echo> |
430 <echo level="info">Handling BuildConfig class...</echo> | 354 <echo level="info">Handling BuildConfig class...</echo> |
431 <buildconfig | 355 <buildconfig |
432 genFolder="${gen.absolute.dir}" | 356 genFolder="${gen.absolute.dir}" |
433 package="${project.app.package}" | 357 package="${project.app.package}" |
434 buildType="${build.is.packaging.debug}" | 358 buildType="${build.is.packaging.debug}" |
435 previousBuildType="${build.last.is.packaging.debug}"/> | 359 previousBuildType=""/> |
436 </target> | 360 </target> |
437 | 361 |
438 <!-- empty default pre-compile target. Create a similar target in | 362 <!-- empty default pre-compile target. Create a similar target in |
439 your build.xml and it'll be called instead of this one. --> | 363 your build.xml and it'll be called instead of this one. --> |
440 <target name="-pre-compile"> | 364 <target name="-pre-compile"> |
441 <!-- | 365 <!-- |
442 Remove all .class files from the output directory. This prevents inclusi
on of incorrect .class | 366 Remove all .class files from the output directory. This prevents inclusi
on of incorrect .class |
443 files in the final apk. For example, if a .java file was deleted, the ap
k should not contain | 367 files in the final apk. For example, if a .java file was deleted, the ap
k should not contain |
444 the .class files for that .java from previous builds. | 368 the .class files for that .java from previous builds. |
445 --> | 369 --> |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 manifest="${out.manifest.abs.file}" | 585 manifest="${out.manifest.abs.file}" |
662 assets="${asset.absolute.dir}" | 586 assets="${asset.absolute.dir}" |
663 androidjar="${project.target.android.jar}" | 587 androidjar="${project.target.android.jar}" |
664 apkfolder="${out.absolute.dir}" | 588 apkfolder="${out.absolute.dir}" |
665 nocrunch="${build.packaging.nocrunch}" | 589 nocrunch="${build.packaging.nocrunch}" |
666 resourcefilename="${resource.package.file.name}" | 590 resourcefilename="${resource.package.file.name}" |
667 resourcefilter="${aapt.resource.filter}" | 591 resourcefilter="${aapt.resource.filter}" |
668 libraryResFolderPathRefid="project.library.res.folder.path" | 592 libraryResFolderPathRefid="project.library.res.folder.path" |
669 libraryPackagesRefid="project.library.packages" | 593 libraryPackagesRefid="project.library.packages" |
670 libraryRFileRefid="project.library.bin.r.file.path" | 594 libraryRFileRefid="project.library.bin.r.file.path" |
671 previousBuildType="${build.last.target}" | 595 previousBuildType="" |
672 buildType="${build.target}" | 596 buildType="${build.target}" |
673 ignoreAssets="${aapt.ignore.assets}"> | 597 ignoreAssets="${aapt.ignore.assets}"> |
674 <res path="${out.res.absolute.dir}" /> | 598 <res path="${out.res.absolute.dir}" /> |
675 <res path="${resource.absolute.dir}" /> | 599 <res path="${resource.absolute.dir}" /> |
676 <!-- <nocompress /> forces no compression on any files in assets or
res/raw --> | 600 <!-- <nocompress /> forces no compression on any files in assets or
res/raw --> |
677 <!-- <nocompress extension="xml" /> forces no compression on specifi
c file extensions in assets and res/raw --> | 601 <!-- <nocompress extension="xml" /> forces no compression on specifi
c file extensions in assets and res/raw --> |
678 </aapt> | 602 </aapt> |
679 </target> | 603 </target> |
680 | 604 |
681 <!-- Packages the application. --> | 605 <!-- Packages the application. --> |
682 <target name="-package" depends="-dex, -package-resources"> | 606 <target name="-package" depends="-dex, -package-resources"> |
683 <sequential> | 607 <sequential> |
684 <apkbuilder | 608 <apkbuilder |
685 outfolder="${out.absolute.dir}" | 609 outfolder="${out.absolute.dir}" |
686 resourcefile="${resource.package.file.name}" | 610 resourcefile="${resource.package.file.name}" |
687 apkfilepath="${out.packaged.file}" | 611 apkfilepath="${out.packaged.file}" |
688 debugpackaging="${build.is.packaging.debug}" | 612 debugpackaging="${build.is.packaging.debug}" |
689 debugsigning="${build.is.signing.debug}" | 613 debugsigning="${build.is.signing.debug}" |
690 verbose="${verbose}" | 614 verbose="${verbose}" |
691 hascode="${manifest.hasCode}" | 615 hascode="${manifest.hasCode}" |
692 previousBuildType="${build.last.is.packaging.debug}/${build.
last.is.signing.debug}" | 616 previousBuildType="/" |
693 buildType="${build.is.packaging.debug}/${build.is.signing.de
bug}"> | 617 buildType="${build.is.packaging.debug}/${build.is.signing.de
bug}"> |
694 <dex path="${intermediate.dex.file}"/> | 618 <dex path="${intermediate.dex.file}"/> |
695 <sourcefolder path="${source.absolute.dir}"/> | 619 <sourcefolder path="${source.absolute.dir}"/> |
696 <nativefolder path="${native.libs.absolute.dir}" /> | 620 <nativefolder path="${native.libs.absolute.dir}" /> |
697 </apkbuilder> | 621 </apkbuilder> |
698 </sequential> | 622 </sequential> |
699 </target> | 623 </target> |
700 | 624 |
701 <target name="-post-package" /> | 625 <target name="-post-package" /> |
702 <target name="-post-build" /> | 626 <target name="-post-build" /> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 executable="${zipalign}" | 686 executable="${zipalign}" |
763 input="${out.unaligned.file}" | 687 input="${out.unaligned.file}" |
764 output="${out.final.file}" | 688 output="${out.final.file}" |
765 verbose="${verbose}" /> | 689 verbose="${verbose}" /> |
766 <echo level="info">Release Package: ${out.final.file}</echo> | 690 <echo level="info">Release Package: ${out.final.file}</echo> |
767 </sequential> | 691 </sequential> |
768 </target> | 692 </target> |
769 | 693 |
770 <target name="-do-debug" | 694 <target name="-do-debug" |
771 depends="-set-debug-mode, -debug-obfuscation-check, -do-sign"> | 695 depends="-set-debug-mode, -debug-obfuscation-check, -do-sign"> |
772 <record-build-info /> | |
773 </target> | 696 </target> |
774 | 697 |
775 <!-- Builds debug output package --> | 698 <!-- Builds debug output package --> |
776 <target name="debug" depends="-set-debug-files, -do-debug, -post-build" | 699 <target name="debug" depends="-set-debug-files, -do-debug, -post-build" |
777 description="Builds the application and signs it with a debug ke
y."> | 700 description="Builds the application and signs it with a debug ke
y."> |
778 </target> | 701 </target> |
779 | 702 |
780 <!-- ******************************************************* --> | 703 <!-- ******************************************************* --> |
781 <!-- *************** Release specific targets ************** --> | 704 <!-- *************** Release specific targets ************** --> |
782 <!-- ******************************************************* --> | 705 <!-- ******************************************************* --> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 <else> | 750 <else> |
828 <!-- property only set in release mode. | 751 <!-- property only set in release mode. |
829 Useful for if/unless attributes in target node | 752 Useful for if/unless attributes in target node |
830 when using Ant before 1.8 --> | 753 when using Ant before 1.8 --> |
831 <property name="build.is.mode.release" value="true"/> | 754 <property name="build.is.mode.release" value="true"/> |
832 </else> | 755 </else> |
833 </if> | 756 </if> |
834 </target> | 757 </target> |
835 | 758 |
836 <target name="-release-sign" depends="-do-sign" > | 759 <target name="-release-sign" depends="-do-sign" > |
837 <record-build-info /> | |
838 </target> | 760 </target> |
839 | 761 |
840 <!-- This runs -package-release first and then runs | 762 <!-- This runs -package-release first and then runs |
841 only if release-sign is true (set in -release-check, | 763 only if release-sign is true (set in -release-check, |
842 called by -release-no-sign)--> | 764 called by -release-no-sign)--> |
843 <target name="release" | 765 <target name="release" |
844 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-sign, -post-build" | 766 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-sign, -post-build" |
845 description="Builds the application in release mode."> | 767 description="Builds the application in release mode."> |
846 </target> | 768 </target> |
847 | 769 |
848 </project> | 770 </project> |
OLD | NEW |