Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: build/config/android/internal_rules.gni

Issue 1348533007: GN: Use a custom script for package_apk() build step rather than ANT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md5-check-4
Patch Set: review commetns Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/gyp/apkbuilder.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 _incremental_deps = [] 615 _incremental_deps = []
631 if (defined(invoker.incremental_deps)) { 616 if (defined(invoker.incremental_deps)) {
632 _incremental_deps = invoker.incremental_deps 617 _incremental_deps = invoker.incremental_deps
633 } 618 }
634 619
635 _native_libs_dir = "//build/android/empty/res"
636 if (defined(invoker.native_libs_dir)) {
637 _native_libs_dir = invoker.native_libs_dir
638 }
639
640 if (defined(invoker.asset_location)) { 620 if (defined(invoker.asset_location)) {
641 _asset_location = invoker.asset_location 621 _asset_location = invoker.asset_location
642 assert(_asset_location != "") # Mark as used. 622 assert(_asset_location != "") # Mark as used.
643 } 623 }
644 624
645 _version_code = invoker.version_code 625 _version_code = invoker.version_code
646 _version_name = invoker.version_name 626 _version_name = invoker.version_name
647 assert(_version_code != -1) # Mark as used. 627 assert(_version_code != -1) # Mark as used.
648 assert(_version_name != "") # Mark as used. 628 assert(_version_name != "") # Mark as used.
649 629
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 package_resources_helper(_incremental_package_resources_target_name) { 774 package_resources_helper(_incremental_package_resources_target_name) {
795 forward_variables_from(invoker, [ "extensions_to_not_compress" ]) 775 forward_variables_from(invoker, [ "extensions_to_not_compress" ])
796 deps = 776 deps =
797 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ] 777 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ]
798 android_manifest = _incremental_android_manifest 778 android_manifest = _incremental_android_manifest
799 resource_packaged_apk_path = _incremental_resource_packaged_apk_path 779 resource_packaged_apk_path = _incremental_resource_packaged_apk_path
800 } 780 }
801 781
802 package_target = "${target_name}__package" 782 package_target = "${target_name}__package"
803 package_apk(package_target) { 783 package_apk(package_target) {
784 forward_variables_from(invoker, [ "native_libs_dir" ])
804 deps = _deps + [ ":${_package_resources_target_name}" ] 785 deps = _deps + [ ":${_package_resources_target_name}" ]
805 786
806 if (defined(_dex_path)) { 787 if (defined(_dex_path)) {
807 dex_path = _dex_path 788 dex_path = _dex_path
808 } 789 }
809 native_libs_dir = _native_libs_dir 790
810 output_apk_path = _packaged_apk_path 791 output_apk_path = _packaged_apk_path
811 resource_packaged_apk_path = _resource_packaged_apk_path 792 resource_packaged_apk_path = _resource_packaged_apk_path
812 } 793 }
813 794
814 _incremental_package_target = "${target_name}_incremental__package" 795 _incremental_package_target = "${target_name}_incremental__package"
815 package_apk(_incremental_package_target) { 796 package_apk(_incremental_package_target) {
816 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" 797 _dex_target = "//build/android/incremental_install:bootstrap_java__dex"
817 deps = _incremental_deps + [ 798 deps = _incremental_deps + [
818 ":${_incremental_package_resources_target_name}", 799 ":${_incremental_package_resources_target_name}",
819 _dex_target, 800 _dex_target,
820 ] 801 ]
821 802
822 if (defined(_dex_path)) { 803 if (defined(_dex_path)) {
823 dex_path = 804 dex_path =
824 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" 805 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex"
825 } 806 }
826 807
827 # TODO(agrieve): Add a placeholder .so for http://crbug.com/384638 808 # TODO(agrieve): Add a placeholder .so for http://crbug.com/384638
828 native_libs_dir = "//build/android/empty/res"
829 output_apk_path = _incremental_packaged_apk_path 809 output_apk_path = _incremental_packaged_apk_path
830 resource_packaged_apk_path = _incremental_resource_packaged_apk_path 810 resource_packaged_apk_path = _incremental_resource_packaged_apk_path
831 } 811 }
832 812
833 _finalize_apk_rule_name = "${target_name}__finalize" 813 _finalize_apk_rule_name = "${target_name}__finalize"
834 finalize_apk(_finalize_apk_rule_name) { 814 finalize_apk(_finalize_apk_rule_name) {
835 input_apk_path = _packaged_apk_path 815 input_apk_path = _packaged_apk_path
836 output_apk_path = _final_apk_path 816 output_apk_path = _final_apk_path
837 keystore_path = _keystore_path 817 keystore_path = _keystore_path
838 keystore_name = _keystore_name 818 keystore_name = _keystore_name
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 ] 1628 ]
1649 args = [ 1629 args = [
1650 "--depfile", 1630 "--depfile",
1651 rebase_path(depfile, root_build_dir), 1631 rebase_path(depfile, root_build_dir),
1652 "--script-output-path", 1632 "--script-output-path",
1653 rebase_path(generated_script, root_build_dir), 1633 rebase_path(generated_script, root_build_dir),
1654 ] 1634 ]
1655 args += test_runner_args 1635 args += test_runner_args
1656 } 1636 }
1657 } 1637 }
OLDNEW
« no previous file with comments | « build/android/gyp/apkbuilder.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698