Android: Refactor support for skip_secondary_abi_for_cq
Makes it not define android_app_secondary_abi when set, which makes it
easier to find spots that require it.
Fixes _64 webview bundle targets that were missing
include_32_bit_webview=false (which just sets is_multi_abi, which just
adds a .so placeholder).
Bug: 391382988
Change-Id: I7037d16db43812570fa4f86e81820baa3ffa5f1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6280872
Owners-Override: Andrew Grieve <[email protected]>
Reviewed-by: Mohamed Heikal <[email protected]>
Commit-Queue: Andrew Grieve <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1422249}
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
index 1d805a4..6b518b66 100644
--- a/android_webview/BUILD.gn
+++ b/android_webview/BUILD.gn
@@ -31,40 +31,38 @@
assert(!is_cronet_build)
-if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
- assert(current_toolchain != android_secondary_abi_toolchain)
-}
-
if (enable_resource_allowlist_generation) {
system_webview_pak_allowlist =
"$target_gen_dir/system_webview_pak_allowlist.txt"
}
-if (android_64bit_target_cpu) {
- _main_trichrome_library_provider =
- "//chrome/android:trichrome_library_32_64_apk"
- _main_trichrome_webview_apk_target = "trichrome_webview_32_64_apk"
- _main_trichrome_webview_bundle_target = "trichrome_webview_32_64_bundle"
- _main_trichrome_webview_base_bundle_module_target =
- "trichrome_webview_32_64_base_bundle_module"
- _main_system_webview_apk_target = "system_webview_32_64_apk"
- _main_system_webview_bundle_target = "system_webview_32_64_bundle"
- _main_system_webview_base_bundle_module_target =
- "system_webview_32_64_base_bundle_module"
+if (!android_64bit_target_cpu) {
+ _default_arch_tokens = ""
+} else if (defined(android_app_secondary_abi)) {
+ _default_arch_tokens = "_32_64"
+} else {
+ _default_arch_tokens = "_64"
+}
+_main_trichrome_library_provider =
+ "//chrome/android:trichrome_library${_default_arch_tokens}_apk"
+_main_trichrome_webview_apk_target =
+ "trichrome_webview${_default_arch_tokens}_apk"
+_main_trichrome_webview_bundle_target =
+ "trichrome_webview${_default_arch_tokens}_bundle"
+_main_trichrome_webview_base_bundle_module_target =
+ "trichrome_webview${_default_arch_tokens}_base_bundle_module"
+_main_system_webview_apk_target = "system_webview${_default_arch_tokens}_apk"
+_main_system_webview_bundle_target =
+ "system_webview${_default_arch_tokens}_bundle"
+_main_system_webview_base_bundle_module_target =
+ "system_webview${_default_arch_tokens}_base_bundle_module"
+
+if (android_64bit_target_cpu) {
# We are assuming that all webview targets have the same Java - if this
# is no longer true, we should add more targets to this array.
webview_java_for_jni_targets = [ ":system_webview_64_bundle" ]
} else {
- _main_trichrome_library_provider = "//chrome/android:trichrome_library_apk"
- _main_trichrome_webview_apk_target = "trichrome_webview_apk"
- _main_trichrome_webview_bundle_target = "trichrome_webview_bundle"
- _main_trichrome_webview_base_bundle_module_target =
- "trichrome_webview_base_bundle_module"
- _main_system_webview_apk_target = "system_webview_apk"
- _main_system_webview_bundle_target = "system_webview_bundle"
- _main_system_webview_base_bundle_module_target =
- "system_webview_base_bundle_module"
webview_java_for_jni_targets = [ ":system_webview_bundle" ]
}
@@ -75,17 +73,13 @@
}
}
-# Standalone WebView APK.
-if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
- group("system_webview_apk") {
- deps = [ ":system_webview_64_apk" ]
+if (android_64bit_target_cpu) {
+ alias_with_wrapper_script("system_webview_apk") {
+ alias_target = ":$_main_system_webview_apk_target"
}
-} else {
- if (android_64bit_target_cpu) {
- alias_with_wrapper_script("system_webview_apk") {
- alias_target = ":system_webview_32_64_apk"
- }
- }
+}
+
+if (!android_64bit_target_cpu || defined(android_app_secondary_abi)) {
standalone_system_webview_apk_tmpl(_main_system_webview_apk_target) {
apk_name = "SystemWebView"
}
@@ -117,7 +111,7 @@
[ "//third_party/androidx:androidx_recyclerview_recyclerview_java" ]
}
-if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
+if (android_64bit_target_cpu && !defined(android_app_secondary_abi)) {
group("system_webview_bundle") {
deps = [ ":system_webview_64_bundle" ]
}
@@ -166,7 +160,7 @@
bundle_name = "SystemWebView64"
include_32_bit_webview = false
}
- if (!skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
# These targets builds a 32-bit only Webview on a 64-bit config, analogous
# to what's built on a 32-bit config. This lets all Webviews build on a
# single configuration.
@@ -202,7 +196,7 @@
}
}
-if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
+if (android_64bit_target_cpu && !defined(android_app_secondary_abi)) {
group("trichrome_webview_apk") {
deps = [ ":trichrome_webview_64_apk" ]
}
@@ -231,7 +225,7 @@
}
}
-if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
+if (android_64bit_target_cpu && !defined(android_app_secondary_abi)) {
group("trichrome_webview_bundle") {
deps = [ ":trichrome_webview_64_bundle" ]
}
@@ -269,6 +263,7 @@
if (android_64bit_target_cpu) {
system_webview_bundle("trichrome_webview_64_bundle") {
is_trichrome = true
+ include_32_bit_webview = false
base_module_target = ":trichrome_webview_64_base_bundle_module"
bundle_name = "TrichromeWebView64"
static_library_provider = "//chrome/android:trichrome_library_64_apk"
@@ -300,7 +295,7 @@
}
# Trichrome WebView APK for a 64-bit Chrome.
-if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+if (android_64bit_target_cpu && defined(android_app_secondary_abi)) {
template("trichrome_webview_64_32_tmpl") {
trichrome_webview_tmpl(target_name) {
forward_variables_from(invoker, "*")
@@ -446,7 +441,7 @@
}
}
-if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+if (android_64bit_target_cpu && defined(android_app_secondary_abi)) {
# Note here that on a given system, the webview-only library needs the same
# library name as the browser library, since the system webview factory will
# differentiate only by ABI.
@@ -1087,7 +1082,7 @@
]
}
-if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+if (android_64bit_target_cpu && defined(android_app_secondary_abi)) {
java_group("webview_secondary_abi_assets") {
deps = [ "//gin:v8_snapshot_secondary_abi_assets" ]
}
@@ -1105,7 +1100,7 @@
":webview_primary_abi_assets",
"//third_party/icu:icu_assets",
]
- if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
deps += [ ":webview_secondary_abi_assets" ]
}
}
diff --git a/android_webview/system_webview_apk_tmpl.gni b/android_webview/system_webview_apk_tmpl.gni
index 6a48c09a..703e9e1 100644
--- a/android_webview/system_webview_apk_tmpl.gni
+++ b/android_webview/system_webview_apk_tmpl.gni
@@ -29,11 +29,20 @@
"If trichrome library is used, static_library_provider must be set " +
"so that a dep can be added on the library APK.")
- _include_32_bit_webview =
- !defined(invoker.include_32_bit_webview) || invoker.include_32_bit_webview
_include_64_bit_webview =
android_64bit_target_cpu && (!defined(invoker.include_64_bit_webview) ||
invoker.include_64_bit_webview)
+
+ if (defined(invoker.include_32_bit_webview)) {
+ _include_32_bit_webview = invoker.include_32_bit_webview
+ } else {
+ _include_32_bit_webview =
+ !android_64bit_target_cpu || defined(android_app_secondary_abi)
+
+ # Make sure defaults never lead no abi.
+ assert(_include_32_bit_webview || _include_64_bit_webview)
+ }
+
if (_is_trichrome) {
_is_64_bit_browser = android_64bit_target_cpu && invoker.is_64_bit_browser
_version_code = TRICHROME_VERSION_MAP["${android_64bit_target_cpu}_${_is_64_bit_browser}_${_include_64_bit_webview}_${_include_32_bit_webview}"]
diff --git a/android_webview/system_webview_bundle.gni b/android_webview/system_webview_bundle.gni
index ac859e1b2..e5b36ab 100644
--- a/android_webview/system_webview_bundle.gni
+++ b/android_webview/system_webview_bundle.gni
@@ -26,11 +26,17 @@
min_sdk_version = 29
}
system_image_locale_allowlist = platform_pak_locales
- is_multi_abi =
- android_64bit_target_cpu && (!defined(invoker.include_64_bit_webview) ||
- invoker.include_64_bit_webview) &&
- (!defined(invoker.include_32_bit_webview) ||
- invoker.include_32_bit_webview)
+ if (android_64bit_target_cpu) {
+ _include_32_bit_webview = !defined(invoker.include_32_bit_webview) ||
+ invoker.include_32_bit_webview
+ _include_64_bit_webview = !defined(invoker.include_64_bit_webview) ||
+ invoker.include_64_bit_webview
+ is_multi_abi = _include_32_bit_webview && _include_64_bit_webview
+ not_needed([ "_include_64_bit_webview" ])
+ if (!defined(android_app_secondary_abi)) {
+ assert(!is_multi_abi)
+ }
+ }
if (!defined(proguard_android_sdk_dep)) {
proguard_android_sdk_dep = webview_framework_dep
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn
index d254e13..ae0d376 100644
--- a/android_webview/test/BUILD.gn
+++ b/android_webview/test/BUILD.gn
@@ -71,7 +71,7 @@
]
}
- if (!skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
python_library("webview_trichrome_64_32_cts_tests") {
pydeps_file = "//android_webview/tools/run_cts.pydeps"
deps = [ "//android_webview:trichrome_webview_64_32_apk" ]
diff --git a/build/config/android/abi.gni b/build/config/android/abi.gni
index 5e4121ab..87d1cf67 100644
--- a/build/config/android/abi.gni
+++ b/build/config/android/abi.gni
@@ -92,18 +92,20 @@
# target_cpu's that are 32-bit-only or 64-bit-only, as they are not used. The
# presence of this variable may be used in conjunction with android_64bit_target_cpu
# to identify target_cpu's that are 32-bit-only or 64-bit-only.
-if (target_cpu == "arm64") {
- android_secondary_abi_cpu = "arm"
- android_app_secondary_abi = "armeabi-v7a"
-} else if (target_cpu == "x64") {
- android_secondary_abi_cpu = "x86"
- android_app_secondary_abi = "x86"
-} else if (target_cpu == "mips64el") {
- android_secondary_abi_cpu = "mipsel"
- android_app_secondary_abi = "mips"
-}
+if (!skip_secondary_abi_for_cq) {
+ if (target_cpu == "arm64") {
+ android_secondary_abi_cpu = "arm"
+ android_app_secondary_abi = "armeabi-v7a"
+ } else if (target_cpu == "x64") {
+ android_secondary_abi_cpu = "x86"
+ android_app_secondary_abi = "x86"
+ } else if (target_cpu == "mips64el") {
+ android_secondary_abi_cpu = "mipsel"
+ android_app_secondary_abi = "mips"
+ }
-if (defined(android_secondary_abi_cpu)) {
- android_secondary_abi_toolchain =
- "//build/toolchain/android:android_clang_${android_secondary_abi_cpu}"
+ if (defined(android_secondary_abi_cpu)) {
+ android_secondary_abi_toolchain =
+ "//build/toolchain/android:android_clang_${android_secondary_abi_cpu}"
+ }
}
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index 5480b31..13bf3e43 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -111,10 +111,6 @@
assert(android_static_analysis == "on" || android_static_analysis == "off" ||
android_static_analysis == "build_server")
- # This configuration has not bot coverage and has broken multiple times.
- # Warn against it.
- assert(!(enable_chrome_android_internal && skip_secondary_abi_for_cq))
-
if (enable_chrome_android_internal) {
import("//clank/config.gni")
} else {
@@ -286,12 +282,10 @@
enable_startup_profiles = false
# The target to use as the system WebView implementation.
- if (android_64bit_target_cpu) {
- if (skip_secondary_abi_for_cq) {
- system_webview_apk_target = "//android_webview:system_webview_64_apk"
- } else {
- system_webview_apk_target = "//android_webview:system_webview_32_64_apk"
- }
+ if (defined(android_app_secondary_abi)) {
+ system_webview_apk_target = "//android_webview:system_webview_32_64_apk"
+ } else if (android_64bit_target_cpu) {
+ system_webview_apk_target = "//android_webview:system_webview_64_apk"
} else {
system_webview_apk_target = "//android_webview:system_webview_apk"
}
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 8a245c3..3b64016 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -45,12 +45,8 @@
assert(!is_cronet_build)
assert(enable_supervised_users)
-if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
- assert(current_toolchain != android_secondary_abi_toolchain)
-}
-
# 32-bit library will have browser code in it. 64-bit is webview-only.
-if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+if (defined(android_app_secondary_abi)) {
_monochrome_browser_toolchain = android_secondary_abi_toolchain
} else {
_monochrome_browser_toolchain = default_toolchain
@@ -1948,7 +1944,7 @@
chrome_public_apk_or_module_tmpl("chrome_public_apk") {
target_type = "android_apk"
apk_name = "ChromePublic"
- if (android_64bit_target_cpu) {
+ if (defined(android_app_secondary_abi)) {
# Ensure 64-bit chrome does not depend on 32-bit things.
assert_no_deps =
[ "//build/config:toolchain_marker_" +
@@ -2113,7 +2109,7 @@
resources_package = "org.chromium.chrome.base"
}
- if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
+ if (android_64bit_target_cpu && !defined(android_app_secondary_abi)) {
group("trichrome_library_apk") {
deps = [ ":trichrome_library_64_apk" ]
}
@@ -2189,7 +2185,7 @@
}
}
- if (!skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
trichrome_library_apk_tmpl("trichrome_library_32_apk") {
apk_name = "TrichromeLibrary32"
is_64_bit_browser = false
@@ -2447,7 +2443,7 @@
# Public webview targets don't work with non-public sdks.
# https://crbug.com/1000763
instrumentation_test_runner("monochrome_public_smoke_test") {
- if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
+ if (android_64bit_target_cpu && !defined(android_app_secondary_abi)) {
apk_under_test = ":monochrome_64_public_apk"
if (!is_java_debug) {
proguard_mapping_path =
@@ -2509,7 +2505,7 @@
instrumentation_test_runner("monochrome_public_bundle_smoke_test") {
if (android_64bit_target_cpu) {
- if (skip_secondary_abi_for_cq) {
+ if (!defined(android_app_secondary_abi)) {
apk_under_test = "//chrome/android:monochrome_64_public_bundle_apks"
if (!is_java_debug) {
proguard_mapping_path =
@@ -2537,7 +2533,7 @@
_verify_32bit_static_initializers =
defined(expected_static_initializer_32bit_count) &&
- !skip_secondary_abi_for_cq
+ defined(android_app_secondary_abi)
_verify_64bit_static_initializers =
defined(expected_static_initializer_64bit_count) &&
android_64bit_target_cpu
@@ -2602,7 +2598,7 @@
modules = [ "test_dummy" ]
extra_args = _bundle_smoke_test_extra_args
if (android_64bit_target_cpu) {
- if (skip_secondary_abi_for_cq) {
+ if (!defined(android_app_secondary_abi)) {
apk_under_test = "//chrome/android:trichrome_chrome_64_bundle_apks"
additional_apks = [ "//chrome/android:trichrome_library_64_apk" ]
if (!is_java_debug) {
@@ -2689,7 +2685,7 @@
}
}
- if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
+ if (android_64bit_target_cpu && !defined(android_app_secondary_abi)) {
group("monochrome_public_bundle") {
deps = [ ":monochrome_64_public_bundle" ]
}
@@ -2761,7 +2757,7 @@
}
# Used for binary size monitoring things:
- if (is_official_build && !skip_secondary_abi_for_cq) {
+ if (is_official_build && defined(android_app_secondary_abi)) {
_trichrome_library_basename = "TrichromeLibrary.apk"
_trichrome_chrome_basename = "TrichromeChrome.minimal.apks"
_trichrome_chrome_bundle = "TrichromeChrome.aab"
@@ -2865,7 +2861,7 @@
data_deps = [ ":trichrome_32_minimal_apks" ]
}
- if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
android_size_bot_config("resource_size_config_trichrome") {
name = "Trichrome"
mapping_files = [
@@ -2941,7 +2937,7 @@
}
}
- if (!skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
chrome_public_bundle("monochrome_32_public_bundle") {
is_monochrome = true
bundle_name = "MonochromePublic32"
@@ -3423,7 +3419,7 @@
collect_inputs_only = true
}
- if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
group("monochrome_64_secondary_abi_lib") {
public_deps = [ ":libmonochrome_64($android_secondary_abi_toolchain)" ]
}
@@ -3436,7 +3432,7 @@
}
# 32-bit browser library alias targets, pulled in by 64-bit WebView builds.
- if (!skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
group("monochrome_secondary_abi_lib") {
public_deps = [ ":libmonochrome($android_secondary_abi_toolchain)" ]
}
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni
index b1ab5a7b..44d95c9 100644
--- a/chrome/android/chrome_public_apk_tmpl.gni
+++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -151,7 +151,7 @@
invoker.include_32_bit_webview
_include_primary_abi = !android_64bit_target_cpu || _is_64_bit_browser ||
_include_64_bit_webview
- _include_secondary_abi = android_64bit_target_cpu &&
+ _include_secondary_abi = defined(android_app_secondary_abi) &&
(!_is_64_bit_browser || _include_32_bit_webview)
if (_include_secondary_abi) {
_secondary_out_dir =
diff --git a/chrome/android/modules/stack_unwinder/stack_unwinder_module.gni b/chrome/android/modules/stack_unwinder/stack_unwinder_module.gni
index 2e0f7fbc..9ee40c9e 100644
--- a/chrome/android/modules/stack_unwinder/stack_unwinder_module.gni
+++ b/chrome/android/modules/stack_unwinder/stack_unwinder_module.gni
@@ -8,7 +8,7 @@
# not enabled on non-official builds to not affect build time for developers.
# The unwind file is ~2MB in apk, which is fine for Canary.
add_unwind_tables_in_chrome_32bit_apk =
- !skip_secondary_abi_for_cq && is_official_build &&
+ defined(android_app_secondary_abi) && is_official_build &&
(target_cpu == "arm" || target_cpu == "arm64") &&
(android_channel == "default" || android_channel == "beta" ||
android_channel == "canary" || android_channel == "dev")
diff --git a/gin/BUILD.gn b/gin/BUILD.gn
index 3a5e7d1..f01c47b 100644
--- a/gin/BUILD.gn
+++ b/gin/BUILD.gn
@@ -154,7 +154,7 @@
}
}
- if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
android_assets("v8_snapshot_secondary_abi_assets") {
# only import asset when v8_use_external_startup_data == true
# like "v8_snapshot_assets" above
diff --git a/tools/perf/chrome_telemetry_build/BUILD.gn b/tools/perf/chrome_telemetry_build/BUILD.gn
index 7b28151..82017ed 100644
--- a/tools/perf/chrome_telemetry_build/BUILD.gn
+++ b/tools/perf/chrome_telemetry_build/BUILD.gn
@@ -111,9 +111,12 @@
if (is_android) {
_bitness_if_needed = ""
_webview_bitness_if_needed = ""
- if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
+ if (defined(android_app_secondary_abi)) {
_bitness_if_needed = "_64_32"
_webview_bitness_if_needed = "_32_64"
+ } else if (android_64bit_target_cpu) {
+ _bitness_if_needed = "_64"
+ _webview_bitness_if_needed = "_64"
}
group("telemetry_chrome_test_android_chrome") {
testonly = true
@@ -162,7 +165,7 @@
]
}
- if (android_64bit_target_cpu) {
+ if (defined(android_app_secondary_abi)) {
group("telemetry_chrome_test_android_trichrome_chrome_64_32_bundle") {
testonly = true
diff --git a/tools/perf/chrome_telemetry_build/android_browser_types.gni b/tools/perf/chrome_telemetry_build/android_browser_types.gni
index 6810b596b..48714ea8 100644
--- a/tools/perf/chrome_telemetry_build/android_browser_types.gni
+++ b/tools/perf/chrome_telemetry_build/android_browser_types.gni
@@ -16,7 +16,7 @@
"_android_trichrome_chrome_bundle",
]
-if (android_64bit_target_cpu) {
+if (defined(android_app_secondary_abi)) {
telemetry_android_browser_target_suffixes +=
[ "_android_trichrome_chrome_64_32_bundle" ]
}
diff --git a/tools/pgo/BUILD.gn b/tools/pgo/BUILD.gn
index e4c60efa9..5581186 100644
--- a/tools/pgo/BUILD.gn
+++ b/tools/pgo/BUILD.gn
@@ -54,7 +54,7 @@
suffix = "_android_trichrome_chrome_bundle"
}
-if (android_64bit_target_cpu) {
+if (defined(android_app_secondary_abi)) {
generate_profile_test(
"generate_profile_android_trichrome_chrome_64_32_bundle") {
browser_name = "android-trichrome-chrome-64-32-bundle"