Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 import("//build/config/zip.gni") | 6 import("//build/config/zip.gni") |
| 7 import("//third_party/ijar/ijar.gni") | 7 import("//third_party/ijar/ijar.gni") |
| 8 | 8 |
| 9 assert(is_android) | 9 assert(is_android) |
| 10 | 10 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 template("write_build_config") { | 235 template("write_build_config") { |
| 236 set_sources_assignment_filter([]) | 236 set_sources_assignment_filter([]) |
| 237 | 237 |
| 238 assert(defined(invoker.type)) | 238 assert(defined(invoker.type)) |
| 239 assert(defined(invoker.build_config)) | 239 assert(defined(invoker.build_config)) |
| 240 | 240 |
| 241 type = invoker.type | 241 type = invoker.type |
| 242 build_config = invoker.build_config | 242 build_config = invoker.build_config |
| 243 | 243 |
| 244 assert(type == "android_apk" || type == "java_library" || | 244 assert(type == "android_apk" || type == "java_library" || |
| 245 type == "android_resources" || type == "deps_dex") | 245 type == "android_resources" || type == "deps_dex" || |
| 246 type == "android_assets") | |
| 246 | 247 |
| 247 action(target_name) { | 248 action(target_name) { |
| 248 deps = [] | 249 deps = [] |
| 249 forward_variables_from(invoker, | 250 forward_variables_from(invoker, |
| 250 [ | 251 [ |
| 251 "deps", | 252 "deps", |
| 252 "testonly", | 253 "testonly", |
| 253 "visibility", | 254 "visibility", |
| 254 ]) | 255 ]) |
| 255 | 256 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 276 type, | 277 type, |
| 277 "--depfile", | 278 "--depfile", |
| 278 rebase_path(depfile, root_build_dir), | 279 rebase_path(depfile, root_build_dir), |
| 279 "--possible-deps-configs=$rebase_possible_deps_configs", | 280 "--possible-deps-configs=$rebase_possible_deps_configs", |
| 280 "--build-config", | 281 "--build-config", |
| 281 rebase_path(build_config, root_build_dir), | 282 rebase_path(build_config, root_build_dir), |
| 282 ] | 283 ] |
| 283 | 284 |
| 284 is_java_library = type == "java_library" | 285 is_java_library = type == "java_library" |
| 285 is_apk = type == "android_apk" | 286 is_apk = type == "android_apk" |
| 287 is_android_assets = type == "android_assets" | |
| 286 is_android_resources = type == "android_resources" | 288 is_android_resources = type == "android_resources" |
| 287 is_deps_dex = type == "deps_dex" | 289 is_deps_dex = type == "deps_dex" |
| 288 | 290 |
| 289 supports_android = is_apk || is_android_resources || is_deps_dex || | 291 supports_android = |
| 290 (is_java_library && defined(invoker.supports_android) && | 292 is_apk || is_android_assets || is_android_resources || is_deps_dex || |
| 291 invoker.supports_android) | 293 (is_java_library && defined(invoker.supports_android) && |
| 292 requires_android = is_apk || is_android_resources || is_deps_dex || | 294 invoker.supports_android) |
| 293 (is_java_library && defined(invoker.requires_android) && | 295 requires_android = |
| 294 invoker.requires_android) | 296 is_apk || is_android_assets || is_android_resources || is_deps_dex || |
| 297 (is_java_library && defined(invoker.requires_android) && | |
| 298 invoker.requires_android) | |
| 295 | 299 |
| 296 assert(!requires_android || supports_android, | 300 assert(!requires_android || supports_android, |
| 297 "requires_android requires" + " supports_android") | 301 "requires_android requires" + " supports_android") |
| 298 | 302 |
| 299 # Mark these variables as used. | 303 # Mark these variables as used. |
| 300 assert(is_java_library || true) | 304 assert(is_java_library || true) |
| 301 assert(is_apk || true) | 305 assert(is_apk || true) |
| 302 assert(is_android_resources || true) | 306 assert(is_android_resources || true) |
| 303 assert(is_deps_dex || true) | 307 assert(is_deps_dex || true) |
| 304 | 308 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 332 get_label_info(invoker.apk_under_test, "target_gen_dir") | 336 get_label_info(invoker.apk_under_test, "target_gen_dir") |
| 333 apk_under_test_name = get_label_info(invoker.apk_under_test, "name") | 337 apk_under_test_name = get_label_info(invoker.apk_under_test, "name") |
| 334 apk_under_test_config = | 338 apk_under_test_config = |
| 335 "$apk_under_test_gen_dir/$apk_under_test_name.build_config" | 339 "$apk_under_test_gen_dir/$apk_under_test_name.build_config" |
| 336 args += [ | 340 args += [ |
| 337 "--tested-apk-config", | 341 "--tested-apk-config", |
| 338 rebase_path(apk_under_test_config, root_build_dir), | 342 rebase_path(apk_under_test_config, root_build_dir), |
| 339 ] | 343 ] |
| 340 } | 344 } |
| 341 | 345 |
| 346 if (is_android_assets) { | |
| 347 inputs += invoker.assets | |
| 348 _rebased_assets = rebase_path(invoker.assets, root_build_dir) | |
| 349 args += [ "--assets=$_rebased_assets" ] | |
| 350 if (defined(invoker.enable_compression) && !invoker.enable_compression) { | |
| 351 args += [ "--disable-asset-compression" ] | |
| 352 } | |
| 353 } | |
| 354 | |
| 342 if (is_android_resources || is_apk) { | 355 if (is_android_resources || is_apk) { |
| 343 assert(defined(invoker.resources_zip)) | 356 assert(defined(invoker.resources_zip)) |
| 344 args += [ | 357 args += [ |
| 345 "--resources-zip", | 358 "--resources-zip", |
| 346 rebase_path(invoker.resources_zip, root_build_dir), | 359 rebase_path(invoker.resources_zip, root_build_dir), |
| 347 ] | 360 ] |
| 348 if (defined(invoker.android_manifest)) { | 361 if (defined(invoker.android_manifest)) { |
| 349 inputs += [ invoker.android_manifest ] | 362 inputs += [ invoker.android_manifest ] |
| 350 args += [ | 363 args += [ |
| 351 "--android-manifest", | 364 "--android-manifest", |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 public_deps = [ | 486 public_deps = [ |
| 474 ":${target_name}__ijar", | 487 ":${target_name}__ijar", |
| 475 ":$_output_jar_target", | 488 ":$_output_jar_target", |
| 476 ] | 489 ] |
| 477 } | 490 } |
| 478 } | 491 } |
| 479 | 492 |
| 480 # Creates an unsigned .apk. | 493 # Creates an unsigned .apk. |
| 481 # | 494 # |
| 482 # Variables | 495 # Variables |
| 496 # assets_build_config: Path to android_apk .build_config containing merged | |
| 497 # asset information. | |
| 483 # deps: Specifies the dependencies of this target. | 498 # deps: Specifies the dependencies of this target. |
| 484 # dex_path: Path to classes.dex file to include (optional). | 499 # dex_path: Path to classes.dex file to include (optional). |
| 485 # resource_packaged_apk_path: Path to .ap_ to use. | 500 # resource_packaged_apk_path: Path to .ap_ to use. |
| 486 # output_apk_path: Output path for the generated .apk. | 501 # output_apk_path: Output path for the generated .apk. |
| 487 # native_libs_dir: Directory containing native libraries. | 502 # native_libs_dir: Directory containing native libraries. |
| 488 # create_placeholder_lib: Whether to add a dummy lib to the apk. | 503 # create_placeholder_lib: Whether to add a dummy lib to the apk. |
| 489 template("package_apk") { | 504 template("package_apk") { |
| 490 action(target_name) { | 505 action(target_name) { |
| 491 forward_variables_from(invoker, | 506 forward_variables_from(invoker, |
| 492 [ | 507 [ |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 518 _rebased_resource_packaged_apk_path = | 533 _rebased_resource_packaged_apk_path = |
| 519 rebase_path(invoker.resource_packaged_apk_path, root_build_dir) | 534 rebase_path(invoker.resource_packaged_apk_path, root_build_dir) |
| 520 _rebased_packaged_apk_path = | 535 _rebased_packaged_apk_path = |
| 521 rebase_path(invoker.output_apk_path, root_build_dir) | 536 rebase_path(invoker.output_apk_path, root_build_dir) |
| 522 args = [ | 537 args = [ |
| 523 "--depfile", | 538 "--depfile", |
| 524 rebase_path(depfile, root_build_dir), | 539 rebase_path(depfile, root_build_dir), |
| 525 "--resource-apk=$_rebased_resource_packaged_apk_path", | 540 "--resource-apk=$_rebased_resource_packaged_apk_path", |
| 526 "--output-apk=$_rebased_packaged_apk_path", | 541 "--output-apk=$_rebased_packaged_apk_path", |
| 527 ] | 542 ] |
| 543 if (defined(invoker.assets_build_config)) { | |
| 544 inputs += [ invoker.assets_build_config ] | |
| 545 _rebased_build_config = | |
| 546 rebase_path(invoker.assets_build_config, root_build_dir) | |
| 547 args += [ "--assets-build-config=$_rebased_build_config" ] | |
| 548 } | |
| 528 if (defined(invoker.dex_path)) { | 549 if (defined(invoker.dex_path)) { |
| 529 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) | 550 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) |
| 530 args += [ "--dex-file=$_rebased_dex_path" ] | 551 args += [ "--dex-file=$_rebased_dex_path" ] |
| 531 } | 552 } |
| 532 if (defined(invoker.native_libs_dir) || _create_placeholder_lib) { | 553 if (defined(invoker.native_libs_dir) || _create_placeholder_lib) { |
| 533 args += [ "--android-abi=$android_app_abi" ] | 554 args += [ "--android-abi=$android_app_abi" ] |
| 534 } | 555 } |
| 535 if (defined(invoker.native_libs_dir)) { | 556 if (defined(invoker.native_libs_dir)) { |
| 536 _rebased_native_libs_dir = | 557 _rebased_native_libs_dir = |
| 537 rebase_path(invoker.native_libs_dir, root_build_dir) | 558 rebase_path(invoker.native_libs_dir, root_build_dir) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 | 650 |
| 630 _deps = [] | 651 _deps = [] |
| 631 if (defined(invoker.deps)) { | 652 if (defined(invoker.deps)) { |
| 632 _deps = invoker.deps | 653 _deps = invoker.deps |
| 633 } | 654 } |
| 634 _incremental_deps = [] | 655 _incremental_deps = [] |
| 635 if (defined(invoker.incremental_deps)) { | 656 if (defined(invoker.incremental_deps)) { |
| 636 _incremental_deps = invoker.incremental_deps | 657 _incremental_deps = invoker.incremental_deps |
| 637 } | 658 } |
| 638 | 659 |
| 660 # TODO(agrieve): Remove support for asset_location in favor of using | |
| 661 # android_asset() everywhere (http://crbug.com/547162). | |
| 639 if (defined(invoker.asset_location)) { | 662 if (defined(invoker.asset_location)) { |
| 640 _asset_location = invoker.asset_location | 663 _asset_location = invoker.asset_location |
| 641 assert(_asset_location != "") # Mark as used. | 664 assert(_asset_location != "") # Mark as used. |
| 642 } | 665 } |
| 643 | 666 |
| 644 _version_code = invoker.version_code | 667 _version_code = invoker.version_code |
| 645 _version_name = invoker.version_name | 668 _version_name = invoker.version_name |
| 646 assert(_version_code != -1) # Mark as used. | 669 assert(_version_code != -1) # Mark as used. |
| 647 assert(_version_name != "") # Mark as used. | 670 assert(_version_name != "") # Mark as used. |
| 648 | 671 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 foreach(_density, _split_densities) { | 755 foreach(_density, _split_densities) { |
| 733 outputs += [ "${invoker.resource_packaged_apk_path}_${_density}" ] | 756 outputs += [ "${invoker.resource_packaged_apk_path}_${_density}" ] |
| 734 } | 757 } |
| 735 } | 758 } |
| 736 if (_split_languages != []) { | 759 if (_split_languages != []) { |
| 737 args += [ "--language-splits=$_split_languages" ] | 760 args += [ "--language-splits=$_split_languages" ] |
| 738 foreach(_language, _split_languages) { | 761 foreach(_language, _split_languages) { |
| 739 outputs += [ "${invoker.resource_packaged_apk_path}_${_language}" ] | 762 outputs += [ "${invoker.resource_packaged_apk_path}_${_language}" ] |
| 740 } | 763 } |
| 741 } | 764 } |
| 742 if (defined(invoker.extensions_to_not_compress)) { | 765 if (defined(invoker.extensions_to_not_compress)) { |
|
pkotwicz
2015/10/24 03:46:03
This parameter will also be removed when asset_loc
agrieve
2015/10/25 17:32:10
It still applies to files in resources
| |
| 743 args += [ | 766 args += [ |
| 744 "--no-compress", | 767 "--no-compress", |
| 745 invoker.extensions_to_not_compress, | 768 invoker.extensions_to_not_compress, |
| 746 ] | 769 ] |
| 747 } | 770 } |
| 748 } | 771 } |
| 749 } | 772 } |
| 750 | 773 |
| 751 _package_resources_target_name = "${target_name}__package_resources" | 774 _package_resources_target_name = "${target_name}__package_resources" |
| 752 package_resources_helper(_package_resources_target_name) { | 775 package_resources_helper(_package_resources_target_name) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 795 package_resources_helper(_incremental_package_resources_target_name) { | 818 package_resources_helper(_incremental_package_resources_target_name) { |
| 796 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) | 819 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) |
| 797 deps = | 820 deps = |
| 798 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ] | 821 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ] |
| 799 android_manifest = _incremental_android_manifest | 822 android_manifest = _incremental_android_manifest |
| 800 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 823 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
| 801 } | 824 } |
| 802 | 825 |
| 803 package_target = "${target_name}__package" | 826 package_target = "${target_name}__package" |
| 804 package_apk(package_target) { | 827 package_apk(package_target) { |
| 805 forward_variables_from(invoker, [ "native_libs_dir" ]) | 828 forward_variables_from(invoker, |
| 829 [ | |
| 830 "assets_build_config", | |
| 831 "native_libs_dir", | |
| 832 ]) | |
| 806 deps = _deps + [ ":${_package_resources_target_name}" ] | 833 deps = _deps + [ ":${_package_resources_target_name}" ] |
| 807 | 834 |
| 808 if (defined(_dex_path)) { | 835 if (defined(_dex_path)) { |
| 809 dex_path = _dex_path | 836 dex_path = _dex_path |
| 810 } | 837 } |
| 811 | 838 |
| 812 output_apk_path = _packaged_apk_path | 839 output_apk_path = _packaged_apk_path |
| 813 resource_packaged_apk_path = _resource_packaged_apk_path | 840 resource_packaged_apk_path = _resource_packaged_apk_path |
| 814 } | 841 } |
| 815 | 842 |
| 816 _incremental_package_target = "${target_name}_incremental__package" | 843 _incremental_package_target = "${target_name}_incremental__package" |
| 817 package_apk(_incremental_package_target) { | 844 package_apk(_incremental_package_target) { |
| 845 forward_variables_from(invoker, [ "assets_build_config" ]) | |
| 818 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" | 846 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" |
| 819 deps = _incremental_deps + [ | 847 deps = _incremental_deps + [ |
| 820 ":${_incremental_package_resources_target_name}", | 848 ":${_incremental_package_resources_target_name}", |
| 821 _dex_target, | 849 _dex_target, |
| 822 ] | 850 ] |
| 823 | 851 |
| 824 if (defined(_dex_path)) { | 852 if (defined(_dex_path)) { |
| 825 dex_path = | 853 dex_path = |
| 826 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 854 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
| 827 } | 855 } |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1690 ] | 1718 ] |
| 1691 args = [ | 1719 args = [ |
| 1692 "--depfile", | 1720 "--depfile", |
| 1693 rebase_path(depfile, root_build_dir), | 1721 rebase_path(depfile, root_build_dir), |
| 1694 "--script-output-path", | 1722 "--script-output-path", |
| 1695 rebase_path(generated_script, root_build_dir), | 1723 rebase_path(generated_script, root_build_dir), |
| 1696 ] | 1724 ] |
| 1697 args += test_runner_args | 1725 args += test_runner_args |
| 1698 } | 1726 } |
| 1699 } | 1727 } |
| OLD | NEW |