1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 # This file is meant to be included into a target to provide a rule 6 # to build Android APKs in a consistent manner. 7 # 8 # To use this, create a gyp target with the following form: 9 # { 10 # 'target_name': 'my_package_apk', 11 # 'type': 'none', 12 # 'variables': { 13 # 'apk_name': 'MyPackage', 14 # 'java_in_dir': 'path/to/package/root', 15 # 'resource_dir': 'path/to/package/root/res', 16 # }, 17 # 'includes': ['path/to/this/gypi/file'], 18 # } 19 # 20 # Required variables: 21 # apk_name - The final apk will be named <apk_name>.apk 22 # java_in_dir - The top-level java directory. The src should be in 23 # <(java_in_dir)/src. 24 # Optional/automatic variables: 25 # additional_input_paths - These paths will be included in the 'inputs' list to 26 # ensure that this target is rebuilt when one of these paths changes. 27 # additional_res_dirs - Additional directories containing Android resources. 28 # additional_res_packages - Package names of the R.java files corresponding to 29 # each directory in additional_res_dirs. 30 # additional_src_dirs - Additional directories with .java files to be compiled 31 # and included in the output of this target. 32 # asset_location - The directory where assets are located. 33 # generated_src_dirs - Same as additional_src_dirs except used for .java files 34 # that are generated at build time. This should be set automatically by a 35 # target's dependencies. The .java files in these directories are not 36 # included in the 'inputs' list (unlike additional_src_dirs). 37 # input_jars_paths - The path to jars to be included in the classpath. This 38 # should be filled automatically by depending on the appropriate targets. 39 # is_test_apk - Set to 1 if building a test apk. This prevents resources from 40 # dependencies from being re-included. 41 # native_lib_target - The target_name of the target which generates the final 42 # shared library to be included in this apk. A stripped copy of the 43 # library will be included in the apk. 44 # resource_dir - The directory for resources. 45 # R_package - A custom Java package to generate the resource file R.java in. 46 # By default, the package given in AndroidManifest.xml will be used. 47 # java_strings_grd - The name of the grd file from which to generate localized 48 # strings.xml files, if any. 49 # library_manifest_paths'- Paths to additional AndroidManifest.xml files from 50 # libraries. 51 52 { 53 'variables': { 54 'additional_input_paths': [], 55 'input_jars_paths': [], 56 'library_dexed_jars_paths': [], 57 'additional_src_dirs': [], 58 'generated_src_dirs': [], 59 'app_manifest_version_name%': '<(android_app_version_name)', 60 'app_manifest_version_code%': '<(android_app_version_code)', 61 'proguard_enabled%': 'false', 62 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'], 63 'jar_name': 'chromium_apk_<(_target_name).jar', 64 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', 65 'R_package%':'', 66 'additional_R_text_files': [], 67 'additional_res_dirs': [], 68 'additional_res_packages': [], 69 'is_test_apk%': 0, 70 'java_strings_grd%': '', 71 'library_manifest_paths' : [], 72 'resource_input_paths': [], 73 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', 74 'asset_location%': '<(intermediate_dir)/assets', 75 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', 76 'compile_input_paths': [], 77 'package_input_paths': [], 78 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', 79 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and 80 # nativelibraries template should be moved out of content/ (to base/?). 81 # http://crbug.com/225101 82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates/NativeLibraries.template', 83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', 84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java', 85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp', 86 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/', 87 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h', 88 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_libraries_template_data.stamp', 89 'compile_stamp': '<(intermediate_dir)/compile.stamp', 90 'jar_stamp': '<(intermediate_dir)/jar.stamp', 91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', 92 'strip_stamp': '<(intermediate_dir)/strip.stamp', 93 'classes_dir': '<(intermediate_dir)/classes', 94 'javac_includes': [], 95 'jar_excluded_classes': [], 96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', 98 'dex_path': '<(intermediate_dir)/classes.dex', 99 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', 100 'push_stamp': '<(intermediate_dir)/push.stamp', 101 'link_stamp': '<(intermediate_dir)/link.stamp', 102 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', 103 'codegen_input_paths': [], 104 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', 105 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', 106 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', 107 'source_dir': '<(java_in_dir)/src', 108 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', 109 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFIGURATION_NAME)', 110 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', 111 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh', 112 'create_standalone_apk%': 1, 113 'variables': { 114 'variables': { 115 'native_lib_target%': '', 116 }, 117 'conditions': [ 118 ['gyp_managed_install == 1 and native_lib_target != ""', { 119 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk', 120 }, { 121 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', 122 }], 123 ['gyp_managed_install == 1', { 124 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', 125 }, { 126 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', 127 }], 128 ], 129 }, 130 'native_lib_target%': '', 131 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', 132 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', 133 }, 134 # Pass the jar path to the apk's "fake" jar target. This would be better as 135 # direct_dependent_settings, but a variable set by a direct_dependent_settings 136 # cannot be lifted in a dependent to all_dependent_settings. 137 'all_dependent_settings': { 138 'variables': { 139 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 140 }, 141 }, 142 'conditions': [ 143 ['resource_dir!=""', { 144 'variables': { 145 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] 146 }, 147 }], 148 ['R_package != ""', { 149 'variables': { 150 # We generate R.java in package R_package (in addition to the package 151 # listed in the AndroidManifest.xml, which is unavoidable). 152 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], 153 'additional_res_packages': ['<(R_package)'], 154 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], 155 }, 156 }], 157 ['native_lib_target != "" and component == "shared_library"', { 158 'dependencies': [ 159 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', 160 ], 161 }], 162 ['native_lib_target != ""', { 163 'variables': { 164 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], 165 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], 166 'native_libs_paths': [ 167 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' 168 ], 169 'package_input_paths': [ 170 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', 171 ], 172 }, 173 'copies': [ 174 { 175 # gdbserver is always copied into the APK's native libs dir. The ant 176 # build scripts (apkbuilder task) will only include it in a debug 177 # build. 178 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', 179 'files': [ 180 '<(android_gdbserver)', 181 ], 182 }, 183 ], 184 'actions': [ 185 { 186 'variables': { 187 'input_libraries': ['<@(native_libs_paths)'], 188 }, 189 'includes': ['../build/android/write_ordered_libraries.gypi'], 190 }, 191 { 192 'action_name': 'native_libraries_template_data_<(_target_name)', 193 'message': 'Creating native_libraries_list.h for <(_target_name).', 194 'inputs': [ 195 '<(DEPTH)/build/android/gyp/util/build_utils.py', 196 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', 197 '<(ordered_libraries_file)', 198 ], 199 'outputs': [ 200 '<(native_libraries_template_data_stamp)', 201 ], 202 'action': [ 203 'python', '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', 204 '--ordered-libraries=<(ordered_libraries_file)', 205 '--output=<(native_libraries_template_data_file)', 206 '--stamp=<(native_libraries_template_data_stamp)', 207 ], 208 }, 209 { 210 'action_name': 'native_libraries_<(_target_name)', 211 'message': 'Creating NativeLibraries.java for <(_target_name).', 212 'inputs': [ 213 '<(DEPTH)/build/android/gyp/util/build_utils.py', 214 '<(DEPTH)/build/android/gyp/gcc_preprocess.py', 215 '<(native_libraries_template_data_stamp)', 216 '<(native_libraries_template)', 217 ], 218 'outputs': [ 219 '<(native_libraries_java_stamp)', 220 ], 221 'action': [ 222 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', 223 '--include-path=<(native_libraries_template_data_dir)', 224 '--output=<(native_libraries_java_file)', 225 '--template=<(native_libraries_template)', 226 '--stamp=<(native_libraries_java_stamp)', 227 ], 228 }, 229 { 230 'action_name': 'strip_native_libraries', 231 'variables': { 232 'ordered_libraries_file%': '<(ordered_libraries_file)', 233 'stripped_libraries_dir': '<(libraries_source_dir)', 234 'input_paths': ['<@(native_libs_paths)'], 235 'stamp': '<(strip_stamp)' 236 }, 237 'includes': ['../build/android/strip_native_libraries.gypi'], 238 }, 239 ], 240 'conditions': [ 241 ['gyp_managed_install == 1', { 242 'variables': { 243 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', 244 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)', 245 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', 246 }, 247 'dependencies': [ 248 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', 249 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations', 250 ], 251 'actions': [ 252 { 253 'includes': ['../build/android/push_libraries.gypi'], 254 }, 255 { 256 'action_name': 'create device library symlinks', 257 'message': 'Creating links on device for <(_target_name).', 258 'inputs': [ 259 '<(DEPTH)/build/android/gyp/util/build_utils.py', 260 '<(DEPTH)/build/android/gyp/create_device_library_links.py', 261 '<(apk_install_record)', 262 '<(build_device_config_path)', 263 '<(ordered_libraries_file)', 264 ], 265 'outputs': [ 266 '<(link_stamp)' 267 ], 268 'action': [ 269 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py', 270 '--build-device-configuration=<(build_device_config_path)', 271 '--libraries-json=<(ordered_libraries_file)', 272 '--script-host-path=<(symlink_script_host_path)', 273 '--script-device-path=<(symlink_script_device_path)', 274 '--target-dir=<(device_library_dir)', 275 '--apk=<(incomplete_apk_path)', 276 '--stamp=<(link_stamp)', 277 ], 278 }, 279 ], 280 'conditions': [ 281 ['create_standalone_apk == 1', { 282 'actions': [ 283 { 284 'action_name': 'create standalone APK', 285 'variables': { 286 'inputs': [ 287 '<(ordered_libraries_file)', 288 '<(strip_stamp)', 289 ], 290 'input_apk_path': '<(unsigned_apk_path)', 291 'output_apk_path': '<(unsigned_standalone_apk_path)', 292 'libraries_top_dir%': '<(libraries_top_dir)', 293 }, 294 'includes': [ 'android/create_standalone_apk_action.gypi' ], 295 }, 296 ], 297 }], 298 ], 299 }, { 300 # gyp_managed_install != 1 301 'variables': { 302 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)', 303 'package_input_paths': [ '<(strip_stamp)' ], 304 }, 305 }], 306 ], 307 }], # native_lib_target != '' 308 ['gyp_managed_install == 0 or create_standalone_apk == 1', { 309 'actions': [ 310 { 311 'action_name': 'finalize standalone apk', 312 'variables': { 313 'input_apk_path': '<(unsigned_standalone_apk_path)', 314 'output_apk_path': '<(final_apk_path)', 315 }, 316 'includes': [ 'android/finalize_apk_action.gypi'] 317 }, 318 ], 319 }], 320 ['java_strings_grd != ""', { 321 'variables': { 322 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit', 323 'additional_res_dirs': ['<(res_grit_dir)'], 324 # grit_grd_file is used by grit_action.gypi, included below. 325 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', 326 'resource_input_paths': [ 327 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))' 328 ], 329 }, 330 'actions': [ 331 { 332 'action_name': 'generate_localized_strings_xml', 333 'variables': { 334 'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'], 335 'grit_out_dir': '<(res_grit_dir)', 336 # resource_ids is unneeded since we don't generate .h headers. 337 'grit_resource_ids': '', 338 }, 339 'includes': ['../build/grit_action.gypi'], 340 }, 341 ], 342 }], 343 ['gyp_managed_install == 1', { 344 'actions': [ 345 { 346 'action_name': 'finalize incomplete apk', 347 'variables': { 348 'input_apk_path': '<(unsigned_apk_path)', 349 'output_apk_path': '<(incomplete_apk_path)', 350 }, 351 'includes': [ 'android/finalize_apk_action.gypi'] 352 }, 353 { 354 'action_name': 'apk_install_<(_target_name)', 355 'message': 'Installing <(apk_name).apk', 356 'inputs': [ 357 '<(DEPTH)/build/android/gyp/util/build_utils.py', 358 '<(DEPTH)/build/android/gyp/apk_install.py', 359 '<(build_device_config_path)', 360 '<(incomplete_apk_path)', 361 ], 362 'outputs': [ 363 '<(apk_install_record)', 364 ], 365 'action': [ 366 'python', '<(DEPTH)/build/android/gyp/apk_install.py', 367 '--apk-path=<(incomplete_apk_path)', 368 '--build-device-configuration=<(build_device_config_path)', 369 '--install-record=<(apk_install_record)', 370 ], 371 }, 372 ], 373 }], 374 ], 375 'actions': [ 376 { 377 'action_name': 'ant_codegen_<(_target_name)', 378 'message': 'Generating R.java for <(_target_name)', 379 'conditions': [ 380 ['is_test_apk == 1', { 381 'variables': { 382 'additional_res_dirs=': [], 383 'additional_res_packages=': [], 384 } 385 }], 386 ], 387 'inputs': [ 388 '<(DEPTH)/build/android/ant/apk-codegen.xml', 389 '<(DEPTH)/build/android/gyp/util/build_utils.py', 390 '<(DEPTH)/build/android/gyp/ant.py', 391 '<(android_manifest_path)', 392 '>@(additional_input_paths)', 393 '>@(codegen_input_paths)', 394 '>@(library_manifest_paths)', 395 '>@(resource_input_paths)', 396 ], 397 'outputs': [ 398 '<(codegen_stamp)', 399 ], 400 'action': [ 401 'python', '<(DEPTH)/build/android/gyp/ant.py', 402 '-quiet', 403 '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)', 404 '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)', 405 '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)', 406 '-DANDROID_MANIFEST=<(android_manifest_path)', 407 '-DANDROID_SDK_JAR=<(android_sdk_jar)', 408 '-DANDROID_SDK_ROOT=<(android_sdk_root)', 409 '-DANDROID_SDK_VERSION=<(android_sdk_version)', 410 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', 411 '-DLIBRARY_MANIFEST_PATHS=>(library_manifest_paths)', 412 '-DOUT_DIR=<(intermediate_dir)', 413 '-DRESOURCE_DIR=<(resource_dir)', 414 415 '-DSTAMP=<(codegen_stamp)', 416 '-Dbasedir=.', 417 '-buildfile', 418 '<(DEPTH)/build/android/ant/apk-codegen.xml', 419 420 # Add list of inputs to the command line, so if inputs change 421 # (e.g. if a Java file is removed), the command will be re-run. 422 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. 423 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', 424 ], 425 }, 426 { 427 'action_name': 'javac_<(_target_name)', 428 'message': 'Compiling java for <(_target_name)', 429 'variables': { 430 'all_src_dirs': [ 431 '<(java_in_dir)/src', 432 '<(intermediate_dir)/gen', 433 '>@(additional_src_dirs)', 434 '>@(generated_src_dirs)', 435 ], 436 }, 437 'inputs': [ 438 '<(DEPTH)/build/android/gyp/util/build_utils.py', 439 '<(DEPTH)/build/android/gyp/javac.py', 440 # If there is a separate find for additional_src_dirs, it will find the 441 # wrong .java files when additional_src_dirs is empty. 442 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', 443 '>@(input_jars_paths)', 444 '<(codegen_stamp)', 445 '>@(compile_input_paths)', 446 ], 447 'outputs': [ 448 '<(compile_stamp)', 449 ], 450 'action': [ 451 'python', '<(DEPTH)/build/android/gyp/javac.py', 452 '--output-dir=<(classes_dir)', 453 '--classpath=>(input_jars_paths) <(android_sdk_jar)', 454 '--src-dirs=>(all_src_dirs)', 455 '--javac-includes=<(javac_includes)', 456 '--chromium-code=<(chromium_code)', 457 '--stamp=<(compile_stamp)', 458 459 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 460 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', 461 ], 462 }, 463 { 464 'action_name': 'jar_<(_target_name)', 465 'message': 'Creating <(_target_name) jar', 466 'inputs': [ 467 '<(DEPTH)/build/android/gyp/util/build_utils.py', 468 '<(DEPTH)/build/android/gyp/util/md5_check.py', 469 '<(DEPTH)/build/android/gyp/jar.py', 470 '<(compile_stamp)', 471 ], 472 'outputs': [ 473 '<(jar_stamp)', 474 ], 475 'action': [ 476 'python', '<(DEPTH)/build/android/gyp/jar.py', 477 '--classes-dir=<(classes_dir)', 478 '--jar-path=<(jar_path)', 479 '--excluded-classes=<(jar_excluded_classes)', 480 '--stamp=<(jar_stamp)', 481 482 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 483 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', 484 ] 485 }, 486 { 487 'action_name': 'ant_obfuscate_<(_target_name)', 488 'message': 'Obfuscating <(_target_name)', 489 'inputs': [ 490 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', 491 '<(DEPTH)/build/android/ant/create-test-jar.js', 492 '<(DEPTH)/build/android/gyp/util/build_utils.py', 493 '<(DEPTH)/build/android/gyp/ant.py', 494 '<(compile_stamp)', 495 '>@(proguard_flags_paths)', 496 ], 497 'outputs': [ 498 '<(obfuscate_stamp)', 499 ], 500 'action': [ 501 'python', '<(DEPTH)/build/android/gyp/ant.py', 502 '-quiet', 503 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', 504 '-DANDROID_SDK_JAR=<(android_sdk_jar)', 505 '-DANDROID_SDK_ROOT=<(android_sdk_root)', 506 '-DANDROID_SDK_VERSION=<(android_sdk_version)', 507 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', 508 '-DAPK_NAME=<(apk_name)', 509 '-DCREATE_TEST_JAR_PATH=<(DEPTH)/build/android/ant/create-test-jar.js', 510 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', 511 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', 512 '-DINPUT_JARS_PATHS=>(input_jars_paths)', 513 '-DIS_TEST_APK=<(is_test_apk)', 514 '-DJAR_PATH=<(PRODUCT_DIR)/lib.java/<(jar_name)', 515 '-DOBFUSCATED_JAR_PATH=<(obfuscated_jar_path)', 516 '-DOUT_DIR=<(intermediate_dir)', 517 '-DPROGUARD_ENABLED=<(proguard_enabled)', 518 '-DPROGUARD_FLAGS=<(proguard_flags_paths)', 519 '-DTEST_JAR_PATH=<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', 520 521 '-DSTAMP=<(obfuscate_stamp)', 522 '-Dbasedir=.', 523 '-buildfile', 524 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', 525 526 # Add list of inputs to the command line, so if inputs change 527 # (e.g. if a Java file is removed), the command will be re-run. 528 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. 529 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', 530 ], 531 }, 532 { 533 'action_name': 'dex_<(_target_name)', 534 'variables': { 535 'conditions': [ 536 ['proguard_enabled == "true"', { 537 'input_paths': [ '<(obfuscate_stamp)' ], 538 'proguard_enabled_input_path': '<(obfuscated_jar_path)', 539 }], 540 ], 541 'input_paths': [ '<(compile_stamp)' ], 542 'dex_input_paths': [ '>@(library_dexed_jars_paths)' ], 543 'dex_generated_input_dirs': [ '<(classes_dir)' ], 544 'output_path': '<(dex_path)', 545 }, 546 'includes': [ 'android/dex_action.gypi' ], 547 }, 548 { 549 'action_name': 'ant package resources', 550 'message': 'Packaging resources for <(_target_name) APK.', 551 'inputs': [ 552 '<(DEPTH)/build/android/ant/apk-package-resources.xml', 553 '<(DEPTH)/build/android/gyp/util/build_utils.py', 554 '<(DEPTH)/build/android/gyp/ant.py', 555 '<(android_manifest_path)', 556 '<(codegen_stamp)', 557 558 '>@(library_manifest_paths)', 559 '>@(additional_input_paths)', 560 ], 561 'conditions': [ 562 ['is_test_apk == 1', { 563 'variables': { 564 'additional_res_dirs=': [], 565 'additional_res_packages=': [], 566 } 567 }], 568 ], 569 'outputs': [ 570 '<(package_resources_stamp)', 571 ], 572 'action': [ 573 'python', '<(DEPTH)/build/android/gyp/ant.py', 574 '-quiet', 575 '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)', 576 '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)', 577 '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)', 578 '-DANDROID_SDK_JAR=<(android_sdk_jar)', 579 '-DANDROID_SDK_ROOT=<(android_sdk_root)', 580 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', 581 '-DAPK_NAME=<(apk_name)', 582 '-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)', 583 '-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)', 584 '-DASSET_DIR=<(asset_location)', 585 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', 586 '-DOUT_DIR=<(intermediate_dir)', 587 '-DRESOURCE_DIR=<(resource_dir)', 588 589 '-DSTAMP=<(package_resources_stamp)', 590 591 '-Dbasedir=.', 592 '-buildfile', 593 '<(DEPTH)/build/android/ant/apk-package-resources.xml', 594 595 # Add list of inputs to the command line, so if inputs change 596 # (e.g. if a Java file is removed), the command will be re-run. 597 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. 598 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', 599 ] 600 }, 601 { 602 'action_name': 'ant_package_<(_target_name)', 603 'message': 'Packaging <(_target_name).', 604 'inputs': [ 605 '<(DEPTH)/build/android/ant/apk-package.xml', 606 '<(DEPTH)/build/android/gyp/util/build_utils.py', 607 '<(DEPTH)/build/android/gyp/ant.py', 608 '<(dex_path)', 609 '<(codegen_stamp)', 610 '<(obfuscate_stamp)', 611 '<(package_resources_stamp)', 612 '>@(package_input_paths)', 613 ], 614 'outputs': [ 615 '<(unsigned_apk_path)', 616 ], 617 'action': [ 618 'python', '<(DEPTH)/build/android/gyp/ant.py', 619 '-quiet', 620 '-DANDROID_SDK_ROOT=<(android_sdk_root)', 621 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', 622 '-DAPK_NAME=<(apk_name)', 623 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)', 624 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)', 625 '-DOUT_DIR=<(intermediate_dir)', 626 '-DSOURCE_DIR=<(source_dir)', 627 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', 628 629 '-Dbasedir=.', 630 '-buildfile', 631 '<(DEPTH)/build/android/ant/apk-package.xml', 632 633 # Add list of inputs to the command line, so if inputs change 634 # (e.g. if a Java file is removed), the command will be re-run. 635 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. 636 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', 637 ] 638 }, 639 ], 640 } 641