| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 # output_apk_path: Output path for the generated .apk. | 476 # output_apk_path: Output path for the generated .apk. |
| 477 # native_libs_dir: Directory containing native libraries. | 477 # native_libs_dir: Directory containing native libraries. |
| 478 template("package_apk") { | 478 template("package_apk") { |
| 479 action(target_name) { | 479 action(target_name) { |
| 480 forward_variables_from(invoker, | 480 forward_variables_from(invoker, |
| 481 [ | 481 [ |
| 482 "deps", | 482 "deps", |
| 483 "public_deps", | 483 "public_deps", |
| 484 "testonly", | 484 "testonly", |
| 485 ]) | 485 ]) |
| 486 script = "//build/android/gyp/ant.py" | 486 script = "//build/android/gyp/apkbuilder.py" |
| 487 _ant_script = "//build/android/ant/apk-package.xml" | |
| 488 | |
| 489 depfile = "$target_gen_dir/$target_name.d" | 487 depfile = "$target_gen_dir/$target_name.d" |
| 490 data_deps = [ "//tools/android/md5sum" ] # Used when deploying APKs | 488 data_deps = [ "//tools/android/md5sum" ] # Used when deploying APKs |
| 491 | 489 |
| 492 inputs = [ | 490 inputs = [ |
| 493 invoker.resource_packaged_apk_path, | 491 invoker.resource_packaged_apk_path, |
| 494 _ant_script, | |
| 495 ] | 492 ] |
| 496 if (defined(invoker.dex_path)) { | 493 if (defined(invoker.dex_path)) { |
| 497 inputs += [ invoker.dex_path ] | 494 inputs += [ invoker.dex_path ] |
| 498 } | 495 } |
| 499 | 496 |
| 500 outputs = [ | 497 outputs = [ |
| 501 depfile, | 498 depfile, |
| 502 invoker.output_apk_path, | 499 invoker.output_apk_path, |
| 503 ] | 500 ] |
| 504 | 501 |
| 505 _rebased_emma_jar = "" | |
| 506 _rebased_resource_packaged_apk_path = | 502 _rebased_resource_packaged_apk_path = |
| 507 rebase_path(invoker.resource_packaged_apk_path, root_build_dir) | 503 rebase_path(invoker.resource_packaged_apk_path, root_build_dir) |
| 508 _rebased_packaged_apk_path = | 504 _rebased_packaged_apk_path = |
| 509 rebase_path(invoker.output_apk_path, root_build_dir) | 505 rebase_path(invoker.output_apk_path, root_build_dir) |
| 510 _rebased_native_libs_dir = | |
| 511 rebase_path(invoker.native_libs_dir, root_build_dir) | |
| 512 args = [ | 506 args = [ |
| 513 "--depfile", | 507 "--depfile", |
| 514 rebase_path(depfile, root_build_dir), | 508 rebase_path(depfile, root_build_dir), |
| 515 "--", | 509 "--resource-apk=$_rebased_resource_packaged_apk_path", |
| 516 "-quiet", | 510 "--output-apk=$_rebased_packaged_apk_path", |
| 517 "-DANDROID_SDK_ROOT=$rebased_android_sdk_root", | |
| 518 "-DANDROID_SDK_TOOLS=$rebased_android_sdk_build_tools", | |
| 519 "-DRESOURCE_PACKAGED_APK_NAME=$_rebased_resource_packaged_apk_path", | |
| 520 "-DCONFIGURATION_NAME=$android_configuration_name", | |
| 521 "-DNATIVE_LIBS_DIR=$_rebased_native_libs_dir", | |
| 522 "-DOUT_DIR=", | |
| 523 "-DUNSIGNED_APK_PATH=$_rebased_packaged_apk_path", | |
| 524 "-DEMMA_INSTRUMENT=0", | |
| 525 "-DEMMA_DEVICE_JAR=$_rebased_emma_jar", | |
| 526 "-Dbasedir=.", | |
| 527 "-buildfile", | |
| 528 rebase_path(_ant_script, root_build_dir), | |
| 529 ] | 511 ] |
| 530 if (defined(invoker.dex_path)) { | 512 if (defined(invoker.dex_path)) { |
| 531 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) | 513 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) |
| 514 args += [ "--dex-file=$_rebased_dex_path" ] |
| 515 } |
| 516 if (defined(invoker.native_libs_dir)) { |
| 517 _rebased_native_libs_dir = |
| 518 rebase_path(invoker.native_libs_dir, root_build_dir) |
| 532 args += [ | 519 args += [ |
| 533 "-DDEX_FILE_PATH=$_rebased_dex_path", | 520 "--native-libs-dir=$_rebased_native_libs_dir/$android_app_abi", |
| 534 "-DHAS_CODE=true", | 521 "--android-abi=$android_app_abi", |
| 535 ] | 522 ] |
| 536 } else { | |
| 537 args += [ "-DHAS_CODE=false" ] | |
| 538 } | 523 } |
| 539 } | 524 } |
| 540 } | 525 } |
| 541 | 526 |
| 542 # Signs & zipaligns an apk. | 527 # Signs & zipaligns an apk. |
| 543 # | 528 # |
| 544 # Variables | 529 # Variables |
| 545 # input_apk_path: Path of the .apk to be finalized. | 530 # input_apk_path: Path of the .apk to be finalized. |
| 546 # output_apk_path: Output path for the generated .apk. | 531 # output_apk_path: Output path for the generated .apk. |
| 547 # keystore_path: Path to keystore to use for signing. | 532 # keystore_path: Path to keystore to use for signing. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 if (defined(invoker.dex_path)) { | 606 if (defined(invoker.dex_path)) { |
| 622 _dex_path = invoker.dex_path | 607 _dex_path = invoker.dex_path |
| 623 } | 608 } |
| 624 _load_library_from_apk = invoker.load_library_from_apk | 609 _load_library_from_apk = invoker.load_library_from_apk |
| 625 | 610 |
| 626 _deps = [] | 611 _deps = [] |
| 627 if (defined(invoker.deps)) { | 612 if (defined(invoker.deps)) { |
| 628 _deps = invoker.deps | 613 _deps = invoker.deps |
| 629 } | 614 } |
| 630 | 615 |
| 631 _native_libs_dir = "//build/android/empty/res" | |
| 632 if (defined(invoker.native_libs_dir)) { | |
| 633 _native_libs_dir = invoker.native_libs_dir | |
| 634 } | |
| 635 | |
| 636 if (defined(invoker.asset_location)) { | 616 if (defined(invoker.asset_location)) { |
| 637 _asset_location = invoker.asset_location | 617 _asset_location = invoker.asset_location |
| 638 assert(_asset_location != "") # Mark as used. | 618 assert(_asset_location != "") # Mark as used. |
| 639 } | 619 } |
| 640 | 620 |
| 641 _version_code = invoker.version_code | 621 _version_code = invoker.version_code |
| 642 _version_name = invoker.version_name | 622 _version_name = invoker.version_name |
| 643 assert(_version_code != -1) # Mark as used. | 623 assert(_version_code != -1) # Mark as used. |
| 644 assert(_version_name != "") # Mark as used. | 624 assert(_version_name != "") # Mark as used. |
| 645 | 625 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 # from the result of the main package_resources step. | 769 # from the result of the main package_resources step. |
| 790 package_resources_helper(_incremental_package_resources_target_name) { | 770 package_resources_helper(_incremental_package_resources_target_name) { |
| 791 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) | 771 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) |
| 792 deps = _deps + [ ":$_generate_incremental_manifest_target_name" ] | 772 deps = _deps + [ ":$_generate_incremental_manifest_target_name" ] |
| 793 android_manifest = _incremental_android_manifest | 773 android_manifest = _incremental_android_manifest |
| 794 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 774 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
| 795 } | 775 } |
| 796 | 776 |
| 797 package_target = "${target_name}__package" | 777 package_target = "${target_name}__package" |
| 798 package_apk(package_target) { | 778 package_apk(package_target) { |
| 779 forward_variables_from(invoker, [ "native_libs_dir" ]) |
| 799 deps = _deps + [ ":${_package_resources_target_name}" ] | 780 deps = _deps + [ ":${_package_resources_target_name}" ] |
| 800 | 781 |
| 801 if (defined(_dex_path)) { | 782 if (defined(_dex_path)) { |
| 802 dex_path = _dex_path | 783 dex_path = _dex_path |
| 803 } | 784 } |
| 804 native_libs_dir = _native_libs_dir | 785 |
| 805 output_apk_path = _packaged_apk_path | 786 output_apk_path = _packaged_apk_path |
| 806 resource_packaged_apk_path = _resource_packaged_apk_path | 787 resource_packaged_apk_path = _resource_packaged_apk_path |
| 807 } | 788 } |
| 808 | 789 |
| 809 _incremental_package_target = "${target_name}_incremental__package" | 790 _incremental_package_target = "${target_name}_incremental__package" |
| 810 package_apk(_incremental_package_target) { | 791 package_apk(_incremental_package_target) { |
| 811 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" | 792 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" |
| 812 deps = _deps + [ | 793 deps = _deps + [ |
| 813 ":${_incremental_package_resources_target_name}", | 794 ":${_incremental_package_resources_target_name}", |
| 814 _dex_target, | 795 _dex_target, |
| 815 ] | 796 ] |
| 816 | 797 |
| 817 if (defined(_dex_path)) { | 798 if (defined(_dex_path)) { |
| 818 dex_path = | 799 dex_path = |
| 819 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 800 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
| 820 } | 801 } |
| 821 | 802 |
| 822 # TODO(agrieve): Add a placeholder .so for http://crbug.com/384638 | 803 # TODO(agrieve): Add a placeholder .so for http://crbug.com/384638 |
| 823 native_libs_dir = "//build/android/empty/res" | |
| 824 output_apk_path = _incremental_packaged_apk_path | 804 output_apk_path = _incremental_packaged_apk_path |
| 825 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 805 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
| 826 } | 806 } |
| 827 | 807 |
| 828 _finalize_apk_rule_name = "${target_name}__finalize" | 808 _finalize_apk_rule_name = "${target_name}__finalize" |
| 829 finalize_apk(_finalize_apk_rule_name) { | 809 finalize_apk(_finalize_apk_rule_name) { |
| 830 input_apk_path = _packaged_apk_path | 810 input_apk_path = _packaged_apk_path |
| 831 output_apk_path = _final_apk_path | 811 output_apk_path = _final_apk_path |
| 832 keystore_path = _keystore_path | 812 keystore_path = _keystore_path |
| 833 keystore_name = _keystore_name | 813 keystore_name = _keystore_name |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 ] | 1623 ] |
| 1644 args = [ | 1624 args = [ |
| 1645 "--depfile", | 1625 "--depfile", |
| 1646 rebase_path(depfile, root_build_dir), | 1626 rebase_path(depfile, root_build_dir), |
| 1647 "--script-output-path", | 1627 "--script-output-path", |
| 1648 rebase_path(generated_script, root_build_dir), | 1628 rebase_path(generated_script, root_build_dir), |
| 1649 ] | 1629 ] |
| 1650 args += test_runner_args | 1630 args += test_runner_args |
| 1651 } | 1631 } |
| 1652 } | 1632 } |
| OLD | NEW |