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/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
7 import("//build/config/zip.gni") | 7 import("//build/config/zip.gni") |
8 import("//third_party/ijar/ijar.gni") | 8 import("//third_party/ijar/ijar.gni") |
9 | 9 |
10 assert(is_android) | 10 assert(is_android) |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 # | 660 # |
661 # Variables | 661 # Variables |
662 # assets_build_config: Path to android_apk .build_config containing merged | 662 # assets_build_config: Path to android_apk .build_config containing merged |
663 # asset information. | 663 # asset information. |
664 # deps: Specifies the dependencies of this target. | 664 # deps: Specifies the dependencies of this target. |
665 # dex_path: Path to classes.dex file to include (optional). | 665 # dex_path: Path to classes.dex file to include (optional). |
666 # resource_packaged_apk_path: Path to .ap_ to use. | 666 # resource_packaged_apk_path: Path to .ap_ to use. |
667 # output_apk_path: Output path for the generated .apk. | 667 # output_apk_path: Output path for the generated .apk. |
668 # native_lib_placeholders: List of placeholder filenames to add to the apk | 668 # native_lib_placeholders: List of placeholder filenames to add to the apk |
669 # (optional). | 669 # (optional). |
670 # native_libs_dir: Directory containing native libraries. | 670 # native_libs: List of native libraries. |
| 671 # native_libs_filearg: @FileArg() of additionaly native libraries. |
671 # write_asset_list: Adds an extra file to the assets, which contains a list of | 672 # write_asset_list: Adds an extra file to the assets, which contains a list of |
672 # all other asset files. | 673 # all other asset files. |
673 template("package_apk") { | 674 template("package_apk") { |
674 action(target_name) { | 675 action(target_name) { |
675 forward_variables_from(invoker, | 676 forward_variables_from(invoker, |
676 [ | 677 [ |
677 "deps", | 678 "deps", |
678 "public_deps", | 679 "public_deps", |
679 "testonly", | 680 "testonly", |
680 ]) | 681 ]) |
681 _native_lib_placeholders = [] | 682 _native_lib_placeholders = [] |
682 if (defined(invoker.native_lib_placeholders)) { | 683 if (defined(invoker.native_lib_placeholders)) { |
683 _native_lib_placeholders = invoker.native_lib_placeholders | 684 _native_lib_placeholders = invoker.native_lib_placeholders |
684 } | 685 } |
685 | 686 |
686 script = "//build/android/gyp/apkbuilder.py" | 687 script = "//build/android/gyp/apkbuilder.py" |
687 depfile = "$target_gen_dir/$target_name.d" | 688 depfile = "$target_gen_dir/$target_name.d" |
688 data_deps = [ | 689 data_deps = [ |
689 "//tools/android/md5sum", | 690 "//tools/android/md5sum", |
690 ] # Used when deploying APKs | 691 ] # Used when deploying APKs |
691 | 692 |
692 inputs = [ | 693 inputs = invoker.native_libs + [ invoker.resource_packaged_apk_path ] |
693 invoker.resource_packaged_apk_path, | |
694 ] | |
695 if (defined(invoker.dex_path)) { | 694 if (defined(invoker.dex_path)) { |
696 inputs += [ invoker.dex_path ] | 695 inputs += [ invoker.dex_path ] |
697 } | 696 } |
698 | 697 |
699 outputs = [ | 698 outputs = [ |
700 depfile, | 699 depfile, |
701 invoker.output_apk_path, | 700 invoker.output_apk_path, |
702 ] | 701 ] |
703 | 702 |
704 _rebased_resource_packaged_apk_path = | 703 _rebased_resource_packaged_apk_path = |
(...skipping 15 matching lines...) Expand all Loading... |
720 "--uncompressed-assets=@FileArg($_rebased_build_config:uncompressed_asse
ts)", | 719 "--uncompressed-assets=@FileArg($_rebased_build_config:uncompressed_asse
ts)", |
721 ] | 720 ] |
722 } | 721 } |
723 if (defined(invoker.write_asset_list) && invoker.write_asset_list) { | 722 if (defined(invoker.write_asset_list) && invoker.write_asset_list) { |
724 args += [ "--write-asset-list" ] | 723 args += [ "--write-asset-list" ] |
725 } | 724 } |
726 if (defined(invoker.dex_path)) { | 725 if (defined(invoker.dex_path)) { |
727 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) | 726 _rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir) |
728 args += [ "--dex-file=$_rebased_dex_path" ] | 727 args += [ "--dex-file=$_rebased_dex_path" ] |
729 } | 728 } |
730 if (defined(invoker.native_libs_dir) || _native_lib_placeholders != []) { | 729 if (invoker.native_libs != [] || defined(invoker.native_libs_filearg) || |
| 730 _native_lib_placeholders != []) { |
731 args += [ "--android-abi=$android_app_abi" ] | 731 args += [ "--android-abi=$android_app_abi" ] |
732 } | 732 } |
733 if (defined(invoker.native_libs_dir)) { | 733 if (invoker.native_libs != []) { |
734 _rebased_native_libs_dir = | 734 _rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) |
735 rebase_path(invoker.native_libs_dir, root_build_dir) | 735 args += [ "--native-libs=$_rebased_native_libs" ] |
736 args += [ "--native-libs-dir=$_rebased_native_libs_dir/$android_app_abi" ] | 736 } |
| 737 if (defined(invoker.native_libs_filearg)) { |
| 738 args += [ "--native-libs=${invoker.native_libs_filearg}" ] |
737 } | 739 } |
738 if (_native_lib_placeholders != []) { | 740 if (_native_lib_placeholders != []) { |
739 args += [ "--native-lib-placeholders=$_native_lib_placeholders" ] | 741 args += [ "--native-lib-placeholders=$_native_lib_placeholders" ] |
740 } | 742 } |
741 | 743 |
742 if (defined(invoker.emma_instrument) && invoker.emma_instrument) { | 744 if (defined(invoker.emma_instrument) && invoker.emma_instrument) { |
743 _emma_device_jar = "$android_sdk_root/tools/lib/emma_device.jar" | 745 _emma_device_jar = "$android_sdk_root/tools/lib/emma_device.jar" |
744 _rebased_emma_device_jar = rebase_path(_emma_device_jar, root_build_dir) | 746 _rebased_emma_device_jar = rebase_path(_emma_device_jar, root_build_dir) |
745 args += [ "--emma-device-jar=$_rebased_emma_device_jar" ] | 747 args += [ "--emma-device-jar=$_rebased_emma_device_jar" ] |
746 } | 748 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 _load_library_from_apk = invoker.load_library_from_apk | 835 _load_library_from_apk = invoker.load_library_from_apk |
834 | 836 |
835 _deps = [] | 837 _deps = [] |
836 if (defined(invoker.deps)) { | 838 if (defined(invoker.deps)) { |
837 _deps = invoker.deps | 839 _deps = invoker.deps |
838 } | 840 } |
839 _incremental_deps = [] | 841 _incremental_deps = [] |
840 if (defined(invoker.incremental_deps)) { | 842 if (defined(invoker.incremental_deps)) { |
841 _incremental_deps = invoker.incremental_deps | 843 _incremental_deps = invoker.incremental_deps |
842 } | 844 } |
| 845 _native_libs = [] |
| 846 if (defined(invoker.native_libs)) { |
| 847 _native_libs = invoker.native_libs |
| 848 } |
843 | 849 |
844 # TODO(agrieve): Remove support for asset_location in favor of using | 850 # TODO(agrieve): Remove support for asset_location in favor of using |
845 # android_assets() everywhere (http://crbug.com/547162). | 851 # android_assets() everywhere (http://crbug.com/547162). |
846 if (defined(invoker.asset_location)) { | 852 if (defined(invoker.asset_location)) { |
847 _asset_location = invoker.asset_location | 853 _asset_location = invoker.asset_location |
848 assert(_asset_location != "") # Mark as used. | 854 assert(_asset_location != "") # Mark as used. |
849 } | 855 } |
850 | 856 |
851 _version_code = invoker.version_code | 857 _version_code = invoker.version_code |
852 _version_name = invoker.version_name | 858 _version_name = invoker.version_name |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 1013 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
1008 } | 1014 } |
1009 | 1015 |
1010 package_target = "${target_name}__package" | 1016 package_target = "${target_name}__package" |
1011 package_apk(package_target) { | 1017 package_apk(package_target) { |
1012 forward_variables_from(invoker, | 1018 forward_variables_from(invoker, |
1013 [ | 1019 [ |
1014 "assets_build_config", | 1020 "assets_build_config", |
1015 "emma_instrument", | 1021 "emma_instrument", |
1016 "native_lib_placeholders", | 1022 "native_lib_placeholders", |
1017 "native_libs_dir", | 1023 "native_libs_filearg", |
1018 "write_asset_list", | 1024 "write_asset_list", |
1019 ]) | 1025 ]) |
1020 deps = _deps + [ ":${_package_resources_target_name}" ] | 1026 deps = _deps + [ ":${_package_resources_target_name}" ] |
| 1027 native_libs = _native_libs |
1021 | 1028 |
1022 if (defined(_dex_path)) { | 1029 if (defined(_dex_path)) { |
1023 dex_path = _dex_path | 1030 dex_path = _dex_path |
1024 } | 1031 } |
1025 | 1032 |
1026 output_apk_path = _packaged_apk_path | 1033 output_apk_path = _packaged_apk_path |
1027 resource_packaged_apk_path = _resource_packaged_apk_path | 1034 resource_packaged_apk_path = _resource_packaged_apk_path |
1028 } | 1035 } |
1029 | 1036 |
1030 _incremental_package_target = "${target_name}_incremental__package" | 1037 _incremental_package_target = "${target_name}_incremental__package" |
1031 package_apk(_incremental_package_target) { | 1038 package_apk(_incremental_package_target) { |
1032 forward_variables_from(invoker, | 1039 forward_variables_from(invoker, |
1033 [ | 1040 [ |
1034 "assets_build_config", | 1041 "assets_build_config", |
1035 "emma_instrument", | 1042 "emma_instrument", |
1036 ]) | 1043 ]) |
1037 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" | 1044 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" |
1038 deps = _incremental_deps + [ | 1045 deps = _incremental_deps + [ |
1039 ":${_incremental_package_resources_target_name}", | 1046 ":${_incremental_package_resources_target_name}", |
1040 _dex_target, | 1047 _dex_target, |
1041 ] | 1048 ] |
1042 | 1049 |
1043 if (defined(_dex_path)) { | 1050 if (defined(_dex_path)) { |
1044 dex_path = | 1051 dex_path = |
1045 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 1052 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
1046 } | 1053 } |
1047 | 1054 |
| 1055 native_libs = [] |
| 1056 |
1048 # http://crbug.com/384638 | 1057 # http://crbug.com/384638 |
1049 if (defined(invoker.native_libs_dir)) { | 1058 _has_native_libs = |
| 1059 defined(invoker.native_libs_filearg) || _native_libs != [] |
| 1060 if (_has_native_libs) { |
1050 native_lib_placeholders = [ "libfix.crbug.384638.so" ] | 1061 native_lib_placeholders = [ "libfix.crbug.384638.so" ] |
1051 } | 1062 } |
1052 | 1063 |
1053 output_apk_path = _incremental_packaged_apk_path | 1064 output_apk_path = _incremental_packaged_apk_path |
1054 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 1065 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
1055 } | 1066 } |
1056 | 1067 |
1057 _finalize_apk_rule_name = "${target_name}__finalize" | 1068 _finalize_apk_rule_name = "${target_name}__finalize" |
1058 finalize_apk(_finalize_apk_rule_name) { | 1069 finalize_apk(_finalize_apk_rule_name) { |
1059 input_apk_path = _packaged_apk_path | 1070 input_apk_path = _packaged_apk_path |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 ] | 2000 ] |
1990 args = [ | 2001 args = [ |
1991 "--depfile", | 2002 "--depfile", |
1992 rebase_path(depfile, root_build_dir), | 2003 rebase_path(depfile, root_build_dir), |
1993 "--script-output-path", | 2004 "--script-output-path", |
1994 rebase_path(generated_script, root_build_dir), | 2005 rebase_path(generated_script, root_build_dir), |
1995 ] | 2006 ] |
1996 args += test_runner_args | 2007 args += test_runner_args |
1997 } | 2008 } |
1998 } | 2009 } |
OLD | NEW |