Trichrome: move common assets into the library.
- Move the 32-bit V8 assets and the ICU data file into TrichromeLibrary
to eliminate the duplicate copies in TrichromeChrome/WebView.
- Remove the 64-bit V8 assets from TrichromeChrome as they're only
needed by WebView.
TBR=torne@google.com
(cherry picked from commit 5f8bc466954a824fab35905ded9f9b55ffbcc4c6)
Bug: 943637
Change-Id: Idf7eb9d39004973d0333006d1d47bb13af150bec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1461086
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Richard Coles <torne@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#642541}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1534341
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/branch-heads/3729@{#364}
Cr-Branched-From: d4a8972e30b604f090aeda5dfff68386ae656267-refs/heads/master@{#638880}
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
index ccad462..a1e6cd3 100644
--- a/android_webview/BUILD.gn
+++ b/android_webview/BUILD.gn
@@ -211,7 +211,7 @@
}
# These assets are needed by both monochrome and stand alone WebView, but not by
-# Chrome.
+# Chrome or TrichromeWebView.
android_assets("monochrome_webview_assets") {
deps = [
"//third_party/icu:icu_assets",
@@ -226,15 +226,6 @@
}
}
-java_group("assets") {
- deps = [
- ":license_assets",
- ":locale_pak_assets",
- ":monochrome_webview_assets",
- ":pak_file_assets",
- ]
-}
-
java_group("stub_assets") {
deps = [
":license_assets",
@@ -433,6 +424,9 @@
renaming_sources = [ "$_secondary_abi_out_dir/v8_context_snapshot.bin" ]
renaming_destinations = [ "v8_context_snapshot_$arch_suffix.bin" ]
} else {
+ sources = [
+ "$root_out_dir/natives_blob.bin",
+ ]
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
renaming_destinations = [ "snapshot_blob_$arch_suffix.bin" ]
}
diff --git a/android_webview/system_webview_apk_tmpl.gni b/android_webview/system_webview_apk_tmpl.gni
index 75e8d20..fd6adf5 100644
--- a/android_webview/system_webview_apk_tmpl.gni
+++ b/android_webview/system_webview_apk_tmpl.gni
@@ -7,13 +7,16 @@
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
+import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
template("system_webview_apk_tmpl") {
android_apk(target_name) {
forward_variables_from(invoker, "*")
deps += [
- "//android_webview:assets",
+ "//android_webview:license_assets",
+ "//android_webview:locale_pak_assets",
+ "//android_webview:pak_file_assets",
"//android_webview/apk:webview_license_activity_java",
"//android_webview/apk:webview_license_provider_java",
"//android_webview/glue",
@@ -30,6 +33,10 @@
_use_trichrome_library =
defined(use_trichrome_library) && use_trichrome_library
+ if (!_use_trichrome_library || !trichrome_shared_assets) {
+ deps += [ "//android_webview:monochrome_webview_assets" ]
+ }
+
if (!_use_trichrome_library) {
shared_libraries = [ "//android_webview:libwebviewchromium" ]
deps += [
@@ -59,6 +66,11 @@
if (build_apk_secondary_abi) {
secondary_native_lib_placeholders = [ "libdummy.so" ]
+ if (use_v8_context_snapshot) {
+ deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ]
+ } else {
+ deps += [ "//v8:v8_external_startup_data_assets" ]
+ }
}
} else {
native_lib_placeholders = [ "libdummy.so" ]
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index 5ccf237d..b62c98f 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -231,6 +231,10 @@
# Enable the chrome build for devices without touchscreens.
notouch_build = false
+
+ # Move Trichrome assets to the shared library APK. This will be removed
+ # once P builds are no longer supported. https://crbug.com/943637
+ trichrome_shared_assets = android_sdk_release == "q"
}
assert(!(check_android_configuration && is_java_debug),
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 7c36964e..5d5cd31 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -1004,43 +1004,17 @@
java_group("chrome_public_non_pak_assets") {
deps = [
"//chrome/android/webapk/libs/runtime_library:runtime_library_assets",
- "//third_party/icu:icu_assets",
]
- if (use_v8_context_snapshot) {
- deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ]
- } else {
- deps += [ "//v8:v8_external_startup_data_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
+java_group("chrome_public_v8_assets") {
+ if (use_v8_context_snapshot) {
deps = [
- "//tools/v8_context_snapshot($android_secondary_abi_toolchain)",
- "//v8($android_secondary_abi_toolchain)",
+ "//tools/v8_context_snapshot:v8_context_snapshot_assets",
]
- }
-
- java_group("chrome_public_secondary_abi_non_pak_assets") {
+ } else {
deps = [
- ":v8_snapshot_secondary_abi_assets",
- "//chrome/android/webapk/libs/runtime_library:runtime_library_assets",
- "//third_party/icu:icu_assets",
+ "//v8:v8_external_startup_data_assets",
]
}
}
@@ -1488,6 +1462,8 @@
":chrome_public_apk_resources",
":chrome_public_base_module_java",
":chrome_public_non_pak_assets",
+ ":chrome_public_v8_assets",
+ "//third_party/icu:icu_assets",
]
generate_jni("test_support_jni_headers") {
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni
index 32147a1..00f7177 100644
--- a/chrome/android/chrome_public_apk_tmpl.gni
+++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -155,7 +155,9 @@
if (!_is_monochrome && !_is_trichrome) {
deps += [
+ "//chrome/android:chrome_public_v8_assets",
"//third_party/crashpad/crashpad/handler:crashpad_handler_named_as_so",
+ "//third_party/icu:icu_assets",
]
if (!defined(loadable_modules)) {
loadable_modules = []
@@ -286,7 +288,10 @@
loadable_modules = []
secondary_abi_loadable_modules = []
- _deps = [ "//components/crash/android:handler_java" ]
+ _deps = [
+ "//components/crash/android:handler_java",
+ "//chrome/android:chrome_public_non_pak_assets",
+ ]
if (is_monochrome) {
if (invoker.target_type == "android_app_bundle_module") {
@@ -320,7 +325,6 @@
"//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",
@@ -342,6 +346,10 @@
_pak_prefix = "monochrome"
}
if (is_trichrome) {
+ if (!trichrome_shared_assets) {
+ _deps += [ "//android_webview:monochrome_webview_assets" ]
+ }
+
# Include placeholder libraries to make Chrome multiarch in the same way
# 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
@@ -351,12 +359,6 @@
if (android_64bit_target_cpu && build_apk_secondary_abi) {
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"
}
diff --git a/chrome/android/trichrome.gni b/chrome/android/trichrome.gni
index 52466dd..5d51e08 100644
--- a/chrome/android/trichrome.gni
+++ b/chrome/android/trichrome.gni
@@ -59,11 +59,15 @@
version_name = chrome_version_name
version_code = trichrome_version_code
- # TODO(torne): using these resources just to get a temporary icon
+ # TODO(torne): using system_webview_resources just to get a temporary icon
deps = [
"//android_webview:system_webview_resources",
]
+ if (trichrome_shared_assets) {
+ deps += [ "//third_party/icu:icu_assets" ]
+ }
+
# Only try to generate the native library version in configurations that
# include a native library.
if (!android_64bit_target_cpu || build_apk_secondary_abi) {
@@ -89,11 +93,17 @@
secondary_abi_loadable_modules =
[ "$_secondary_out_dir/libcrashpad_handler_trampoline.so" ]
}
+ if (trichrome_shared_assets) {
+ deps += [ "//android_webview:v8_snapshot_secondary_abi_assets" ]
+ }
} else {
shared_libraries = [ "//chrome/android:monochrome" ]
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
+ if (trichrome_shared_assets) {
+ deps += [ "//chrome/android:chrome_public_v8_assets" ]
+ }
loadable_modules = [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
}