| 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 |
| 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. |
| 14 See the License for the specific language governing permissions and | 14 See the License for the specific language governing permissions and |
| 15 limitations under the License. | 15 limitations under the License. |
| 16 --> | 16 --> |
| 17 | 17 |
| 18 <project name="android_rules" default="debug"> | 18 <project name="android_rules" default="debug"> |
| 19 | 19 |
| 20 <!-- | |
| 21 This build file is imported by the project build file. It contains | |
| 22 all the targets and tasks necessary to build Android projects, be they | |
| 23 regular projects, library projects, or test projects. | |
| 24 | |
| 25 At the beginning of the file is a list of properties that can be overrid
den | |
| 26 by adding them to your ant.properties (properties are immutable, so thei
r | |
| 27 first definition sticks and is never changed). | |
| 28 | |
| 29 Follows: | |
| 30 - custom task definitions, | |
| 31 - more properties (do not override those unless the whole build system i
s modified). | |
| 32 - macros used throughout the build, | |
| 33 - base build targets, | |
| 34 - debug-specific build targets, | |
| 35 - release-specific build targets, | |
| 36 - instrument-specific build targets, | |
| 37 - test project-specific build targets, | |
| 38 - install targets, | |
| 39 - help target | |
| 40 --> | |
| 41 | |
| 42 <property-location name="out.dir" location="${OUT_DIR}" check-exists="false"
/> | 20 <property-location name="out.dir" location="${OUT_DIR}" check-exists="false"
/> |
| 43 | 21 |
| 44 <path id="javac.srcdirs.additional"> | 22 <path id="javac.srcdirs.additional"> |
| 45 <filelist files="${ADDITIONAL_SRC_DIRS}"/> | 23 <filelist files="${ADDITIONAL_SRC_DIRS}"/> |
| 46 <filelist files="${GENERATED_SRC_DIRS}"/> | 24 <filelist files="${GENERATED_SRC_DIRS}"/> |
| 47 </path> | 25 </path> |
| 48 | 26 |
| 49 <!-- | 27 <!-- |
| 50 Include additional resource folders in the apk, e.g. content/.../res. We | 28 Include additional resource folders in the apk, e.g. content/.../res. We |
| 51 list the res folders in project.library.res.folder.path and the | 29 list the res folders in project.library.res.folder.path and the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 <!-- Set the output directory for the final apk to the ${apks.dir}. --> | 56 <!-- Set the output directory for the final apk to the ${apks.dir}. --> |
| 79 <property-location name="out.final.file" | 57 <property-location name="out.final.file" |
| 80 location="${apks.dir}/${ant.project.name}.apk" | 58 location="${apks.dir}/${ant.project.name}.apk" |
| 81 check-exists="false"/> | 59 check-exists="false"/> |
| 82 | 60 |
| 83 <!-- Classpath for javac --> | 61 <!-- Classpath for javac --> |
| 84 <path id="javac.custom.classpath"> | 62 <path id="javac.custom.classpath"> |
| 85 <filelist files="${INPUT_JARS_PATHS}"/> | 63 <filelist files="${INPUT_JARS_PATHS}"/> |
| 86 </path> | 64 </path> |
| 87 | 65 |
| 66 <!-- |
| 67 TODO(cjhopman): This is wrong for proguard builds. In that case, it should
be just the |
| 68 obfuscated jar. |
| 69 --> |
| 88 <path id="out.dex.jar.input.ref"> | 70 <path id="out.dex.jar.input.ref"> |
| 89 <path refid="javac.custom.classpath"/> | 71 <path refid="javac.custom.classpath"/> |
| 90 </path> | 72 </path> |
| 91 | 73 |
| 92 <path id="native.libs.gdbserver"> | 74 <path id="native.libs.gdbserver"> |
| 93 <fileset file="${android.gdbserver}"/> | 75 <fileset file="${android.gdbserver}"/> |
| 94 </path> | 76 </path> |
| 95 | 77 |
| 96 <!-- Disables automatic signing. --> | 78 <!-- Disables automatic signing. --> |
| 97 <property name="build.is.signing.debug" value="false"/> | 79 <property name="build.is.signing.debug" value="false"/> |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 <!-- Configurable macro, which allows to pass as parameters output directory
, | 289 <!-- Configurable macro, which allows to pass as parameters output directory
, |
| 308 output dex filename and external libraries to dex (optional) --> | 290 output dex filename and external libraries to dex (optional) --> |
| 309 <macrodef name="dex-helper"> | 291 <macrodef name="dex-helper"> |
| 310 <element name="external-libs" optional="yes" /> | 292 <element name="external-libs" optional="yes" /> |
| 311 <attribute name="nolocals" default="false" /> | 293 <attribute name="nolocals" default="false" /> |
| 312 <sequential> | 294 <sequential> |
| 313 <!-- sets the primary input for dex. If a pre-dex task sets it to | 295 <!-- sets the primary input for dex. If a pre-dex task sets it to |
| 314 something else this has no effect --> | 296 something else this has no effect --> |
| 315 <property name="out.dex.input.absolute.dir" value="${out.classes.abs
olute.dir}" /> | 297 <property name="out.dex.input.absolute.dir" value="${out.classes.abs
olute.dir}" /> |
| 316 | 298 |
| 317 <!-- set the secondary dx input: the project (and library) jar files | |
| 318 If a pre-dex task sets it to something else this has no effect
--> | |
| 319 <if> | |
| 320 <condition> | |
| 321 <isreference refid="out.dex.jar.input.ref" /> | |
| 322 </condition> | |
| 323 <else> | |
| 324 <path id="out.dex.jar.input.ref"> | |
| 325 <path refid="project.all.jars.path" /> | |
| 326 </path> | |
| 327 </else> | |
| 328 </if> | |
| 329 | |
| 330 <dex executable="${dx}" | 299 <dex executable="${dx}" |
| 331 output="${intermediate.dex.file}" | 300 output="${intermediate.dex.file}" |
| 332 dexedlibs="${out.dexed.absolute.dir}" | 301 dexedlibs="${out.dexed.absolute.dir}" |
| 333 nolocals="@{nolocals}" | 302 nolocals="@{nolocals}" |
| 334 forceJumbo="${dex.force.jumbo}" | 303 forceJumbo="${dex.force.jumbo}" |
| 335 verbose="${verbose}"> | 304 verbose="${verbose}"> |
| 336 <path path="${out.dex.input.absolute.dir}"/> | 305 <path path="${out.dex.input.absolute.dir}"/> |
| 337 <path refid="out.dex.jar.input.ref" /> | 306 <path refid="out.dex.jar.input.ref" /> |
| 338 <external-libs /> | 307 <external-libs /> |
| 339 </dex> | 308 </dex> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 357 resourcefile="${resource.package.file.name}" | 326 resourcefile="${resource.package.file.name}" |
| 358 apkfilepath="${out.packaged.file}" | 327 apkfilepath="${out.packaged.file}" |
| 359 debugpackaging="${build.is.packaging.debug}" | 328 debugpackaging="${build.is.packaging.debug}" |
| 360 debugsigning="${build.is.signing.debug}" | 329 debugsigning="${build.is.signing.debug}" |
| 361 verbose="${verbose}" | 330 verbose="${verbose}" |
| 362 hascode="${manifest.hasCode}" | 331 hascode="${manifest.hasCode}" |
| 363 previousBuildType="${build.last.is.packaging.debug}/${build.
last.is.signing.debug}" | 332 previousBuildType="${build.last.is.packaging.debug}/${build.
last.is.signing.debug}" |
| 364 buildType="${build.is.packaging.debug}/${build.is.signing.de
bug}"> | 333 buildType="${build.is.packaging.debug}/${build.is.signing.de
bug}"> |
| 365 <dex path="${intermediate.dex.file}"/> | 334 <dex path="${intermediate.dex.file}"/> |
| 366 <sourcefolder path="${source.absolute.dir}"/> | 335 <sourcefolder path="${source.absolute.dir}"/> |
| 367 <jarfile refid="project.all.jars.path" /> | |
| 368 <nativefolder path="${native.libs.absolute.dir}" /> | 336 <nativefolder path="${native.libs.absolute.dir}" /> |
| 369 <nativefolder refid="project.library.native.folder.path" /> | |
| 370 <extra-jars/> | 337 <extra-jars/> |
| 371 </apkbuilder> | 338 </apkbuilder> |
| 372 </sequential> | 339 </sequential> |
| 373 </macrodef> | 340 </macrodef> |
| 374 | 341 |
| 375 <!-- This is macro which zipaligns in.package and outputs it to out.package.
Used by targets | 342 <!-- This is macro which zipaligns in.package and outputs it to out.package.
Used by targets |
| 376 debug and release.--> | 343 debug and release.--> |
| 377 <macrodef name="zipalign-helper"> | 344 <macrodef name="zipalign-helper"> |
| 378 <attribute name="in.package" /> | 345 <attribute name="in.package" /> |
| 379 <attribute name="out.package" /> | 346 <attribute name="out.package" /> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 386 |
| 420 <!-- ******************************************************* --> | 387 <!-- ******************************************************* --> |
| 421 <!-- ******************** Build Targets ******************** --> | 388 <!-- ******************** Build Targets ******************** --> |
| 422 <!-- ******************************************************* --> | 389 <!-- ******************************************************* --> |
| 423 | 390 |
| 424 <!-- Basic Ant + SDK check --> | 391 <!-- Basic Ant + SDK check --> |
| 425 <target name="-check-env"> | 392 <target name="-check-env"> |
| 426 <checkenv /> | 393 <checkenv /> |
| 427 </target> | 394 </target> |
| 428 | 395 |
| 429 <!-- target to disable building dependencies --> | |
| 430 <target name="nodeps"> | |
| 431 <property name="dont.do.deps" value="true" /> | |
| 432 </target> | |
| 433 | |
| 434 <!-- generic setup --> | 396 <!-- generic setup --> |
| 435 <target name="-setup" depends="-check-env"> | 397 <target name="-setup" depends="-check-env"> |
| 436 <echo level="info">Project Name: ${ant.project.name}</echo> | 398 <echo level="info">Project Name: ${ant.project.name}</echo> |
| 437 <gettype projectTypeOut="project.type" /> | 399 <gettype projectTypeOut="project.type" /> |
| 438 | 400 |
| 439 <!-- sets a few boolean based on project.type | 401 <!-- sets a few boolean based on project.type |
| 440 to make the if task easier --> | 402 to make the if task easier --> |
| 441 <condition property="project.is.library" value="true" else="false"> | 403 <condition property="project.is.library" value="true" else="false"> |
| 442 <equals arg1="${project.type}" arg2="library" /> | 404 <equals arg1="${project.type}" arg2="library" /> |
| 443 </condition> | 405 </condition> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 <if condition="${project.is.test}"> | 437 <if condition="${project.is.test}"> |
| 476 <then> | 438 <then> |
| 477 <property name="tested.project.absolute.dir" location="${tested.
project.dir}" /> | 439 <property name="tested.project.absolute.dir" location="${tested.
project.dir}" /> |
| 478 <subant failonerror="true"> | 440 <subant failonerror="true"> |
| 479 <fileset dir="${tested.project.absolute.dir}" includes="buil
d.xml" /> | 441 <fileset dir="${tested.project.absolute.dir}" includes="buil
d.xml" /> |
| 480 <target name="clean" /> | 442 <target name="clean" /> |
| 481 </subant> | 443 </subant> |
| 482 </then> | 444 </then> |
| 483 </if> | 445 </if> |
| 484 | 446 |
| 485 <!-- get all the libraries --> | |
| 486 <if> | |
| 487 <condition><not><isset property="dont.do.deps" /></not></condition> | |
| 488 <then> | |
| 489 <getlibpath libraryFolderPathOut="project.library.folder.path" /
> | |
| 490 <if> | |
| 491 <condition> | |
| 492 <isreference refid="project.library.folder.path" /> | |
| 493 </condition> | |
| 494 <then> | |
| 495 <!-- clean the libraries with nodeps since we already | |
| 496 know about all the libraries even the indirect one
--> | |
| 497 <subant | |
| 498 buildpathref="project.library.folder.path" | |
| 499 antfile="build.xml" | |
| 500 failonerror="true"> | |
| 501 <target name="nodeps" /> | |
| 502 <target name="clean" /> | |
| 503 </subant> | |
| 504 </then> | |
| 505 </if> | |
| 506 </then> | |
| 507 </if> | |
| 508 </target> | 447 </target> |
| 509 | 448 |
| 510 <!-- Pre build setup --> | 449 <!-- Pre build setup --> |
| 511 <target name="-build-setup" depends="-setup"> | 450 <target name="-build-setup" depends="-setup"> |
| 512 | 451 |
| 513 <!-- read the previous build mode --> | 452 <!-- read the previous build mode --> |
| 514 <property file="${out.build.prop.file}" /> | 453 <property file="${out.build.prop.file}" /> |
| 515 <!-- if empty the props won't be set, meaning it's a new build. | 454 <!-- if empty the props won't be set, meaning it's a new build. |
| 516 To force a build, set the prop to empty values. --> | 455 To force a build, set the prop to empty values. --> |
| 517 <property name="build.last.target" value="" /> | 456 <property name="build.last.target" value="" /> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 <echo level="info">Creating output directories if needed...</echo> | 512 <echo level="info">Creating output directories if needed...</echo> |
| 574 <mkdir dir="${resource.absolute.dir}" /> | 513 <mkdir dir="${resource.absolute.dir}" /> |
| 575 <mkdir dir="${jar.libs.absolute.dir}" /> | 514 <mkdir dir="${jar.libs.absolute.dir}" /> |
| 576 <mkdir dir="${out.absolute.dir}" /> | 515 <mkdir dir="${out.absolute.dir}" /> |
| 577 <mkdir dir="${out.res.absolute.dir}" /> | 516 <mkdir dir="${out.res.absolute.dir}" /> |
| 578 <do-only-if-manifest-hasCode> | 517 <do-only-if-manifest-hasCode> |
| 579 <mkdir dir="${gen.absolute.dir}" /> | 518 <mkdir dir="${gen.absolute.dir}" /> |
| 580 <mkdir dir="${out.classes.absolute.dir}" /> | 519 <mkdir dir="${out.classes.absolute.dir}" /> |
| 581 <mkdir dir="${out.dexed.absolute.dir}" /> | 520 <mkdir dir="${out.dexed.absolute.dir}" /> |
| 582 </do-only-if-manifest-hasCode> | 521 </do-only-if-manifest-hasCode> |
| 583 | |
| 584 <echo level="info">----------</echo> | |
| 585 <echo level="info">Resolving Dependencies for ${ant.project.name}...</ec
ho> | |
| 586 <dependency | |
| 587 libraryFolderPathOut="project.library.folder.path" | |
| 588 libraryPackagesOut="project.library.packages" | |
| 589 libraryManifestFilePathOut="project.library.manifest.file.path" | |
| 590 libraryResFolderPathOut="project.library.res.folder.path" | |
| 591 libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.pat
h" | |
| 592 libraryRFilePathOut="project.library.bin.r.file.path" | |
| 593 libraryNativeFolderPathOut="project.library.native.folder.path" | |
| 594 jarLibraryPathOut="project.all.jars.path" | |
| 595 targetApi="${project.target.apilevel}" | |
| 596 verbose="${verbose}" /> | |
| 597 | |
| 598 <!-- no tested project, make an empty Path object so that javac doesn't | |
| 599 complain --> | |
| 600 <path id="tested.project.classpath" /> | |
| 601 </target> | 522 </target> |
| 602 | 523 |
| 603 <!-- empty default pre-build target. Create a similar target in | 524 <!-- empty default pre-build target. Create a similar target in |
| 604 your build.xml and it'll be called instead of this one. --> | 525 your build.xml and it'll be called instead of this one. --> |
| 605 <target name="-pre-build"/> | 526 <target name="-pre-build"/> |
| 606 | 527 |
| 607 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> | 528 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> |
| 608 <target name="-code-gen"> | 529 <target name="-code-gen"> |
| 609 <!-- always merge manifest --> | 530 <!-- always merge manifest --> |
| 610 <mergemanifest | 531 <mergemanifest |
| 611 appManifest="${manifest.abs.file}" | 532 appManifest="${manifest.abs.file}" |
| 612 outManifest="${out.manifest.abs.file}" | 533 outManifest="${out.manifest.abs.file}" |
| 613 enabled="${manifestmerger.enabled}"> | 534 enabled="${manifestmerger.enabled}"> |
| 614 <library refid="project.library.manifest.file.path" /> | |
| 615 </mergemanifest> | 535 </mergemanifest> |
| 616 | 536 |
| 617 <do-only-if-manifest-hasCode | 537 <do-only-if-manifest-hasCode |
| 618 elseText="hasCode = false. Skipping aidl/R.java"> | 538 elseText="hasCode = false. Skipping aidl/R.java"> |
| 619 <echo level="info">----------</echo> | 539 <echo level="info">----------</echo> |
| 620 <echo level="info">Handling Resources...</echo> | 540 <echo level="info">Handling Resources...</echo> |
| 621 <aapt executable="${aapt}" | 541 <aapt executable="${aapt}" |
| 622 command="package" | 542 command="package" |
| 623 verbose="${verbose}" | 543 verbose="${verbose}" |
| 624 manifest="${out.manifest.abs.file}" | 544 manifest="${out.manifest.abs.file}" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | 697 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> |
| 778 <identitymapper/> | 698 <identitymapper/> |
| 779 </firstmatchmapper> | 699 </firstmatchmapper> |
| 780 </pathconvert> | 700 </pathconvert> |
| 781 | 701 |
| 782 <!-- Build a path object with all the jar files that must be obfuscate
d. | 702 <!-- Build a path object with all the jar files that must be obfuscate
d. |
| 783 This include the project compiled source code and any 3rd party j
ar | 703 This include the project compiled source code and any 3rd party j
ar |
| 784 files. --> | 704 files. --> |
| 785 <path id="project.all.classes.path"> | 705 <path id="project.all.classes.path"> |
| 786 <pathelement location="${preobfuscate.jar.file}"/> | 706 <pathelement location="${preobfuscate.jar.file}"/> |
| 787 <path refid="project.all.jars.path"/> | |
| 788 <!-- Pass javac.custom.classpath for apks. --> | 707 <!-- Pass javac.custom.classpath for apks. --> |
| 789 <path refid="javac.custom.classpath"/> | 708 <path refid="javac.custom.classpath"/> |
| 790 </path> | 709 </path> |
| 791 <!-- Set the project jar files Path object into a single property. It'
ll be | 710 <!-- Set the project jar files Path object into a single property. It'
ll be |
| 792 all the jar files separated by a platform path-separator. | 711 all the jar files separated by a platform path-separator. |
| 793 Each path must be quoted if it contains spaces. | 712 Each path must be quoted if it contains spaces. |
| 794 --> | 713 --> |
| 795 <pathconvert property="project.all.classes.value" refid="project.all.c
lasses.path"> | 714 <pathconvert property="project.all.classes.value" refid="project.all.c
lasses.path"> |
| 796 <firstmatchmapper> | 715 <firstmatchmapper> |
| 797 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | 716 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 | 986 |
| 1068 <!-- This runs -package-release and -release-nosign first and then runs | 987 <!-- This runs -package-release and -release-nosign first and then runs |
| 1069 only if release-sign is true (set in -release-check, | 988 only if release-sign is true (set in -release-check, |
| 1070 called by -release-no-sign)--> | 989 called by -release-no-sign)--> |
| 1071 <target name="release" | 990 <target name="release" |
| 1072 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -
post-build" | 991 depends="-set-release-mode, -release-obfuscation-check, -package
, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -
post-build" |
| 1073 description="Builds the application in release mode."> | 992 description="Builds the application in release mode."> |
| 1074 </target> | 993 </target> |
| 1075 | 994 |
| 1076 </project> | 995 </project> |
| OLD | NEW |