Commit 60416d7c authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

Use shared_libraries flag to pull in a module's native libs

This simplifies the selection code and prepares for moving components
into modules.

Bug: 870055
Change-Id: I7042eb396cb114a74f7e77933f644184d411ce7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1874610
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709235}
parent 3108a1c2
...@@ -2623,7 +2623,8 @@ if (enable_java_templates) { ...@@ -2623,7 +2623,8 @@ if (enable_java_templates) {
_srcjar_deps += [ ":$_compile_resources_target" ] _srcjar_deps += [ ":$_compile_resources_target" ]
} }
if (_native_libs_deps != [] || _secondary_abi_native_libs_deps != []) { if ((!_is_bundle_module || _is_base_module) &&
(_native_libs_deps != [] || _secondary_abi_native_libs_deps != [])) {
write_native_libraries_java("${_template_name}__native_libraries") { write_native_libraries_java("${_template_name}__native_libraries") {
forward_variables_from(invoker, [ "enable_chromium_linker_tests" ]) forward_variables_from(invoker, [ "enable_chromium_linker_tests" ])
deps = [ deps = [
...@@ -3468,7 +3469,6 @@ if (enable_java_templates) { ...@@ -3468,7 +3469,6 @@ if (enable_java_templates) {
assert(!defined(invoker.shared_resources_whitelist_target)) assert(!defined(invoker.shared_resources_whitelist_target))
assert(!defined(invoker.shared_resources_whitelist_locales)) assert(!defined(invoker.shared_resources_whitelist_locales))
assert(!defined(invoker.build_hooks_android_impl_deps)) assert(!defined(invoker.build_hooks_android_impl_deps))
assert(!defined(invoker.shared_libraries))
assert(defined(invoker.base_module_target)) assert(defined(invoker.base_module_target))
assert(!defined(invoker.bundle_target)) assert(!defined(invoker.bundle_target))
} }
......
...@@ -43,14 +43,11 @@ template("chrome_feature_module") { ...@@ -43,14 +43,11 @@ template("chrome_feature_module") {
_module_desc.native_deps != []) { _module_desc.native_deps != []) {
_arch = "" _arch = ""
_toolchain = "" _toolchain = ""
_root_out_dir = root_out_dir
if (android_64bit_target_cpu && _is_monochrome_or_trichrome) { if (android_64bit_target_cpu && _is_monochrome_or_trichrome) {
if (_is_64_bit_browser) { if (_is_64_bit_browser) {
_arch = "_64" _arch = "_64"
} else { } else {
_toolchain = "($android_secondary_abi_toolchain)" _toolchain = "($android_secondary_abi_toolchain)"
_root_out_dir = get_label_info(":foo($android_secondary_abi_toolchain)",
"root_out_dir")
} }
} }
if (_is_monochrome_or_trichrome) { if (_is_monochrome_or_trichrome) {
...@@ -61,13 +58,6 @@ template("chrome_feature_module") { ...@@ -61,13 +58,6 @@ template("chrome_feature_module") {
_shared_libraries += [ _shared_libraries += [
"//chrome/android:${_base_target_name}_${_module_desc.name}${_toolchain}", "//chrome/android:${_base_target_name}_${_module_desc.name}${_toolchain}",
] ]
_native_library = "${_root_out_dir}/${_base_target_name}_partitions/lib${_module_desc.name}.so"
# Pass the correct library as both the 32 and 64-bit options. Underlying
# logic will choose from the correct variable, and supply a dummy library
# for the other architecture if required.
_loadable_modules_32_bit += [ _native_library ]
_loadable_modules_64_bit += [ _native_library ]
} else { } else {
not_needed([ "_is_monochrome_or_trichrome" ]) not_needed([ "_is_monochrome_or_trichrome" ])
} }
...@@ -103,16 +93,17 @@ template("chrome_feature_module") { ...@@ -103,16 +93,17 @@ template("chrome_feature_module") {
package_name = _module_desc.name package_name = _module_desc.name
# Specify native libraries and placeholders. # Specify native libraries and placeholders.
if (_loadable_modules_32_bit != [] || _loadable_modules_64_bit != []) { if (_loadable_modules_32_bit != [] || _loadable_modules_64_bit != [] ||
_shared_libraries != []) {
# Decision logic: Assign decision variables: # Decision logic: Assign decision variables:
# _loadable_modules_to_use: Either |_loadable_modules_64_bit| or # _loadable_modules_to_use: Either |_loadable_modules_64_bit| or
# |_loadable_modules_32_bit|. # |_loadable_modules_32_bit|.
# _native_is_primary: Whether |_loadable_modules_to_use| should be # _native_is_primary: Whether |_loadable_modules_to_use| and/or
# assigned as primary ABI or secondary ABI. # |_shared_libraries| should be assigned as primary ABI or
# secondary ABI.
# _native_need_placeholder: Whether a placeholder is needed for the # _native_need_placeholder: Whether a placeholder is needed for the
# complementary ABI to the library. # complementary ABI to the library.
if (_is_64_bit_browser) { if (_is_64_bit_browser) {
assert(_loadable_modules_64_bit != [])
not_needed([ "_loadable_modules_32_bit" ]) not_needed([ "_loadable_modules_32_bit" ])
_loadable_modules_to_use = _loadable_modules_64_bit _loadable_modules_to_use = _loadable_modules_64_bit
_native_is_primary = _native_is_primary =
...@@ -121,7 +112,6 @@ template("chrome_feature_module") { ...@@ -121,7 +112,6 @@ template("chrome_feature_module") {
build_apk_secondary_abi && _include_32_bit_webview build_apk_secondary_abi && _include_32_bit_webview
not_needed([ "_include_32_bit_webview" ]) not_needed([ "_include_32_bit_webview" ])
} else { } else {
assert(_loadable_modules_32_bit != [])
not_needed([ not_needed([
"_loadable_modules_64_bit", "_loadable_modules_64_bit",
"_include_32_bit_webview", "_include_32_bit_webview",
...@@ -136,11 +126,13 @@ template("chrome_feature_module") { ...@@ -136,11 +126,13 @@ template("chrome_feature_module") {
# Realization logic: Assign libraries and placeholders. # Realization logic: Assign libraries and placeholders.
if (_native_is_primary) { if (_native_is_primary) {
loadable_modules = _loadable_modules_to_use loadable_modules = _loadable_modules_to_use
shared_libraries = _shared_libraries
if (_native_need_placeholder) { if (_native_need_placeholder) {
secondary_native_lib_placeholders = [ "libdummy.so" ] secondary_native_lib_placeholders = [ "libdummy.so" ]
} }
} else { } else {
secondary_abi_loadable_modules = _loadable_modules_to_use secondary_abi_loadable_modules = _loadable_modules_to_use
secondary_abi_shared_libraries = _shared_libraries
if (_native_need_placeholder) { if (_native_need_placeholder) {
native_lib_placeholders = [ "libdummy.so" ] native_lib_placeholders = [ "libdummy.so" ]
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment