Commit 627a3616 authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

Revert "Trichrome: Remove webview deps from trichrome_chrome_apk."

This reverts commit 9b5e9e3c.

Reason for revert: https://crbug.com/935964

Original change's description:
> Trichrome: Remove webview deps from trichrome_chrome_apk.
> 
> These were pulled in because trichrome uses monochrome
> templates. Since Trichrome still shares the same native library
> logic with monochrome it makes sense to continue using monochrome
> templates, but using a variable |is_trichrome| to differentiate
> trichrome from monochrome.
> 
> This CL removes Java deps, some Java resource deps, and webview's
> locale pak files from TrichromeChrome.apk.
> 
> Validated CL changes by:
>   * Building the 3 trichrome apks and their downstream variants
>   * Installing/launching TrichromeChrome.apk
>   * Manually inspecting the .build_config and "unzip -l" changes
> 
>       |     old (c)|     new (c)|    diff (c)|
>  total|    24.8 MiB|    23.6 MiB|    -1.2 MiB|
>    dex|     6.8 MiB|     6.4 MiB|  -392.1 KiB|
>   arsc|     4.9 MiB|     4.8 MiB|  -101.8 KiB|
>    xml|   344.9 KiB|   344.9 KiB|        -6 B|
>    res|   912.3 KiB|   908.2 KiB|    -4.1 KiB|
> native|   254.6 KiB|   254.6 KiB|        +0 B|
>  asset|    11.1 MiB|    10.4 MiB|  -698.0 KiB|
>   misc|   145.3 KiB|   142.4 KiB|    -2.9 KiB|
> 
> Bug: 932253
> Change-Id: Iedb427aa5ec05ad3bc905ac61b23f615349d579e
> Reviewed-on: https://chromium-review.googlesource.com/c/1481019
> Commit-Queue: Eric Stevenson <estevenson@chromium.org>
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#634385}

TBR=torne@chromium.org,agrieve@chromium.org,estevenson@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 932253, 935964
Change-Id: Ib96734d9bba049b72735f0fffd0ac31d4aea914b
Reviewed-on: https://chromium-review.googlesource.com/c/1490493Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635819}
parent 4ff15302
......@@ -1074,17 +1074,12 @@ if (current_toolchain == default_toolchain) {
#
# Variables:
# is_monochrome: If true, generate Monochrome targets rather than Chrome.
# is_trichrome: Optionally generated Trichrome targets that use monochrome
# library targets but don't include webview resources.
# is_bundle: If true, generate resources for bundles rather than APK.
template("resource_packaging") {
_is_monochrome = invoker.is_monochrome
_is_bundle = invoker.is_bundle
_is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome
if (_is_trichrome) {
_type = "trichrome_chrome"
} else if (_is_monochrome) {
if (_is_monochrome) {
_type = "monochrome"
} else {
_type = "chrome"
......@@ -1097,16 +1092,11 @@ if (current_toolchain == default_toolchain) {
_variant = "${_type}_${_output_type}"
if (enable_resource_whitelist_generation) {
if (_is_trichrome || _is_monochrome) {
_lib = "monochrome"
} else {
_lib = "chrome"
}
_resource_whitelist_target = "${_variant}_resource_whitelist"
_resource_whitelist_file =
"$target_gen_dir/${_variant}_resource_whitelist.txt"
if (_is_trichrome || _is_monochrome) {
if (_is_monochrome) {
_target_prefix = ""
} else {
_target_prefix = "lib"
......@@ -1116,8 +1106,8 @@ if (current_toolchain == default_toolchain) {
} else {
_suffix = ""
}
_lib_path = "/lib.unstripped/lib" + _lib + _suffix + shlib_extension
_lib_target = _target_prefix + _lib + _suffix
_lib_path = "/lib.unstripped/lib" + _type + _suffix + shlib_extension
_lib_target = _target_prefix + _type + _suffix
generate_resource_whitelist(_resource_whitelist_target) {
_fat_lib_toolchain = ""
......@@ -1276,11 +1266,6 @@ if (current_toolchain == default_toolchain) {
is_monochrome = true
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") {
is_monochrome = false
is_bundle = true
......@@ -1567,12 +1552,12 @@ android_library("monochrome_java") {
template("monochrome_public_apk_or_module_tmpl") {
_android_manifest =
"$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
# of manually-instantiated manifests.
jinja_template("${target_name}__android_manifest") {
_is_trichrome =
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
includes = [ "java/AndroidManifest.xml" ]
variables = chrome_public_jinja_variables
if (_is_trichrome) {
......@@ -1623,7 +1608,7 @@ template("monochrome_public_apk_or_module_tmpl") {
android_manifest = _android_manifest
android_manifest_dep = ":${target_name}__android_manifest"
if (public_android_sdk && !_is_trichrome) {
if (public_android_sdk) {
# Resource whitelist used when generating R.java files and causes
# only the webview subset of resources to be marked as non-final.
shared_resources_whitelist_target = "//android_webview:system_webview_apk"
......@@ -1634,18 +1619,16 @@ template("monochrome_public_apk_or_module_tmpl") {
}
deps = [
":monochrome_java",
"//android_webview:platform_service_bridge_upstream_implementation_java",
"//base:base_java",
"//chrome/android:app_hooks_java",
"//chrome/android:chrome_java",
]
if (!_is_trichrome) {
deps += [
":monochrome_java",
"//android_webview:platform_service_bridge_upstream_implementation_java",
]
}
add_unwind_tables_in_apk =
_add_unwind_tables_in_chrome_public_apk && !_is_trichrome
_add_unwind_tables_in_chrome_public_apk &&
(!defined(use_trichrome_library) || !use_trichrome_library)
version_name = chrome_version_name
}
......
......@@ -53,10 +53,6 @@ default_chrome_public_jinja_variables = [
# final APK or bundle.
# is_modern: If true, indicates this corresponds to a chrome_modern_XXX
# 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.
# requires Android K+, since these were not supported by Android properly
# before 4.3.0.
......@@ -64,6 +60,7 @@ default_chrome_public_jinja_variables = [
# directly from the APK (and stored zipaligned and uncompressed). This
# requires either the Chromium linker, or Android M+.
# 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
# android_app_bundle_module(), depending on the target type.
......@@ -75,9 +72,6 @@ template("chrome_public_common_apk_or_module_tmpl") {
invoker.target_type == "android_app_bundle_module" ||
invoker.target_type == "instrumentation_test_apk",
"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
# is not part of generic apk assets target since it depends on the main shared
......@@ -105,8 +99,10 @@ template("chrome_public_common_apk_or_module_tmpl") {
assert(_is_modern || !_is_modern) # Mark as used.
_is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome
_is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome
assert(_is_trichrome || !_is_trichrome) # Mark as used.
_use_trichrome_library =
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
assert(_use_trichrome_library || !_use_trichrome_library) # Mark as used.
if (defined(invoker.enable_multidex)) {
_enable_multidex = invoker.enable_multidex
......@@ -152,7 +148,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
}
}
if (!_is_monochrome && !_is_trichrome) {
if (!_is_monochrome) {
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_named_as_so",
]
......@@ -244,7 +240,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
}
if (!defined(version_code)) {
if (_is_trichrome) {
if (_use_trichrome_library) {
version_code = trichrome_version_code
} else if (_is_monochrome) {
version_code = monochrome_version_code
......@@ -259,12 +255,7 @@ template("chrome_public_common_apk_or_module_tmpl") {
}
# The equivalent of chrome_common_apk_or_module_tmpl for all builds of
# 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.
# monochrome.
template("monochrome_public_common_apk_or_module_tmpl") {
if (defined(invoker.enable_multidex)) {
_enable_multidex = invoker.enable_multidex
......@@ -272,11 +263,11 @@ template("monochrome_public_common_apk_or_module_tmpl") {
_enable_multidex = is_java_debug || multidex_in_release
}
chrome_public_common_apk_or_module_tmpl(target_name) {
is_trichrome =
is_monochrome = true
use_trichrome_library =
defined(invoker.use_trichrome_library) && invoker.use_trichrome_library
is_monochrome = !is_trichrome
if (!is_trichrome) {
if (!use_trichrome_library) {
if (invoker.target_type == "android_app_bundle_module") {
_suffix = bundle_library_suffix
} else {
......@@ -315,15 +306,10 @@ template("monochrome_public_common_apk_or_module_tmpl") {
}
}
if (is_monochrome) {
alternative_android_sdk_dep = webview_framework_dep
app_as_shared_lib = true
min_sdk_version = 24
}
if (is_trichrome) {
min_sdk_version = 28
}
alternative_android_sdk_dep = webview_framework_dep
app_as_shared_lib = true
use_chromium_linker = false
min_sdk_version = 24
# Resources config for blocklisting resource names from obfuscation
resources_config_path = "//android_webview/aapt2.config"
......@@ -352,28 +338,18 @@ template("monochrome_public_common_apk_or_module_tmpl") {
deps = []
}
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",
]
_pak_prefix = "chrome"
if (is_monochrome) {
deps += [
"//android_webview:monochrome_webview_assets",
"//android_webview/apk:webview_license_activity_java",
"//android_webview/glue",
"//chrome/android:monochrome_java",
"//chrome/android/monochrome:monochrome_license_provider_java",
]
_pak_prefix = "monochrome"
} else if (is_trichrome) {
_pak_prefix = "trichrome_chrome"
}
if (invoker.target_type == "android_app_bundle_module") {
deps += [
"//chrome/android:${_pak_prefix}_${bundle_pak_asset_type}_pak_assets",
]
deps +=
[ "//chrome/android:monochrome_${bundle_pak_asset_type}_pak_assets" ]
} else {
deps += [ "//chrome/android:${_pak_prefix}_apk_pak_assets" ]
deps += [ "//chrome/android:monochrome_apk_pak_assets" ]
}
if (_enable_multidex && invoker.target_type == "android_apk" &&
......@@ -391,9 +367,7 @@ template("monochrome_public_common_apk_or_module_tmpl") {
if (!defined(proguard_configs)) {
proguard_configs = []
}
if (is_monochrome) {
proguard_configs += [ "//android_webview/apk/java/proguard.flags" ]
}
proguard_configs += [ "//android_webview/apk/java/proguard.flags" ]
png_to_webp = true
}
......
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