Commit b05a8884 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

Package module native libraries into the module for component build

+ Always create a module native library target (not only for
  patitioned lib build) to simplify selection logic.

Change-Id: I6b4de3a9e883ad5087c38dac6783fea28b55ddd3
Bug: 870055
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1877249
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Auto-Submit: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710348}
parent 11448281
...@@ -22,10 +22,13 @@ apk_pak_asset_type = "_apk" ...@@ -22,10 +22,13 @@ apk_pak_asset_type = "_apk"
# is_monochrome: Optional. If set, the library is for use in monochrome. # is_monochrome: Optional. If set, the library is for use in monochrome.
# is_webview: If true, the library is for webview, and browser-specific # is_webview: If true, the library is for webview, and browser-specific
# config is skipped. # config is skipped.
# module_descs: Optional. Descriptors of feature modules from which deps # module_descs: Optional. Descriptors of feature modules for which library
# should be included, and if enabled, partition libraries created. See # targets should be auto-generated. The targets are called
# //chrome/android/modules/chrome_feature_modules.gni for the descriptor # "${target_name}_<module name>" and can be depended on like shared_library
# format. # targets. If enabled, the library targets create partitions containing the
# module's native code. Otherwise, they simply depend on the module's
# native_deps. See //chrome/android/modules/chrome_feature_modules.gni for
# the descriptor format.
template("chrome_common_shared_library") { template("chrome_common_shared_library") {
_is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome
_is_webview = defined(invoker.is_webview) && invoker.is_webview _is_webview = defined(invoker.is_webview) && invoker.is_webview
...@@ -37,8 +40,9 @@ template("chrome_common_shared_library") { ...@@ -37,8 +40,9 @@ template("chrome_common_shared_library") {
# Create a partitioned libraries if the build config supports it, and the # Create a partitioned libraries if the build config supports it, and the
# invoker has supplied module descriptors. # invoker has supplied module descriptors.
_generate_partitions = defined(invoker.module_descs) && use_native_partitions _generate_partitions = defined(invoker.module_descs) && use_native_partitions
_module_descs = []
if (defined(invoker.module_descs)) { if (defined(invoker.module_descs)) {
not_needed(invoker, [ "module_descs" ]) _module_descs = invoker.module_descs
} }
# Create a custom linker script based on JNI and feature module requirements. # Create a custom linker script based on JNI and feature module requirements.
...@@ -97,9 +101,9 @@ template("chrome_common_shared_library") { ...@@ -97,9 +101,9 @@ template("chrome_common_shared_library") {
} }
} }
if (defined(invoker.module_descs)) { if (_generate_partitions) {
partitions = [] partitions = []
foreach(_module_desc, invoker.module_descs) { foreach(_module_desc, _module_descs) {
if (defined(_module_desc.native_deps)) { if (defined(_module_desc.native_deps)) {
partitions += [ _module_desc.name ] partitions += [ _module_desc.name ]
deps += _module_desc.native_deps deps += _module_desc.native_deps
...@@ -129,4 +133,17 @@ template("chrome_common_shared_library") { ...@@ -129,4 +133,17 @@ template("chrome_common_shared_library") {
ldflags += [ "-Wl,--long-plt" ] ldflags += [ "-Wl,--long-plt" ]
} }
} }
if (!_generate_partitions) {
# Make helper targets so that we always have module native targets no matter
# whether partitions are enabled.
foreach(_module_desc, _module_descs) {
if (defined(_module_desc.native_deps)) {
group("${target_name}_${_module_desc.name}") {
forward_variables_from(invoker, [ "testonly" ])
deps = _module_desc.native_deps
}
}
}
}
} }
...@@ -35,8 +35,7 @@ template("chrome_feature_module") { ...@@ -35,8 +35,7 @@ template("chrome_feature_module") {
} }
_shared_libraries = [] _shared_libraries = []
if (use_native_partitions && defined(_module_desc.native_deps) && if (defined(_module_desc.native_deps) && _module_desc.native_deps != []) {
_module_desc.native_deps != []) {
_arch = "" _arch = ""
_toolchain = "" _toolchain = ""
if (android_64bit_target_cpu && _is_monochrome_or_trichrome) { if (android_64bit_target_cpu && _is_monochrome_or_trichrome) {
......
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