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/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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 } | 757 } |
| 758 if (_native_lib_placeholders != []) { | 758 if (_native_lib_placeholders != []) { |
| 759 args += [ "--native-lib-placeholders=$_native_lib_placeholders" ] | 759 args += [ "--native-lib-placeholders=$_native_lib_placeholders" ] |
| 760 } | 760 } |
| 761 | 761 |
| 762 if (defined(invoker.emma_instrument) && invoker.emma_instrument) { | 762 if (defined(invoker.emma_instrument) && invoker.emma_instrument) { |
| 763 _emma_device_jar = "$android_sdk_root/tools/lib/emma_device.jar" | 763 _emma_device_jar = "$android_sdk_root/tools/lib/emma_device.jar" |
| 764 _rebased_emma_device_jar = rebase_path(_emma_device_jar, root_build_dir) | 764 _rebased_emma_device_jar = rebase_path(_emma_device_jar, root_build_dir) |
| 765 args += [ "--emma-device-jar=$_rebased_emma_device_jar" ] | 765 args += [ "--emma-device-jar=$_rebased_emma_device_jar" ] |
| 766 } | 766 } |
| 767 | |
| 768 if (defined(invoker.uncompress_shared_libraries) && | |
| 769 invoker.uncompress_shared_libraries) { | |
| 770 args += [ "--uncompress-shared-libraries" ] | |
| 771 } | |
| 767 } | 772 } |
| 768 } | 773 } |
| 769 | 774 |
| 770 # Signs & zipaligns an apk. | 775 # Signs & zipaligns an apk. |
| 771 # | 776 # |
| 772 # Variables | 777 # Variables |
| 773 # input_apk_path: Path of the .apk to be finalized. | 778 # input_apk_path: Path of the .apk to be finalized. |
| 774 # output_apk_path: Output path for the generated .apk. | 779 # output_apk_path: Output path for the generated .apk. |
| 775 # keystore_path: Path to keystore to use for signing. | 780 # keystore_path: Path to keystore to use for signing. |
| 776 # keystore_name: Key alias to use. | 781 # keystore_name: Key alias to use. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 ] | 823 ] |
| 819 if (defined(invoker.rezip_apk) && invoker.rezip_apk) { | 824 if (defined(invoker.rezip_apk) && invoker.rezip_apk) { |
| 820 deps += [ "//build/android/rezip" ] | 825 deps += [ "//build/android/rezip" ] |
| 821 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar" | 826 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar" |
| 822 args += [ | 827 args += [ |
| 823 "--load-library-from-zip=1", | 828 "--load-library-from-zip=1", |
| 824 "--rezip-apk-jar-path", | 829 "--rezip-apk-jar-path", |
| 825 rebase_path(_rezip_jar_path, root_build_dir), | 830 rebase_path(_rezip_jar_path, root_build_dir), |
| 826 ] | 831 ] |
| 827 } | 832 } |
| 833 | |
| 834 if (defined(invoker.page_align_shared_libraries) && | |
| 835 invoker.page_align_shared_libraries) { | |
| 836 args += [ "--page-align-shared-libraries" ] | |
| 837 } | |
| 828 } | 838 } |
| 829 } | 839 } |
| 830 | 840 |
| 831 # Packages resources, assets, dex, and native libraries into an apk. Signs and | 841 # Packages resources, assets, dex, and native libraries into an apk. Signs and |
| 832 # zipaligns the apk. | 842 # zipaligns the apk. |
| 833 template("create_apk") { | 843 template("create_apk") { |
| 834 set_sources_assignment_filter([]) | 844 set_sources_assignment_filter([]) |
| 835 forward_variables_from(invoker, [ "testonly" ]) | 845 forward_variables_from(invoker, [ "testonly" ]) |
| 836 | 846 |
| 837 _android_manifest = invoker.android_manifest | 847 _android_manifest = invoker.android_manifest |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1054 } | 1064 } |
| 1055 | 1065 |
| 1056 package_target = "${target_name}__package" | 1066 package_target = "${target_name}__package" |
| 1057 package_apk(package_target) { | 1067 package_apk(package_target) { |
| 1058 forward_variables_from(invoker, | 1068 forward_variables_from(invoker, |
| 1059 [ | 1069 [ |
| 1060 "assets_build_config", | 1070 "assets_build_config", |
| 1061 "emma_instrument", | 1071 "emma_instrument", |
| 1062 "native_lib_placeholders", | 1072 "native_lib_placeholders", |
| 1063 "native_libs_filearg", | 1073 "native_libs_filearg", |
| 1074 "uncompress_shared_libraries", | |
| 1064 "write_asset_list", | 1075 "write_asset_list", |
| 1065 ]) | 1076 ]) |
| 1066 deps = _deps + [ ":${_package_resources_target_name}" ] | 1077 deps = _deps + [ ":${_package_resources_target_name}" ] |
| 1067 native_libs = _native_libs + _native_libs_even_when_incremental | 1078 native_libs = _native_libs + _native_libs_even_when_incremental |
| 1068 | 1079 |
| 1069 if (defined(_dex_path)) { | 1080 if (defined(_dex_path)) { |
| 1070 dex_path = _dex_path | 1081 dex_path = _dex_path |
| 1071 } | 1082 } |
| 1072 | 1083 |
| 1073 output_apk_path = _packaged_apk_path | 1084 output_apk_path = _packaged_apk_path |
| 1074 resource_packaged_apk_path = _resource_packaged_apk_path | 1085 resource_packaged_apk_path = _resource_packaged_apk_path |
| 1075 } | 1086 } |
| 1076 | 1087 |
| 1077 _incremental_package_target = "${target_name}_incremental__package" | 1088 _incremental_package_target = "${target_name}_incremental__package" |
| 1078 package_apk(_incremental_package_target) { | 1089 package_apk(_incremental_package_target) { |
| 1079 forward_variables_from(invoker, | 1090 forward_variables_from(invoker, |
| 1080 [ | 1091 [ |
| 1081 "assets_build_config", | 1092 "assets_build_config", |
| 1082 "emma_instrument", | 1093 "emma_instrument", |
| 1094 "uncompress_shared_libraries", | |
| 1083 ]) | 1095 ]) |
| 1084 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" | 1096 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" |
| 1085 deps = _incremental_deps + [ | 1097 deps = _incremental_deps + [ |
| 1086 ":${_incremental_package_resources_target_name}", | 1098 ":${_incremental_package_resources_target_name}", |
| 1087 _dex_target, | 1099 _dex_target, |
| 1088 ] | 1100 ] |
| 1089 | 1101 |
| 1090 if (defined(_dex_path)) { | 1102 if (defined(_dex_path)) { |
| 1091 dex_path = | 1103 dex_path = |
| 1092 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" | 1104 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" |
| 1093 } | 1105 } |
| 1094 | 1106 |
| 1095 native_libs = _native_libs_even_when_incremental | 1107 native_libs = _native_libs_even_when_incremental |
| 1096 | 1108 |
| 1097 # http://crbug.com/384638 | 1109 # http://crbug.com/384638 |
| 1098 _has_native_libs = | 1110 _has_native_libs = |
| 1099 defined(invoker.native_libs_filearg) || _native_libs != [] | 1111 defined(invoker.native_libs_filearg) || _native_libs != [] |
| 1100 if (_has_native_libs && _native_libs_even_when_incremental == []) { | 1112 if (_has_native_libs && _native_libs_even_when_incremental == []) { |
| 1101 native_lib_placeholders = [ "libfix.crbug.384638.so" ] | 1113 native_lib_placeholders = [ "libfix.crbug.384638.so" ] |
| 1102 } | 1114 } |
| 1103 | 1115 |
| 1104 output_apk_path = _incremental_packaged_apk_path | 1116 output_apk_path = _incremental_packaged_apk_path |
| 1105 resource_packaged_apk_path = _incremental_resource_packaged_apk_path | 1117 resource_packaged_apk_path = _incremental_resource_packaged_apk_path |
| 1106 } | 1118 } |
| 1107 | 1119 |
| 1108 _finalize_apk_rule_name = "${target_name}__finalize" | 1120 _finalize_apk_rule_name = "${target_name}__finalize" |
| 1109 finalize_apk(_finalize_apk_rule_name) { | 1121 finalize_apk(_finalize_apk_rule_name) { |
| 1122 forward_variables_from(invoker, [ "page_align_shared_libraries" ]) | |
| 1123 | |
| 1110 input_apk_path = _packaged_apk_path | 1124 input_apk_path = _packaged_apk_path |
| 1111 output_apk_path = _final_apk_path | 1125 output_apk_path = _final_apk_path |
| 1112 keystore_path = _keystore_path | 1126 keystore_path = _keystore_path |
| 1113 keystore_name = _keystore_name | 1127 keystore_name = _keystore_name |
| 1114 keystore_password = _keystore_password | 1128 keystore_password = _keystore_password |
| 1115 rezip_apk = _load_library_from_apk | 1129 rezip_apk = _load_library_from_apk |
| 1116 | 1130 |
| 1117 public_deps = [ | 1131 public_deps = [ |
| 1118 # Generator of the _packaged_apk_path this target takes as input. | 1132 # Generator of the _packaged_apk_path this target takes as input. |
| 1119 ":$package_target", | 1133 ":$package_target", |
| 1120 ] | 1134 ] |
| 1121 } | 1135 } |
| 1122 | 1136 |
| 1123 _incremental_finalize_apk_rule_name = "${target_name}_incremental__finalize" | 1137 _incremental_finalize_apk_rule_name = "${target_name}_incremental__finalize" |
| 1124 finalize_apk(_incremental_finalize_apk_rule_name) { | 1138 finalize_apk(_incremental_finalize_apk_rule_name) { |
| 1139 forward_variables_from(invoker, [ "page_align_shared_libraries" ]) | |
|
Yaron
2016/01/21 20:22:46
did you test this? incremental apks have a special
michaelbai
2016/01/21 21:58:03
No, I didn't test it, actually, I don't know how t
| |
| 1140 | |
| 1125 input_apk_path = _incremental_packaged_apk_path | 1141 input_apk_path = _incremental_packaged_apk_path |
| 1126 output_apk_path = _incremental_final_apk_path | 1142 output_apk_path = _incremental_final_apk_path |
| 1127 keystore_path = _keystore_path | 1143 keystore_path = _keystore_path |
| 1128 keystore_name = _keystore_name | 1144 keystore_name = _keystore_name |
| 1129 keystore_password = _keystore_password | 1145 keystore_password = _keystore_password |
| 1130 | 1146 |
| 1131 public_deps = [ | 1147 public_deps = [ |
| 1132 ":$_incremental_package_target", | 1148 ":$_incremental_package_target", |
| 1133 ] | 1149 ] |
| 1134 } | 1150 } |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2082 ] | 2098 ] |
| 2083 args = [ | 2099 args = [ |
| 2084 "--depfile", | 2100 "--depfile", |
| 2085 rebase_path(depfile, root_build_dir), | 2101 rebase_path(depfile, root_build_dir), |
| 2086 "--script-output-path", | 2102 "--script-output-path", |
| 2087 rebase_path(generated_script, root_build_dir), | 2103 rebase_path(generated_script, root_build_dir), |
| 2088 ] | 2104 ] |
| 2089 args += test_runner_args | 2105 args += test_runner_args |
| 2090 } | 2106 } |
| 2091 } | 2107 } |
| OLD | NEW |