Commit 209cdcdd authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

Android: Store DFM Java native methods in the base module.

This is to make proxy natives (crbug.com/929661) work with DFMs.

Previously, native methods using proxy natives in DFMs were just
excluded from the bundle. See go/chrome-dfm-proxynatives for more
context.

Bug: 995405
Change-Id: I1dd59fa1b1a1a4629e39f56007066569c4b83345
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775268
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691655}
parent bb9aba87
......@@ -1417,9 +1417,14 @@ def main(argv):
GetDepConfig(c)
for c in build_utils.ParseGnList(options.module_build_configs)
]
base_module_configs = [c for c in module_configs if c['is_base_module']]
assert len(base_module_configs) == 1, 'Must have exactly 1 base module!'
deps_info['base_module_config'] = base_module_configs[0]['path']
jni_all_source = set()
for c in module_configs:
if c['is_base_module']:
assert 'base_module_config' not in deps_info, (
'Must have exactly 1 base module!')
deps_info['base_module_config'] = c['path']
jni_all_source.update(c['jni']['all_source'])
deps_info['jni'] = {'all_source': sorted(jni_all_source)}
# Map configs to classpath entries that should be included in their final dex.
classpath_entries_by_owning_config = collections.defaultdict(list)
......
......@@ -2716,7 +2716,11 @@ if (enable_java_templates) {
"enable_native_mocks",
"require_native_mocks",
])
target = ":$_template_name"
if (defined(invoker.bundle_target)) {
target = invoker.bundle_target
} else {
target = ":$_template_name"
}
if (defined(invoker.jni_registration_header)) {
header_output = invoker.jni_registration_header
}
......@@ -3438,6 +3442,8 @@ if (enable_java_templates) {
# base module (optional).
# base_module_target: Base module target of the bundle this module will be
# added to (optional). Can only be specified for non-base modules.
# bundle_target: Bundle target that this module belongs to (optional).
# Can only be specified for base modules.
template("android_app_bundle_module") {
_is_base_module = defined(invoker.is_base_module) && invoker.is_base_module
......@@ -3452,6 +3458,7 @@ if (enable_java_templates) {
assert(!defined(invoker.build_hooks_android_impl_deps))
assert(!defined(invoker.shared_libraries))
assert(defined(invoker.base_module_target))
assert(!defined(invoker.bundle_target))
}
# TODO(tiborg): We have several flags that are necessary for workarounds
......@@ -3472,6 +3479,7 @@ if (enable_java_templates) {
"android_manifest_dep",
"app_as_shared_lib",
"base_module_target",
"bundle_target",
"chromium_code",
"data",
"data_deps",
......
......@@ -1595,6 +1595,7 @@ template("chrome_public_apk_or_module_tmpl") {
forward_variables_from(invoker,
[
"apk_name",
"bundle_target",
"is_base_module",
"jni_registration_header",
"is_modern",
......@@ -1652,6 +1653,7 @@ chrome_public_apk_or_module_tmpl("chrome_modern_public_base_bundle_module") {
module_name = "ChromeModernPublicBase"
is_base_module = true
is_modern = true
bundle_target = ":chrome_modern_public_bundle"
}
android_library("monochrome_java") {
......@@ -1725,6 +1727,7 @@ template("monochrome_public_apk_or_module_tmpl") {
forward_variables_from(invoker,
[
"apk_name",
"bundle_target",
"include_32_bit_webview",
"is_64_bit_browser",
"is_base_module",
......@@ -2256,6 +2259,7 @@ template("monochrome_or_trichrome_public_bundle_tmpl") {
"use_trichrome_library",
])
module_name = _bundle_name + "Base"
bundle_target = ":${invoker.target_name}"
target_type = "android_app_bundle_module"
is_base_module = true
version_code = _version_code
......
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