Index: build/config/android/rules.gni |
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
index 824a44f77c22130e2c5621456c5d3af038de61ed..dd4b4e4d303d2ce0c53b2c71509781d917e6f7a1 100644 |
--- a/build/config/android/rules.gni |
+++ b/build/config/android/rules.gni |
@@ -1191,9 +1191,18 @@ template("android_java_prebuilt") { |
# apk_name: Name for final apk. |
# final_apk_path: Path to final built apk. Default is |
# $root_out_dir/apks/$apk_name.apk. Setting this will override apk_name. |
+# loadable_modules: List of paths to native libraries to include. Different |
+# from |native_libs| in that: |
+# * dependencies of this .so are not automatically included, |
+# * ".cr.so" is never added |
+# * load_library_from_apk and enable_relocation_packing do not apply |
+# * not side-loaded for _incremental targets. |
+# Use this instead of native_libs when you are going to load the library |
+# conditionally, and only when native_libs doesn't work for you. |
# native_libs: List paths of native libraries to include in this apk. If these |
# libraries depend on other shared_library targets, those dependencies will |
-# also be included in the apk. |
+# also be included in the apk. When building with is_component_build, |
+# The extension is automatically changed to ".cr.so". |
# native_lib_placeholders: List of placeholder filenames to add to the apk |
# (optional). |
# apk_under_test: For an instrumentation test apk, this is the target of the |
@@ -1268,6 +1277,10 @@ template("android_apk") { |
assert(_final_apk_path_no_ext != "") # Mark as used. |
_native_libs = [] |
+ _loadable_modules = [] |
+ if (defined(invoker.loadable_modules)) { |
+ _loadable_modules = invoker.loadable_modules |
+ } |
_version_code = "1" |
if (defined(invoker.version_code)) { |
@@ -1695,8 +1708,9 @@ template("android_apk") { |
":$final_dex_target_name", |
] |
- if (_native_libs != [] && !_create_abi_split) { |
+ if ((_native_libs != [] || _loadable_modules != []) && !_create_abi_split) { |
native_libs_dir = _native_libs_dir |
+ native_libs = _loadable_modules |
# Placeholders necessary for some older devices. |
# http://crbug.com/395038 |
@@ -1706,7 +1720,7 @@ template("android_apk") { |
} |
} |
- if (_native_libs != [] && _create_abi_split) { |
+ if ((_native_libs != [] || _loadable_modules != []) && _create_abi_split) { |
_manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" |
generate_split_manifest(_manifest_rule) { |
main_manifest = _android_manifest |
@@ -1735,6 +1749,7 @@ template("android_apk") { |
keystore_password = _keystore_password |
native_libs_dir = _native_libs_dir |
+ native_libs = _loadable_modules |
# Placeholders necessary for some older devices. |
# http://crbug.com/395038 |