Commit a38bbf6a authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

Reland "Trichrome: Remove webview deps from trichrome_chrome_apk."

This reverts commit 627a3616.

Reason for revert: Fixed v8 64 bit issues by adding secondary ABI
targets.

This CL removes Java deps, some Java resource deps, Webview's
locale pak files and other assets from TrichromeChrome.apk.

Bug: 932253
Change-Id: I34ea5f24c371053ca6edbcb60f1ce637aaaa078f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526188Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Auto-Submit: Eric Stevenson <estevenson@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641693}
parent b14d4171
...@@ -1017,6 +1017,38 @@ java_group("chrome_public_non_pak_assets") { ...@@ -1017,6 +1017,38 @@ java_group("chrome_public_non_pak_assets") {
} }
} }
# TODO(estevenson): Remove this target once these assets move to
# trichrome_library_apk.
if (android_64bit_target_cpu) {
android_assets("v8_snapshot_secondary_abi_assets") {
_secondary_abi_out_dir =
get_label_info("//v8($android_secondary_abi_toolchain)", "root_out_dir")
sources = [
"$_secondary_abi_out_dir/natives_blob.bin",
]
if (use_v8_context_snapshot) {
renaming_sources = [ "$_secondary_abi_out_dir/v8_context_snapshot.bin" ]
renaming_destinations = [ "v8_context_snapshot_32.bin" ]
} else {
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
renaming_destinations = [ "snapshot_blob_32.bin" ]
}
disable_compression = true
deps = [
"//tools/v8_context_snapshot($android_secondary_abi_toolchain)",
"//v8($android_secondary_abi_toolchain)",
]
}
java_group("chrome_public_secondary_abi_non_pak_assets") {
deps = [
":v8_snapshot_secondary_abi_assets",
"//chrome/android/webapk/libs/runtime_library:runtime_library_assets",
"//third_party/icu:icu_assets",
]
}
}
jinja_template_resources("chrome_public_apk_template_resources") { jinja_template_resources("chrome_public_apk_template_resources") {
resources = [ resources = [
"java/res_template/xml/file_paths.xml", "java/res_template/xml/file_paths.xml",
...@@ -1148,12 +1180,17 @@ if (current_toolchain == default_toolchain) { ...@@ -1148,12 +1180,17 @@ if (current_toolchain == default_toolchain) {
# #
# Variables: # Variables:
# is_monochrome: If true, generate Monochrome targets rather than Chrome. # is_monochrome: If true, generate Monochrome targets rather than Chrome.
# is_trichrome: Optionally generate Trichrome targets that use monochrome
# library targets but don't include webview resources.
# is_bundle: If true, generate resources for bundles rather than APK. # is_bundle: If true, generate resources for bundles rather than APK.
template("resource_packaging") { template("resource_packaging") {
_is_monochrome = invoker.is_monochrome _is_monochrome = invoker.is_monochrome
_is_bundle = invoker.is_bundle _is_bundle = invoker.is_bundle
_is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome
if (_is_monochrome) { if (_is_trichrome) {
_type = "trichrome_chrome"
} else if (_is_monochrome) {
_type = "monochrome" _type = "monochrome"
} else { } else {
_type = "chrome" _type = "chrome"
...@@ -1166,11 +1203,16 @@ if (current_toolchain == default_toolchain) { ...@@ -1166,11 +1203,16 @@ if (current_toolchain == default_toolchain) {
_variant = "${_type}_${_output_type}" _variant = "${_type}_${_output_type}"
if (enable_resource_whitelist_generation) { if (enable_resource_whitelist_generation) {
if (_is_trichrome || _is_monochrome) {
_lib = "monochrome"
} else {
_lib = "chrome"
}
_resource_whitelist_target = "${_variant}_resource_whitelist" _resource_whitelist_target = "${_variant}_resource_whitelist"
_resource_whitelist_file = _resource_whitelist_file =
"$target_gen_dir/${_variant}_resource_whitelist.txt" "$target_gen_dir/${_variant}_resource_whitelist.txt"
if (_is_monochrome) { if (_is_trichrome || _is_monochrome) {
_target_prefix = "" _target_prefix = ""
} else { } else {
_target_prefix = "lib" _target_prefix = "lib"
...@@ -1180,12 +1222,12 @@ if (current_toolchain == default_toolchain) { ...@@ -1180,12 +1222,12 @@ if (current_toolchain == default_toolchain) {
} else { } else {
_suffix = "" _suffix = ""
} }
_lib_path = "/lib.unstripped/lib" + _type + _suffix + shlib_extension _lib_path = "/lib.unstripped/lib" + _lib + _suffix + shlib_extension
_lib_target = _target_prefix + _type + _suffix _lib_target = _target_prefix + _lib + _suffix
generate_resource_whitelist(_resource_whitelist_target) { generate_resource_whitelist(_resource_whitelist_target) {
_fat_lib_toolchain = "" _fat_lib_toolchain = ""
if (_is_monochrome) { if (_is_monochrome || _is_trichrome) {
# Always use the 32-bit library's whitelist since the 64-bit one is # Always use the 32-bit library's whitelist since the 64-bit one is
# webview-only. # webview-only.
if (!android_64bit_target_cpu) { if (!android_64bit_target_cpu) {
...@@ -1340,6 +1382,11 @@ if (current_toolchain == default_toolchain) { ...@@ -1340,6 +1382,11 @@ if (current_toolchain == default_toolchain) {
is_monochrome = true is_monochrome = true
is_bundle = false is_bundle = false
} }
resource_packaging("trichrome_chrome_apk_pak_assets") {
is_monochrome = false
is_trichrome = true
is_bundle = false
}
resource_packaging("chrome_bundle_pak_assets") { resource_packaging("chrome_bundle_pak_assets") {
is_monochrome = false is_monochrome = false
is_bundle = true is_bundle = true
...@@ -1348,6 +1395,11 @@ if (current_toolchain == default_toolchain) { ...@@ -1348,6 +1395,11 @@ if (current_toolchain == default_toolchain) {
is_monochrome = true is_monochrome = true
is_bundle = true is_bundle = true
} }
resource_packaging("trichrome_chrome_bundle_pak_assets") {
is_monochrome = false
is_bundle = true
is_trichrome = true
}
# TODO(cjgrant): Remove this temporary alias after downstream renaming lands. # TODO(cjgrant): Remove this temporary alias after downstream renaming lands.
java_group("chrome_public_pak_assets") { java_group("chrome_public_pak_assets") {
...@@ -1642,12 +1694,12 @@ android_library("monochrome_java") { ...@@ -1642,12 +1694,12 @@ android_library("monochrome_java") {
template("monochrome_public_apk_or_module_tmpl") { template("monochrome_public_apk_or_module_tmpl") {
_android_manifest = _android_manifest =
"$target_gen_dir/manifest/${target_name}/AndroidManifest.xml" "$target_gen_dir/manifest/${target_name}/AndroidManifest.xml"
_is_trichrome =
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
# Generate the manifest here in the template, to avoid a growing collection # Generate the manifest here in the template, to avoid a growing collection
# of manually-instantiated manifests. # of manually-instantiated manifests.
jinja_template("${target_name}__android_manifest") { jinja_template("${target_name}__android_manifest") {
_is_trichrome =
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
includes = [ "java/AndroidManifest.xml" ] includes = [ "java/AndroidManifest.xml" ]
variables = chrome_public_jinja_variables variables = chrome_public_jinja_variables
if (_is_trichrome) { if (_is_trichrome) {
...@@ -1698,7 +1750,7 @@ template("monochrome_public_apk_or_module_tmpl") { ...@@ -1698,7 +1750,7 @@ template("monochrome_public_apk_or_module_tmpl") {
android_manifest = _android_manifest android_manifest = _android_manifest
android_manifest_dep = ":${target_name}__android_manifest" android_manifest_dep = ":${target_name}__android_manifest"
if (public_android_sdk) { if (public_android_sdk && !_is_trichrome) {
# Resource whitelist used when generating R.java files and causes # Resource whitelist used when generating R.java files and causes
# only the webview subset of resources to be marked as non-final. # only the webview subset of resources to be marked as non-final.
shared_resources_whitelist_target = "//android_webview:system_webview_apk" shared_resources_whitelist_target = "//android_webview:system_webview_apk"
...@@ -1709,11 +1761,14 @@ template("monochrome_public_apk_or_module_tmpl") { ...@@ -1709,11 +1761,14 @@ template("monochrome_public_apk_or_module_tmpl") {
} }
deps = [ deps = [
":monochrome_java",
"//android_webview:platform_service_bridge_upstream_implementation_java",
"//base:base_java",
"//chrome/android:app_hooks_java", "//chrome/android:app_hooks_java",
] ]
if (!_is_trichrome) {
deps += [
":monochrome_java",
"//android_webview:platform_service_bridge_upstream_implementation_java",
]
}
_needs_arm32_lib = target_cpu == "arm" || _needs_arm32_lib = target_cpu == "arm" ||
(target_cpu == "arm64" && build_apk_secondary_abi) (target_cpu == "arm64" && build_apk_secondary_abi)
......
...@@ -51,6 +51,10 @@ default_chrome_public_jinja_variables = [ ...@@ -51,6 +51,10 @@ default_chrome_public_jinja_variables = [
# final APK or bundle. # final APK or bundle.
# is_modern: If true, indicates this corresponds to a chrome_modern_XXX # is_modern: If true, indicates this corresponds to a chrome_modern_XXX
# target that can only run on Android L-M. # target that can only run on Android L-M.
# is_monochrome: Indicates that this target contains chrome and webview
# packaged together and can only run on Android N+.
# is_trichrome: Indicates this target relies on a trichrome static library
# target and can only run on Android P+.
# png_to_webp: Optional. If true, convert image resources to webp format. # png_to_webp: Optional. If true, convert image resources to webp format.
# requires Android K+, since these were not supported by Android properly # requires Android K+, since these were not supported by Android properly
# before 4.3.0. # before 4.3.0.
...@@ -58,7 +62,6 @@ default_chrome_public_jinja_variables = [ ...@@ -58,7 +62,6 @@ default_chrome_public_jinja_variables = [
# directly from the APK (and stored zipaligned and uncompressed). This # directly from the APK (and stored zipaligned and uncompressed). This
# requires either the Chromium linker, or Android M+. # requires either the Chromium linker, or Android M+.
# version_name: Application version name (e.g. "Developer Build"). # version_name: Application version name (e.g. "Developer Build").
# is_modern: Optional. true iff this is a chrome_modern derived build.
# #
# Plus all other variables accepted by android_apk() or # Plus all other variables accepted by android_apk() or
# android_app_bundle_module(), depending on the target type. # android_app_bundle_module(), depending on the target type.
...@@ -70,6 +73,9 @@ template("chrome_public_common_apk_or_module_tmpl") { ...@@ -70,6 +73,9 @@ template("chrome_public_common_apk_or_module_tmpl") {
invoker.target_type == "android_app_bundle_module" || invoker.target_type == "android_app_bundle_module" ||
invoker.target_type == "instrumentation_test_apk", invoker.target_type == "instrumentation_test_apk",
"Invalid target_type definition, should be 'android_apk' or 'android_app_bundle_module'") "Invalid target_type definition, should be 'android_apk' or 'android_app_bundle_module'")
assert(!(defined(invoker.is_trichrome) && invoker.is_trichrome) ||
!(defined(invoker.is_monochrome) && invoker.is_monochrome),
"Cannot be both trichrome and monochrome!")
# Adds unwind table asset to the chrome apk for the given library target. This # Adds unwind table asset to the chrome apk for the given library target. This
# is not part of generic apk assets target since it depends on the main shared # is not part of generic apk assets target since it depends on the main shared
...@@ -100,10 +106,8 @@ template("chrome_public_common_apk_or_module_tmpl") { ...@@ -100,10 +106,8 @@ template("chrome_public_common_apk_or_module_tmpl") {
assert(_is_modern || !_is_modern) # Mark as used. assert(_is_modern || !_is_modern) # Mark as used.
_is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome
_is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome
_use_trichrome_library = assert(_is_trichrome || !_is_trichrome) # Mark as used.
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
assert(_use_trichrome_library || !_use_trichrome_library) # Mark as used.
if (defined(invoker.enable_multidex)) { if (defined(invoker.enable_multidex)) {
_enable_multidex = invoker.enable_multidex _enable_multidex = invoker.enable_multidex
...@@ -149,7 +153,7 @@ template("chrome_public_common_apk_or_module_tmpl") { ...@@ -149,7 +153,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
} }
} }
if (!_is_monochrome) { if (!_is_monochrome && !_is_trichrome) {
deps += [ deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_named_as_so", "//third_party/crashpad/crashpad/handler:crashpad_handler_named_as_so",
] ]
...@@ -247,7 +251,7 @@ template("chrome_public_common_apk_or_module_tmpl") { ...@@ -247,7 +251,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
} }
if (!defined(version_code)) { if (!defined(version_code)) {
if (_use_trichrome_library) { if (_is_trichrome) {
version_code = trichrome_version_code version_code = trichrome_version_code
} else if (_is_monochrome) { } else if (_is_monochrome) {
version_code = monochrome_version_code version_code = monochrome_version_code
...@@ -262,7 +266,12 @@ template("chrome_public_common_apk_or_module_tmpl") { ...@@ -262,7 +266,12 @@ template("chrome_public_common_apk_or_module_tmpl") {
} }
# The equivalent of chrome_common_apk_or_module_tmpl for all builds of # The equivalent of chrome_common_apk_or_module_tmpl for all builds of
# monochrome. # monochrome and trichrome chrome.
# Variables:
# use_trichrome_library: Specifies that this target depends on a trichrome
# static library target to provide certain shared library deps, and that
# this target should not package webview deps.
template("monochrome_public_common_apk_or_module_tmpl") { template("monochrome_public_common_apk_or_module_tmpl") {
if (defined(invoker.enable_multidex)) { if (defined(invoker.enable_multidex)) {
_enable_multidex = invoker.enable_multidex _enable_multidex = invoker.enable_multidex
...@@ -270,11 +279,16 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -270,11 +279,16 @@ template("monochrome_public_common_apk_or_module_tmpl") {
_enable_multidex = is_java_debug || multidex_in_release _enable_multidex = is_java_debug || multidex_in_release
} }
chrome_public_common_apk_or_module_tmpl(target_name) { chrome_public_common_apk_or_module_tmpl(target_name) {
is_monochrome = true is_trichrome =
use_trichrome_library =
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
is_monochrome = !is_trichrome
loadable_modules = []
secondary_abi_loadable_modules = []
if (!use_trichrome_library) { _deps = [ "//components/crash/android:handler_java" ]
if (is_monochrome) {
if (invoker.target_type == "android_app_bundle_module") { if (invoker.target_type == "android_app_bundle_module") {
_suffix = bundle_library_suffix _suffix = bundle_library_suffix
} else { } else {
...@@ -301,7 +315,33 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -301,7 +315,33 @@ template("monochrome_public_common_apk_or_module_tmpl") {
if (invoker.add_unwind_tables_in_apk) { if (invoker.add_unwind_tables_in_apk) {
shared_library_for_unwind_asset = "monochrome${_suffix}" shared_library_for_unwind_asset = "monochrome${_suffix}"
} }
} else {
_deps += [
"//android_webview:monochrome_webview_assets",
"//android_webview/apk:webview_license_activity_java",
"//android_webview/glue",
"//chrome/android:chrome_public_non_pak_assets",
"//chrome/android:monochrome_java",
"//chrome/android/monochrome:monochrome_license_provider_java",
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
loadable_modules += [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
if (android_64bit_target_cpu && build_apk_secondary_abi &&
(!defined(invoker.is_64_bit_browser) || !invoker.is_64_bit_browser ||
invoker.include_32_bit_webview)) {
_trampoline = "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline($android_secondary_abi_toolchain)"
_deps += [ _trampoline ]
_secondary_out_dir = get_label_info(_trampoline, "root_out_dir")
secondary_abi_loadable_modules +=
[ "$_secondary_out_dir/libcrashpad_handler_trampoline.so" ]
}
alternative_android_sdk_dep = webview_framework_dep
app_as_shared_lib = true
min_sdk_version = 24
_pak_prefix = "monochrome"
}
if (is_trichrome) {
# Include placeholder libraries to make Chrome multiarch in the same way # Include placeholder libraries to make Chrome multiarch in the same way
# as Monochrome, even though Chrome only runs with one of the two # as Monochrome, even though Chrome only runs with one of the two
# bitnesses. This allows the "32-bit" and "64-bit" versions of Chrome to # bitnesses. This allows the "32-bit" and "64-bit" versions of Chrome to
...@@ -311,12 +351,17 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -311,12 +351,17 @@ template("monochrome_public_common_apk_or_module_tmpl") {
if (android_64bit_target_cpu && build_apk_secondary_abi) { if (android_64bit_target_cpu && build_apk_secondary_abi) {
secondary_native_lib_placeholders = [ "libdummy.so" ] secondary_native_lib_placeholders = [ "libdummy.so" ]
} }
if (android_64bit_target_cpu) {
_deps +=
[ "//chrome/android:chrome_public_secondary_abi_non_pak_assets" ]
} else {
_deps += [ "//chrome/android:chrome_public_non_pak_assets" ]
}
min_sdk_version = 28
_pak_prefix = "trichrome_chrome"
} }
alternative_android_sdk_dep = webview_framework_dep
app_as_shared_lib = true
use_chromium_linker = false use_chromium_linker = false
min_sdk_version = 24
# Resources config for blocklisting resource names from obfuscation # Resources config for blocklisting resource names from obfuscation
resources_config_path = "//android_webview/aapt2.config" resources_config_path = "//android_webview/aapt2.config"
...@@ -341,46 +386,12 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -341,46 +386,12 @@ template("monochrome_public_common_apk_or_module_tmpl") {
# Android N+ better supports multiple locales (https://crbug.com/780847). # Android N+ better supports multiple locales (https://crbug.com/780847).
support_zh_hk = false support_zh_hk = false
if (!defined(deps)) {
deps = []
}
if (!defined(loadable_modules)) {
loadable_modules = []
}
if (!defined(secondary_abi_loadable_modules)) {
secondary_abi_loadable_modules = []
}
if (!use_trichrome_library) {
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
loadable_modules += [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
if (android_64bit_target_cpu && build_apk_secondary_abi &&
(!defined(invoker.is_64_bit_browser) || !invoker.is_64_bit_browser ||
invoker.include_32_bit_webview)) {
_trampoline = "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline($android_secondary_abi_toolchain)"
deps += [ _trampoline ]
_secondary_out_dir = get_label_info(_trampoline, "root_out_dir")
secondary_abi_loadable_modules +=
[ "$_secondary_out_dir/libcrashpad_handler_trampoline.so" ]
}
}
deps += [
"//android_webview:monochrome_webview_assets",
"//android_webview/apk:webview_license_activity_java",
"//android_webview/glue",
"//chrome/android:chrome_public_non_pak_assets",
"//chrome/android/monochrome:monochrome_license_provider_java",
"//components/crash/android:handler_java",
]
if (invoker.target_type == "android_app_bundle_module") { if (invoker.target_type == "android_app_bundle_module") {
deps += _deps += [
[ "//chrome/android:monochrome_${bundle_pak_asset_type}_pak_assets" ] "//chrome/android:${_pak_prefix}_${bundle_pak_asset_type}_pak_assets",
]
} else { } else {
deps += [ "//chrome/android:monochrome_apk_pak_assets" ] _deps += [ "//chrome/android:${_pak_prefix}_apk_pak_assets" ]
} }
if (_enable_multidex && invoker.target_type == "android_apk" && if (_enable_multidex && invoker.target_type == "android_apk" &&
...@@ -398,13 +409,15 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -398,13 +409,15 @@ template("monochrome_public_common_apk_or_module_tmpl") {
if (!defined(proguard_configs)) { if (!defined(proguard_configs)) {
proguard_configs = [] proguard_configs = []
} }
proguard_configs += [ "//android_webview/apk/java/proguard.flags" ] if (is_monochrome) {
proguard_configs += [ "//android_webview/apk/java/proguard.flags" ]
}
png_to_webp = true png_to_webp = true
} }
if ((invoker.target_type == "android_apk" || !modularize_ar) && if ((invoker.target_type == "android_apk" || !modularize_ar) &&
package_arcore) { package_arcore) {
deps += [ _deps += [
"//chrome/browser/android/vr:ar_java", "//chrome/browser/android/vr:ar_java",
"//third_party/android_deps:com_google_ar_core_java", "//third_party/android_deps:com_google_ar_core_java",
] ]
...@@ -418,5 +431,9 @@ template("monochrome_public_common_apk_or_module_tmpl") { ...@@ -418,5 +431,9 @@ template("monochrome_public_common_apk_or_module_tmpl") {
loadable_modules += [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] loadable_modules += [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ]
} }
} }
if (!defined(deps)) {
deps = []
}
deps += _deps
} }
} }
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