| OLD | NEW |
| (Empty) |
| 1 <?xml version="1.0" encoding="UTF-8"?> | |
| 2 <!-- | |
| 3 Copyright (C) 2005-2008 The Android Open Source Project | |
| 4 | |
| 5 Licensed under the Apache License, Version 2.0 (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 | |
| 8 | |
| 9 http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | |
| 11 Unless required by applicable law or agreed to in writing, software | |
| 12 distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 See the License for the specific language governing permissions and | |
| 15 limitations under the License. | |
| 16 --> | |
| 17 | |
| 18 <project name="android_rules" default="debug"> | |
| 19 | |
| 20 <property-location name="out.dir" location="${OUT_DIR}" check-exists="false"
/> | |
| 21 | |
| 22 <path id="javac.srcdirs.additional"> | |
| 23 <filelist files="${ADDITIONAL_SRC_DIRS}"/> | |
| 24 <filelist files="${GENERATED_SRC_DIRS}"/> | |
| 25 </path> | |
| 26 | |
| 27 <!-- | |
| 28 Include additional resource folders in the apk, e.g. content/.../res. We | |
| 29 list the res folders in project.library.res.folder.path and the | |
| 30 corresponding java packages in project.library.packages, which must be | |
| 31 semicolon-delimited while ADDITIONAL_RES_PACKAGES is space-delimited, henc
e | |
| 32 the javascript task. | |
| 33 --> | |
| 34 <path id="project.library.res.folder.path"> | |
| 35 <filelist files="${ADDITIONAL_RES_DIRS}"/> | |
| 36 </path> | |
| 37 <path id="project.library.bin.r.file.path"> | |
| 38 <filelist files="${ADDITIONAL_R_TEXT_FILES}"/> | |
| 39 </path> | |
| 40 <path id="project.library.manifest.file.path"> | |
| 41 <filelist files="${LIBRARY_MANIFEST_PATHS}"/> | |
| 42 </path> | |
| 43 <script language="javascript"> | |
| 44 var before = project.getProperty("ADDITIONAL_RES_PACKAGES"); | |
| 45 project.setProperty("project.library.packages", before.replaceAll(" ", ";"
)); | |
| 46 </script> | |
| 47 | |
| 48 <property-value name="target.abi" value="${APP_ABI}"/> | |
| 49 | |
| 50 <!-- | |
| 51 We use the PROGUARD_ENABLED flag for enabling proguard. By default proguar
d is enabled for | |
| 52 Release builds if proguard.config is set. Setting proguard.config even to
an empty string will | |
| 53 enable proguard. Set this property only when we have explicitly enabled pr
oguard. | |
| 54 --> | |
| 55 <condition property="proguard.config" value="${PROGUARD_FLAGS}"> | |
| 56 <istrue value="${PROGUARD_ENABLED}"/> | |
| 57 </condition> | |
| 58 | |
| 59 <!-- Set the output directory for the final apk to the ${apks.dir}. --> | |
| 60 <property-location name="out.final.file" | |
| 61 location="${apks.dir}/${ant.project.name}.apk" | |
| 62 check-exists="false"/> | |
| 63 | |
| 64 <!-- Classpath for javac --> | |
| 65 <path id="javac.custom.classpath"> | |
| 66 <filelist files="${INPUT_JARS_PATHS}"/> | |
| 67 </path> | |
| 68 | |
| 69 <!-- | |
| 70 TODO(cjhopman): This is wrong for proguard builds. In that case, it should
be just the | |
| 71 obfuscated jar. | |
| 72 --> | |
| 73 <path id="out.dex.jar.input.ref"> | |
| 74 <path refid="javac.custom.classpath"/> | |
| 75 </path> | |
| 76 | |
| 77 <path id="native.libs.gdbserver"> | |
| 78 <fileset file="${android.gdbserver}"/> | |
| 79 </path> | |
| 80 | |
| 81 <!-- Disables automatic signing. --> | |
| 82 <property name="build.is.signing.debug" value="false"/> | |
| 83 | |
| 84 <!-- SDK tools assume that out.packaged.file is signed and name it "...-unal
igned" --> | |
| 85 <property name="out.packaged.file" | |
| 86 value="${apks.dir}/${ant.project.name}-unsigned.apk" /> | |
| 87 <property name="out.unaligned.file" | |
| 88 value="${apks.dir}/${ant.project.name}-unaligned.apk" /> | |
| 89 | |
| 90 <!-- fileset exclude patterns (space separated) to prevent | |
| 91 files inside src/ from being packaged. --> | |
| 92 <property name="android.package.excludes" value="" /> | |
| 93 | |
| 94 <!-- set some properties used for filtering/override. If those weren't defin
ed | |
| 95 before, then this will create them with empty values, which are then ig
nored | |
| 96 by the custom tasks receiving them. --> | |
| 97 <property-value name="version.code" value="${APP_MANIFEST_VERSION_CODE}"/> | |
| 98 <property-value name="version.name" value="${APP_MANIFEST_VERSION_NAME}"/> | |
| 99 | |
| 100 <property name="aapt.resource.filter" value="" /> | |
| 101 <!-- 'aapt.ignore.assets' is the list of file patterns to ignore under /res
and /assets. | |
| 102 Default is "!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*
~" | |
| 103 | |
| 104 Overall patterns syntax is: | |
| 105 [!][<dir>|<file>][*suffix-match|prefix-match*|full-match]:more:patter
ns... | |
| 106 | |
| 107 - The first character flag ! avoids printing a warning. | |
| 108 - Pattern can have the flag "<dir>" to match only directories | |
| 109 or "<file>" to match only files. Default is to match both. | |
| 110 - Match is not case-sensitive. | |
| 111 --> | |
| 112 <property name="aapt.ignore.assets" value="" /> | |
| 113 | |
| 114 <!-- compilation options --> | |
| 115 <property name="java.encoding" value="UTF-8" /> | |
| 116 <property name="java.target" value="1.5" /> | |
| 117 <property name="java.source" value="1.5" /> | |
| 118 <property name="java.compilerargs" value="" /> | |
| 119 | |
| 120 <!-- manifest merger default value if it's not set.--> | |
| 121 <condition property="manifestmerger.enabled" | |
| 122 value="false" | |
| 123 else="true"> | |
| 124 <equals arg1="${LIBRARY_MANIFEST_PATHS}" arg2=""/> | |
| 125 </condition> | |
| 126 | |
| 127 <!-- Verbosity --> | |
| 128 <property name="verbose" value="false" /> | |
| 129 | |
| 130 <!-- ******************************************************* --> | |
| 131 <!-- ********************* Custom Tasks ******************** --> | |
| 132 <!-- ******************************************************* --> | |
| 133 | |
| 134 <!-- jar file from where the tasks are loaded --> | |
| 135 <path id="android.antlibs"> | |
| 136 <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" /> | |
| 137 </path> | |
| 138 | |
| 139 <!-- Custom tasks --> | |
| 140 <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> | |
| 141 | |
| 142 <!-- ******************************************************* --> | |
| 143 <!-- ******************* Other Properties ****************** --> | |
| 144 <!-- ******************************************************* --> | |
| 145 <!-- overriding these properties may break the build | |
| 146 unless the whole file is updated --> | |
| 147 | |
| 148 <target name="-set-release-mode"> | |
| 149 <!-- record the current build target --> | |
| 150 <property name="build.target" value="release" /> | |
| 151 | |
| 152 <!-- release mode is only valid if the manifest does not explicitly | |
| 153 set debuggable to true. default is false. --> | |
| 154 <xpath input="${manifest.abs.file}" expression="/manifest/application/@a
ndroid:debuggable" | |
| 155 output="build.is.packaging.debug" default="false"/> | |
| 156 | |
| 157 <if condition="${build.is.packaging.debug}"> | |
| 158 <then> | |
| 159 <echo>*************************************************</echo> | |
| 160 <echo>**** Android Manifest has debuggable=true ****</echo> | |
| 161 <echo>**** Doing DEBUG packaging with RELEASE keys ****</echo> | |
| 162 <echo>*************************************************</echo> | |
| 163 </then> | |
| 164 <else> | |
| 165 <!-- property only set in release mode. | |
| 166 Useful for if/unless attributes in target node | |
| 167 when using Ant before 1.8 --> | |
| 168 <property name="build.is.mode.release" value="true"/> | |
| 169 </else> | |
| 170 </if> | |
| 171 | |
| 172 <echo level="info">proguard.config is ${proguard.config}</echo> | |
| 173 <condition property="proguard.enabled" value="true" else="false"> | |
| 174 <and> | |
| 175 <isset property="build.is.mode.release" /> | |
| 176 <isset property="proguard.config" /> | |
| 177 </and> | |
| 178 </condition> | |
| 179 <if condition="${proguard.enabled}"> | |
| 180 <then> | |
| 181 <echo level="info">Proguard.config is enabled</echo> | |
| 182 <!-- Secondary dx input (jar files) is empty since all the | |
| 183 jar files will be in the obfuscated jar --> | |
| 184 <path id="out.dex.jar.input.ref" /> | |
| 185 </then> | |
| 186 </if> | |
| 187 </target> | |
| 188 | |
| 189 <target name="-set-debug-mode"> | |
| 190 <!-- record the current build target --> | |
| 191 <property name="build.target" value="debug" /> | |
| 192 | |
| 193 <!-- whether the build is a debug build. always set. --> | |
| 194 <property name="build.is.packaging.debug" value="true" /> | |
| 195 | |
| 196 <!-- proguard is never enabled in debug mode --> | |
| 197 <property name="proguard.enabled" value="false"/> | |
| 198 </target> | |
| 199 | |
| 200 | |
| 201 <!-- Input directories --> | |
| 202 <property name="source.dir" value="src" /> | |
| 203 <property name="source.absolute.dir" location="${source.dir}" /> | |
| 204 <property-value name="gen.absolute.dir" value="${out.dir}/gen"/> | |
| 205 <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/> | |
| 206 <property name="asset.dir" value="assets" /> | |
| 207 <condition property="asset.absolute.dir" | |
| 208 value="${out.dir}/assets" | |
| 209 else="${ASSET_DIR}"> | |
| 210 <equals arg1="${ASSET_DIR}" arg2=""/> | |
| 211 </condition> | |
| 212 | |
| 213 <property-location name="native.libs.absolute.dir" location="${out.dir}/libs
" | |
| 214 check-exists="false"/> | |
| 215 | |
| 216 <property name="manifest.file" value="AndroidManifest.xml" /> | |
| 217 <property name="manifest.abs.file" location="${manifest.file}" /> | |
| 218 | |
| 219 <!-- Output directories --> | |
| 220 <property name="out.dir" value="bin" /> | |
| 221 <property name="out.absolute.dir" location="${out.dir}" /> | |
| 222 <property name="out.classes.absolute.dir" location="${out.dir}/classes" /> | |
| 223 <property name="out.res.absolute.dir" location="${out.dir}/res" /> | |
| 224 <property name="out.aidl.absolute.dir" location="${out.dir}/aidl" /> | |
| 225 <property name="out.dexed.absolute.dir" location="${out.dir}/dexedLibs" /> | |
| 226 <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.
xml" /> | |
| 227 | |
| 228 <!-- tools location --> | |
| 229 <property name="android.tools.dir" location="${sdk.dir}/tools" /> | |
| 230 <property name="android.platform.tools.dir" location="${sdk.dir}/platform-to
ols" /> | |
| 231 <property name="exe" value="" /> | |
| 232 <property name="bat" value="" /> | |
| 233 <property name="zipalign" location="${android.tools.dir}/zipalign${exe}" /> | |
| 234 <property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" /> | |
| 235 <property name="aapt" location="${android.platform.tools.dir}/aapt${exe}" /> | |
| 236 <property name="dx" location="${android.platform.tools.dir}/dx${bat}" /> | |
| 237 | |
| 238 <!-- Intermediate files --> | |
| 239 <property name="dex.file.name" value="classes.dex" /> | |
| 240 <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.f
ile.name}" /> | |
| 241 <property name="resource.package.file.name" value="${ant.project.name}.ap_"
/> | |
| 242 | |
| 243 <!-- Build property file --> | |
| 244 <property name="out.build.prop.file" location="${out.absolute.dir}/build.pro
p" /> | |
| 245 | |
| 246 <!-- | |
| 247 For debug builds, the Android SDK tools create a key in ~/.android and sig
n the build with it. | |
| 248 This has caused all kinds of issues. Instead, the debug build should be si
gned with a key in | |
| 249 build/android/ant. The SDK tools do not provide any support for overriding
that behavior and so | |
| 250 instead one must use the hack below. | |
| 251 --> | |
| 252 <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium
-debug.keystore"/> | |
| 253 <property name="key.store.password" value="chromium"/> | |
| 254 <property name="key.alias" value="chromiumdebugkey"/> | |
| 255 <property name="key.alias.password" value="chromium"/> | |
| 256 | |
| 257 <!-- properties for packaging --> | |
| 258 <property name="build.packaging.nocrunch" value="true" /> | |
| 259 | |
| 260 <property name="need.javac.fork" value="false" /> | |
| 261 | |
| 262 <!-- ******************************************************* --> | |
| 263 <!-- ******************** Build Targets ******************** --> | |
| 264 <!-- ******************************************************* --> | |
| 265 | |
| 266 <!-- generic setup --> | |
| 267 <target name="-setup"> | |
| 268 <checkenv /> | |
| 269 <echo level="info">Project Name: ${ant.project.name}</echo> | |
| 270 <gettype projectTypeOut="project.type" /> | |
| 271 | |
| 272 <!-- sets a few boolean based on project.type | |
| 273 to make the if task easier --> | |
| 274 <condition property="project.is.testapp" value="true" else="false"> | |
| 275 <equals arg1="${project.type}" arg2="test-app" /> | |
| 276 </condition> | |
| 277 | |
| 278 <!-- get the project manifest package --> | |
| 279 <xpath input="${manifest.abs.file}" | |
| 280 expression="/manifest/@package" output="project.app.package" /> | |
| 281 | |
| 282 <!-- read the previous build mode --> | |
| 283 <property file="${out.build.prop.file}" /> | |
| 284 | |
| 285 <echo level="info">Resolving Build Target for ${ant.project.name}...</ec
ho> | |
| 286 <!-- load project properties, resolve Android target, library dependenci
es | |
| 287 and set some properties with the results. | |
| 288 All property names are passed as parameters ending in -Out --> | |
| 289 <gettarget | |
| 290 androidJarFileOut="project.target.android.jar" | |
| 291 androidAidlFileOut="project.target.framework.aidl" | |
| 292 bootClassPathOut="project.target.class.path" | |
| 293 targetApiOut="project.target.apilevel" | |
| 294 minSdkVersionOut="project.minSdkVersion" /> | |
| 295 | |
| 296 <property name="manifest.hasCode" value="true" /> | |
| 297 | |
| 298 <echo level="info">----------</echo> | |
| 299 <echo level="info">Creating output directories if needed...</echo> | |
| 300 <mkdir dir="${out.absolute.dir}" /> | |
| 301 <mkdir dir="${out.res.absolute.dir}" /> | |
| 302 <mkdir dir="${gen.absolute.dir}" /> | |
| 303 <mkdir dir="${out.classes.absolute.dir}" /> | |
| 304 <mkdir dir="${out.dexed.absolute.dir}" /> | |
| 305 </target> | |
| 306 | |
| 307 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> | |
| 308 <target name="-code-gen" depends="-setup"> | |
| 309 <!-- always merge manifest --> | |
| 310 <mergemanifest | |
| 311 appManifest="${manifest.abs.file}" | |
| 312 outManifest="${out.manifest.abs.file}" | |
| 313 enabled="${manifestmerger.enabled}"> | |
| 314 <library refid="project.library.manifest.file.path" /> | |
| 315 </mergemanifest> | |
| 316 | |
| 317 <echo level="info">----------</echo> | |
| 318 <echo level="info">Handling Resources...</echo> | |
| 319 <aapt executable="${aapt}" | |
| 320 command="package" | |
| 321 verbose="${verbose}" | |
| 322 manifest="${out.manifest.abs.file}" | |
| 323 androidjar="${project.target.android.jar}" | |
| 324 rfolder="${gen.absolute.dir}" | |
| 325 nonConstantId="${android.library}" | |
| 326 libraryResFolderPathRefid="project.library.res.folder.path" | |
| 327 libraryPackagesRefid="project.library.packages" | |
| 328 libraryRFileRefid="project.library.bin.r.file.path" | |
| 329 ignoreAssets="${aapt.ignore.assets}" | |
| 330 binFolder="${out.absolute.dir}" | |
| 331 proguardFile="${out.absolute.dir}/proguard.txt"> | |
| 332 <res path="${out.res.absolute.dir}" /> | |
| 333 <res path="${resource.absolute.dir}" /> | |
| 334 </aapt> | |
| 335 | |
| 336 </target> | |
| 337 | |
| 338 <!-- | |
| 339 Override the -compile target. | |
| 340 This target requires 'javac.custom.classpath' to be set to reference | |
| 341 of classpath to be used for javac. Also accepts custom path for | |
| 342 sources: 'javac.custom.sourcepath'. | |
| 343 --> | |
| 344 <!-- Compiles this project's .java files into .class files. --> | |
| 345 <target name="-compile" depends="-code-gen"> | |
| 346 <delete> | |
| 347 <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/> | |
| 348 </delete> | |
| 349 | |
| 350 <javac | |
| 351 bootclasspathref="project.target.class.path" | |
| 352 classpathref="javac.custom.classpath" | |
| 353 debug="true" | |
| 354 destdir="${out.classes.absolute.dir}" | |
| 355 encoding="${java.encoding}" | |
| 356 extdirs="" | |
| 357 fork="${need.javac.fork}" | |
| 358 includeantruntime="false" | |
| 359 source="${java.source}" | |
| 360 target="${java.target}" | |
| 361 verbose="${verbose}"> | |
| 362 <src path="${source.absolute.dir}"/> | |
| 363 <src path="${gen.absolute.dir}"/> | |
| 364 <src> | |
| 365 <path refid="javac.srcdirs.additional"/> | |
| 366 </src> | |
| 367 <compilerarg value="-Xlint:unchecked"/> | |
| 368 <compilerarg line="${java.compilerargs}"/> | |
| 369 </javac> | |
| 370 <!-- | |
| 371 If the project needs a test jar then generate a jar containing | |
| 372 all compiled classes and referenced jars. | |
| 373 project.is.testapp is set by Android's ant build system based on the | |
| 374 target's manifest. It is true only for instrumentation apks. | |
| 375 --> | |
| 376 <if condition="${project.is.testapp}"> | |
| 377 <then> | |
| 378 <property-location name="create.test.jar.file" | |
| 379 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/> | |
| 380 <script language="javascript" src="${create.test.jar.file}"/> | |
| 381 </then> | |
| 382 </if> | |
| 383 <!-- | |
| 384 Copy gdbserver to main libs directory if building a non-instrumentation
debug apk. | |
| 385 --> | |
| 386 <if> | |
| 387 <condition> | |
| 388 <and> | |
| 389 <equals arg1="${build.target}" arg2="debug"/> | |
| 390 <isfalse value="${project.is.testapp}"/> | |
| 391 </and> | |
| 392 </condition> | |
| 393 <then> | |
| 394 <copy todir="${out.dir}/libs/${target.abi}"> | |
| 395 <path refid="native.libs.gdbserver"/> | |
| 396 </copy> | |
| 397 </then> | |
| 398 </if> | |
| 399 | |
| 400 <!-- Package all the compiled .class files into a .jar. --> | |
| 401 <jar | |
| 402 jarfile="${lib.java.dir}/${JAR_NAME}" | |
| 403 basedir="${out.classes.absolute.dir}" | |
| 404 /> | |
| 405 </target> | |
| 406 | |
| 407 | |
| 408 <!-- Obfuscate target | |
| 409 This is only active in release builds when proguard.config is defined | |
| 410 in default.properties. | |
| 411 | |
| 412 --> | |
| 413 <!-- | |
| 414 Override obfuscate target to pass javac.custom.classpath to Proguard. SDK
tools do not provide | |
| 415 any way to pass custom class paths to Proguard. | |
| 416 --> | |
| 417 <target name="-obfuscate" depends="-compile"> | |
| 418 <if condition="${proguard.enabled}"> | |
| 419 <then> | |
| 420 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/
proguard"/> | |
| 421 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir
}/original.jar"/> | |
| 422 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/
obfuscated.jar"/> | |
| 423 <!-- input for dex will be proguard's output --> | |
| 424 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.fi
le}"/> | |
| 425 | |
| 426 <!-- Add Proguard Tasks --> | |
| 427 <property name="proguard.jar" location="${android.tools.dir}/proguard/
lib/proguard.jar"/> | |
| 428 <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpa
th="${proguard.jar}"/> | |
| 429 | |
| 430 <!-- Set the android classpath Path object into a single property. It'
ll be | |
| 431 all the jar files separated by a platform path-separator. | |
| 432 Each path must be quoted if it contains spaces. | |
| 433 --> | |
| 434 <pathconvert property="project.target.classpath.value" refid="project.
target.class.path"> | |
| 435 <firstmatchmapper> | |
| 436 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | |
| 437 <identitymapper/> | |
| 438 </firstmatchmapper> | |
| 439 </pathconvert> | |
| 440 | |
| 441 <!-- Build a path object with all the jar files that must be obfuscate
d. | |
| 442 This include the project compiled source code and any 3rd party j
ar | |
| 443 files. --> | |
| 444 <path id="project.all.classes.path"> | |
| 445 <pathelement location="${preobfuscate.jar.file}"/> | |
| 446 <!-- Pass javac.custom.classpath for apks. --> | |
| 447 <path refid="javac.custom.classpath"/> | |
| 448 </path> | |
| 449 <!-- Set the project jar files Path object into a single property. It'
ll be | |
| 450 all the jar files separated by a platform path-separator. | |
| 451 Each path must be quoted if it contains spaces. | |
| 452 --> | |
| 453 <pathconvert property="project.all.classes.value" refid="project.all.c
lasses.path"> | |
| 454 <firstmatchmapper> | |
| 455 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | |
| 456 <identitymapper/> | |
| 457 </firstmatchmapper> | |
| 458 </pathconvert> | |
| 459 | |
| 460 <!-- Turn the path property ${proguard.config} from an A:B:C property | |
| 461 into a series of includes: -include A -include B -include C | |
| 462 suitable for processing by the ProGuard task. Note - this does | |
| 463 not include the leading '-include "' or the closing '"'; those | |
| 464 are added under the <proguard> call below. | |
| 465 --> | |
| 466 <path id="proguard.configpath"> | |
| 467 <pathelement path="${proguard.config}"/> | |
| 468 </path> | |
| 469 <pathconvert pathsep='" -include "' property="proguard.configcmd" | |
| 470 refid="proguard.configpath"/> | |
| 471 | |
| 472 <mkdir dir="${obfuscate.absolute.dir}"/> | |
| 473 <delete file="${preobfuscate.jar.file}"/> | |
| 474 <delete file="${obfuscated.jar.file}"/> | |
| 475 <jar basedir="${out.classes.absolute.dir}" | |
| 476 destfile="${preobfuscate.jar.file}"/> | |
| 477 <proguard> | |
| 478 -include "${proguard.configcmd}" | |
| 479 -include "${out.absolute.dir}/proguard.txt" | |
| 480 -injars ${project.all.classes.value} | |
| 481 -outjars "${obfuscated.jar.file}" | |
| 482 -libraryjars ${project.target.classpath.value} | |
| 483 -dump "${obfuscate.absolute.dir}/dump.txt" | |
| 484 -printseeds "${obfuscate.absolute.dir}/seeds.txt" | |
| 485 -printusage "${obfuscate.absolute.dir}/usage.txt" | |
| 486 -printmapping "${obfuscate.absolute.dir}/mapping.txt" | |
| 487 </proguard> | |
| 488 </then> | |
| 489 </if> | |
| 490 </target> | |
| 491 | |
| 492 <!-- Converts this project's .class files into .dex files --> | |
| 493 <target name="-dex" depends="-obfuscate"> | |
| 494 <sequential> | |
| 495 <!-- sets the primary input for dex. If a pre-dex task sets it to | |
| 496 something else this has no effect --> | |
| 497 <property name="out.dex.input.absolute.dir" value="${out.classes.abs
olute.dir}" /> | |
| 498 <property name="dex.force.jumbo" value="false" /> | |
| 499 | |
| 500 <dex executable="${dx}" | |
| 501 output="${intermediate.dex.file}" | |
| 502 dexedlibs="${out.dexed.absolute.dir}" | |
| 503 nolocals="false" | |
| 504 forceJumbo="${dex.force.jumbo}" | |
| 505 verbose="${verbose}"> | |
| 506 <path path="${out.dex.input.absolute.dir}"/> | |
| 507 <path refid="out.dex.jar.input.ref" /> | |
| 508 </dex> | |
| 509 </sequential> | |
| 510 </target> | |
| 511 | |
| 512 <!-- Puts the project's resources into the output package file | |
| 513 This actually can create multiple resource package in case | |
| 514 Some custom apk with specific configuration have been | |
| 515 declared in default.properties. | |
| 516 --> | |
| 517 <target name="-package-resources" depends="-setup"> | |
| 518 <!-- Updates the pre-processed PNG cache --> | |
| 519 <exec executable="${aapt}" taskName="crunch"> | |
| 520 <arg value="crunch" /> | |
| 521 <arg value="-v" /> | |
| 522 <arg value="-S" /> | |
| 523 <arg path="${resource.absolute.dir}" /> | |
| 524 <arg value="-C" /> | |
| 525 <arg path="${out.res.absolute.dir}" /> | |
| 526 </exec> | |
| 527 <aapt executable="${aapt}" | |
| 528 command="package" | |
| 529 versioncode="${version.code}" | |
| 530 versionname="${version.name}" | |
| 531 debug="${build.is.packaging.debug}" | |
| 532 manifest="${out.manifest.abs.file}" | |
| 533 assets="${asset.absolute.dir}" | |
| 534 androidjar="${project.target.android.jar}" | |
| 535 apkfolder="${out.absolute.dir}" | |
| 536 nocrunch="${build.packaging.nocrunch}" | |
| 537 resourcefilename="${resource.package.file.name}" | |
| 538 resourcefilter="${aapt.resource.filter}" | |
| 539 libraryResFolderPathRefid="project.library.res.folder.path" | |
| 540 libraryPackagesRefid="project.library.packages" | |
| 541 libraryRFileRefid="project.library.bin.r.file.path" | |
| 542 previousBuildType="" | |
| 543 buildType="${build.target}" | |
| 544 ignoreAssets="${aapt.ignore.assets}"> | |
| 545 <res path="${out.res.absolute.dir}" /> | |
| 546 <res path="${resource.absolute.dir}" /> | |
| 547 <!-- <nocompress /> forces no compression on any files in assets or
res/raw --> | |
| 548 <!-- <nocompress extension="xml" /> forces no compression on specifi
c file extensions in assets and res/raw --> | |
| 549 </aapt> | |
| 550 </target> | |
| 551 | |
| 552 <!-- Packages the application. --> | |
| 553 <target name="-package" depends="-dex, -package-resources"> | |
| 554 <apkbuilder | |
| 555 outfolder="${out.absolute.dir}" | |
| 556 resourcefile="${resource.package.file.name}" | |
| 557 apkfilepath="${out.packaged.file}" | |
| 558 debugpackaging="${build.is.packaging.debug}" | |
| 559 debugsigning="${build.is.signing.debug}" | |
| 560 verbose="${verbose}" | |
| 561 hascode="${manifest.hasCode}" | |
| 562 previousBuildType="/" | |
| 563 buildType="${build.is.packaging.debug}/${build.is.signing.debug}
"> | |
| 564 <dex path="${intermediate.dex.file}"/> | |
| 565 <sourcefolder path="${source.absolute.dir}"/> | |
| 566 <nativefolder path="${native.libs.absolute.dir}" /> | |
| 567 </apkbuilder> | |
| 568 </target> | |
| 569 | |
| 570 <!-- Signs and zipaligns the apk. --> | |
| 571 <target name="-do-sign" depends="-package"> | |
| 572 <sequential> | |
| 573 <echo level="info">Signing final apk...</echo> | |
| 574 <signapk | |
| 575 input="${out.packaged.file}" | |
| 576 output="${out.unaligned.file}" | |
| 577 keystore="${key.store}" | |
| 578 storepass="${key.store.password}" | |
| 579 alias="${key.alias}" | |
| 580 keypass="${key.alias.password}"/> | |
| 581 | |
| 582 <zipalign | |
| 583 executable="${zipalign}" | |
| 584 input="${out.unaligned.file}" | |
| 585 output="${out.final.file}" | |
| 586 verbose="${verbose}" /> | |
| 587 <echo level="info">Release Package: ${out.final.file}</echo> | |
| 588 </sequential> | |
| 589 </target> | |
| 590 | |
| 591 <!-- Builds debug output package --> | |
| 592 <target name="debug" | |
| 593 depends="-set-debug-mode, -do-sign" | |
| 594 description="Builds the application and signs it with a debug key."> | |
| 595 </target> | |
| 596 | |
| 597 <!-- This runs -package-release first and then runs | |
| 598 only if release-sign is true (set in -release-check, | |
| 599 called by -release-no-sign)--> | |
| 600 <target name="release" | |
| 601 depends="-set-release-mode, -do-sign" | |
| 602 description="Builds the application in release mode."> | |
| 603 </target> | |
| 604 | |
| 605 </project> | |
| OLD | NEW |