Commit 6f9290bd authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

Trichrome: Fix native library listing for component builds.

NativeLibraries.java has a dependency issue that creates problems for
Trichrome Webview 64 bit component builds.

This CL adds a workaround of these issues by just listing a single
native library, libmonochrome.cr.so, which does have the right
dependencies (listed in the "NEEDED" section of the binary).

The problem and fix both only affect trichrome component builds.

Bug: 1042107
Change-Id: Ib4873daeccf89373cacf1aace1240b6d708331f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008464Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734105}
parent c4e3ab82
......@@ -15,6 +15,14 @@ from native_libraries_template import NATIVE_LIBRARIES_TEMPLATE
from util import build_utils
def _FormatLibraryName(library_name):
filename = os.path.split(library_name)[1]
assert filename.startswith('lib')
assert filename.endswith('.so')
# Remove lib prefix and .so suffix.
return '"%s"' % filename[3:-3]
def main():
parser = argparse.ArgumentParser()
......@@ -46,6 +54,10 @@ def main():
required=True,
default='CPU_FAMILY_UNKNOWN',
help='CPU family.')
parser.add_argument(
'--main-component-library',
help='If used, the list of native libraries will only contain this '
'library. Dependencies are found in the library\'s "NEEDED" section.')
parser.add_argument(
'--output', required=True, help='Path to the generated srcjar file.')
......@@ -57,15 +69,14 @@ def main():
'Must set --enable-chromium-linker to load library from APK.')
native_libraries_list = []
if options.native_libraries_list:
if options.main_component_library:
native_libraries_list.append(
_FormatLibraryName(options.main_component_library))
elif options.native_libraries_list:
with open(options.native_libraries_list) as f:
for path in f:
path = path.strip()
filename = os.path.split(path)[1]
assert filename.startswith('lib')
assert filename.endswith('.so')
# Remove lib prefix and .so suffix.
native_libraries_list.append('"%s"' % filename[3:-3])
native_libraries_list.append(_FormatLibraryName(path))
def bool_str(value):
if value:
......
......@@ -716,6 +716,12 @@ if (enable_java_templates) {
invoker.version_number,
]
}
if (defined(invoker.main_component_library)) {
args += [
"--main-component-library",
invoker.main_component_library,
]
}
if (defined(invoker.enable_chromium_linker) &&
invoker.enable_chromium_linker) {
args += [ "--enable-chromium-linker" ]
......@@ -2113,6 +2119,9 @@ if (enable_java_templates) {
# compiling sources given to this target (optional).
# bundles_supported: Enable Java code to treat this target as a bundle
# whether (by default determined by the target type).
# main_component_library: Specifies the name of the base component's library
# in a component build. If given, the system will find dependent native
# libraries at runtime by inspecting this library (optional).
template("android_apk_or_module") {
forward_variables_from(invoker, [ "testonly" ])
assert(defined(invoker.android_manifest))
......@@ -2620,7 +2629,11 @@ if (enable_java_templates) {
!_uses_static_library_synchronized_proguard
if (_generate_native_libraries_java) {
write_native_libraries_java("${_template_name}__native_libraries") {
forward_variables_from(invoker, [ "enable_chromium_linker_tests" ])
forward_variables_from(invoker,
[
"enable_chromium_linker_tests",
"main_component_library",
])
deps = [
":${_template_name}__secondary_abi_shared_library_list",
":${_template_name}__shared_library_list",
......@@ -3412,6 +3425,7 @@ if (enable_java_templates) {
"manifest_package",
"max_sdk_version",
"product_config_java_packages",
"main_component_library",
"min_sdk_version",
"native_lib_placeholders",
"native_lib_version_arg",
......
......@@ -188,6 +188,11 @@ template("trichrome_library_apk_tmpl") {
}
}
# http://crbug.com/1042107.
if (is_component_build) {
main_component_library = "libmonochrome.cr.so"
}
if (!is_java_debug) {
proguard_enabled = true
proguard_configs = [
......
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