diff options
Diffstat (limited to 'chromium/android_webview/BUILD.gn')
-rw-r--r-- | chromium/android_webview/BUILD.gn | 164 |
1 files changed, 99 insertions, 65 deletions
diff --git a/chromium/android_webview/BUILD.gn b/chromium/android_webview/BUILD.gn index 5d31c91f68e..455910c1d10 100644 --- a/chromium/android_webview/BUILD.gn +++ b/chromium/android_webview/BUILD.gn @@ -24,6 +24,13 @@ if (enable_resource_whitelist_generation) { "$target_gen_dir/system_webview_pak_whitelist.txt" } +# Having //clank present causes different flags because of how play services +# is wired up. +# The channel is required because manifest entries vary based on channel. +_verify_android_configuration = + !is_java_debug && !enable_chrome_android_internal && + android_channel == "stable" + template("standalone_system_webview_apk_tmpl") { system_webview_apk_or_module_tmpl(target_name) { forward_variables_from(invoker, "*") @@ -32,27 +39,12 @@ template("standalone_system_webview_apk_tmpl") { "//android_webview/nonembedded:system_webview_manifest" deps = upstream_only_webview_deps min_sdk_version = 21 - - # Material design is a large dependency that pulls in a lot of res/ files. - # At time of this comment, adding this dep even when unused adds 220kb. - assert_no_deps = [ - "//third_party/android_deps:com_google_android_material_material_java", - ] } } # Standalone WebView APK. standalone_system_webview_apk_tmpl("system_webview_apk") { apk_name = "SystemWebView" - - # Having //clank present causes different flags because of how play services - # is wired up. - # The channel is required because manifest entries vary based on channel. - _verify_android_configuration = - !enable_chrome_android_internal && android_channel == "stable" - if (_verify_android_configuration) { - verify_manifest = true - } } # This version of the WebView APK doesn't include WebLayer java and resources. @@ -67,6 +59,11 @@ if (enable_webview_bundles) { standalone_system_webview_apk_tmpl("system_webview_base_bundle_module") { target_type = "android_app_bundle_module" is_base_module = true + + if (_verify_android_configuration) { + expected_android_manifest = + "expectations/system_webview_bundle.AndroidManifest.expected" + } } system_webview_bundle("system_webview_bundle") { @@ -75,6 +72,19 @@ if (enable_webview_bundles) { min_sdk_version = 21 compress_shared_libraries = true } + + if (is_official_build) { + # Used for binary size monitoring. + create_app_bundle_minimal_apks("system_webview_minimal_apks") { + deps = [ ":system_webview_bundle" ] + bundle_path = "$root_build_dir/apks/SystemWebView.aab" + } + + android_resource_sizes_test("resource_sizes_system_webview_bundle") { + file_path = "$root_build_dir/apks/SystemWebView.minimal.apks" + data_deps = [ ":system_webview_minimal_apks" ] + } + } } if (android_64bit_target_cpu) { @@ -103,11 +113,6 @@ if (android_64bit_target_cpu) { } } -android_resource_sizes_test("resource_sizes_system_webview_apk") { - apk_name = "SystemWebView" - data_deps = [ ":system_webview_apk" ] -} - # Trichrome WebView APK. template("trichrome_webview_tmpl") { system_webview_apk_or_module_tmpl(target_name) { @@ -134,21 +139,17 @@ trichrome_webview_tmpl("trichrome_webview_apk") { if (!is_java_debug) { static_library_synchronized_proguard = trichrome_synchronized_proguard } - - # Having //clank present causes different flags because of how play services - # is wired up. - # The channel is required because manifest entries vary based on channel. - _verify_android_configuration = - !enable_chrome_android_internal && android_channel == "stable" - if (_verify_android_configuration) { - verify_manifest = true - } } if (enable_webview_bundles) { trichrome_webview_tmpl("trichrome_webview_base_bundle_module") { target_type = "android_app_bundle_module" is_base_module = true + + if (_verify_android_configuration) { + expected_android_manifest = + "expectations/trichrome_webview_bundle.AndroidManifest.expected" + } } system_webview_bundle("trichrome_webview_bundle") { @@ -158,6 +159,19 @@ if (enable_webview_bundles) { min_sdk_version = 29 static_library_provider = "//chrome/android:trichrome_library_apk" } + + if (is_official_build) { + # Used for binary size monitoring. + create_app_bundle_minimal_apks("trichrome_webview_minimal_apks") { + deps = [ ":trichrome_webview_bundle" ] + bundle_path = "$root_build_dir/apks/TrichromeWebView.aab" + } + + android_resource_sizes_test("resource_sizes_trichrome_webview_bundle") { + file_path = "$root_build_dir/apks/TrichromeWebView.minimal.apks" + data_deps = [ ":trichrome_webview_minimal_apks" ] + } + } } # Trichrome WebView APK for a 64-bit Chrome. @@ -238,15 +252,21 @@ if (android_64bit_target_cpu) { } # The shared library used by standalone WebView. -shared_library("libwebviewchromium") { - deps = [ - "//android_webview/lib", - "//android_webview/lib:webview_entry_point", - "//android_webview/nonembedded", - "//third_party/blink/public:blink", - ] - configs -= [ "//build/config/android:hide_all_but_jni_onload" ] - configs += [ "//build/config/android:hide_all_but_jni" ] +template("libwebviewchromium_tmpl") { + shared_library(target_name) { + forward_variables_from(invoker, "*") + deps = [ + "//android_webview/lib", + "//android_webview/lib:webview_entry_point", + "//android_webview/nonembedded", + "//third_party/blink/public:blink", + ] + configs -= [ "//build/config/android:hide_all_but_jni_onload" ] + configs += [ "//build/config/android:hide_all_but_jni" ] + } +} + +libwebviewchromium_tmpl("libwebviewchromium") { } # This template is used to define WebView's alternate-ABI libraries, which are @@ -300,7 +320,7 @@ java_group("android_webview_no_weblayer_java") { # here because there's currently no good way to enforce that it gets included # when it's depended on via JNI. ":common_java", - "//android_webview/glue", + "//android_webview/glue:glue_java", "//android_webview/nonembedded:nonembedded_java", "//android_webview/support_library:support_lib_glue_java", ] @@ -311,10 +331,7 @@ java_group("android_webview_java") { deps = [ ":android_webview_no_weblayer_java" ] if (webview_includes_weblayer) { - deps += [ - "//components/viz/service:service_java", - "//weblayer/browser/java", - ] + deps += [ "//weblayer/browser/java" ] } } @@ -355,13 +372,13 @@ generate_jni("browser_jni_headers") { "java/src/org/chromium/android_webview/AwRenderProcess.java", "java/src/org/chromium/android_webview/AwSettings.java", "java/src/org/chromium/android_webview/AwTracingController.java", - "java/src/org/chromium/android_webview/AwVariationsSeedBridge.java", "java/src/org/chromium/android_webview/AwWebContentsDelegate.java", "java/src/org/chromium/android_webview/AwWebResourceInterceptResponse.java", "java/src/org/chromium/android_webview/AwWebResourceResponse.java", "java/src/org/chromium/android_webview/InputStreamUtil.java", "java/src/org/chromium/android_webview/JsReplyProxy.java", "java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java", + "java/src/org/chromium/android_webview/VariationsSeedLoader.java", "java/src/org/chromium/android_webview/WebMessageListenerHolder.java", "java/src/org/chromium/android_webview/WebMessageListenerInfo.java", "java/src/org/chromium/android_webview/gfx/AwDrawFnImpl.java", @@ -402,7 +419,6 @@ android_library("browser_java") { "java/src/org/chromium/android_webview/AwDebug.java", "java/src/org/chromium/android_webview/AwDevToolsServer.java", "java/src/org/chromium/android_webview/AwFeatureList.java", - "java/src/org/chromium/android_webview/AwFeatures.java", "java/src/org/chromium/android_webview/AwFormDatabase.java", "java/src/org/chromium/android_webview/AwGeolocationPermissions.java", "java/src/org/chromium/android_webview/AwHistogramRecorder.java", @@ -424,7 +440,6 @@ android_library("browser_java") { "java/src/org/chromium/android_webview/AwSupportLibIsomorphic.java", "java/src/org/chromium/android_webview/AwThreadUtils.java", "java/src/org/chromium/android_webview/AwTracingController.java", - "java/src/org/chromium/android_webview/AwVariationsSeedBridge.java", "java/src/org/chromium/android_webview/AwViewAndroidDelegate.java", "java/src/org/chromium/android_webview/AwViewMethods.java", "java/src/org/chromium/android_webview/AwWebContentsDelegate.java", @@ -464,6 +479,7 @@ android_library("browser_java") { "java/src/org/chromium/android_webview/gfx/JavaBrowserViewRendererHelper.java", "java/src/org/chromium/android_webview/gfx/RootBeginFrameSourceWebView.java", "java/src/org/chromium/android_webview/metrics/AwMetricsServiceClient.java", + "java/src/org/chromium/android_webview/metrics/AwNonembeddedUmaReplayer.java", "java/src/org/chromium/android_webview/permission/AwGeolocationCallback.java", "java/src/org/chromium/android_webview/permission/AwPermissionRequest.java", "java/src/org/chromium/android_webview/policy/AwPolicyProvider.java", @@ -475,15 +491,15 @@ android_library("browser_java") { ":common_aidl_java", ":common_crash_java", ":common_java", - ":common_metrics_java", ":common_platform_services_java", ":common_variations_java", ":resources", "//android_webview/nonembedded:system_webview_manifest", + "//android_webview/proto:metrics_bridge_records_proto_java", "//base:base_java", "//base:jni_java", "//components/autofill/android:autofill_java", - "//components/autofill/android:provider_java", + "//components/autofill/android/provider:java", "//components/background_task_scheduler:background_task_scheduler_task_ids_java", "//components/content_capture/android:java", "//components/crash/android:handler_java", @@ -499,6 +515,7 @@ android_library("browser_java") { "//components/variations/android:variations_java", "//components/version_info/android:version_constants_java", "//components/viz/common:common_java", + "//components/viz/service:service_java", "//content/public/android:content_java", "//device/gamepad:java", "//mojo/public/java:system_java", @@ -506,6 +523,7 @@ android_library("browser_java") { "//net/android:net_java", "//services/network/public/mojom:mojom_java", "//third_party/android_deps:androidx_annotation_annotation_java", + "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java", "//third_party/blink/public:blink_headers_java", "//ui/android:ui_java", "//url:gurl_java", @@ -522,20 +540,6 @@ android_library("browser_java") { ] } -android_library("common_metrics_java") { - sources = [ - "java/src/org/chromium/android_webview/common/metrics/AwNonembeddedUmaRecorder.java", - "java/src/org/chromium/android_webview/common/metrics/AwNonembeddedUmaReplayer.java", - ] - deps = [ - ":common_aidl_java", - ":common_java", - "//android_webview/proto:metrics_bridge_records_proto_java", - "//base:base_java", - "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java", - ] -} - android_library("common_variations_java") { sources = [ "java/src/org/chromium/android_webview/common/variations/VariationsServiceMetricsHelper.java", @@ -596,6 +600,7 @@ android_library("common_crash_java") { android_library("common_java") { sources = [ + "java/src/org/chromium/android_webview/common/AwFeatures.java", "java/src/org/chromium/android_webview/common/AwResource.java", "java/src/org/chromium/android_webview/common/AwSwitches.java", "java/src/org/chromium/android_webview/common/CommandLineUtil.java", @@ -644,10 +649,12 @@ android_library("android_webview_product_config_java") { } if (enable_resource_whitelist_generation) { + libwebviewchromium_tmpl("system_webview_pak_whitelist_inputs") { + ldflags = [ "--collect-inputs-only" ] + } generate_resource_whitelist("system_webview_pak_whitelist") { - deps = [ ":libwebviewchromium" ] - inputs = - [ "$root_out_dir/lib.unstripped/libwebviewchromium$shlib_extension" ] + deps = [ ":system_webview_pak_whitelist_inputs" ] + inputs = [ "$root_out_dir/lib.unstripped/libsystem_webview_pak_whitelist_inputs$shlib_extension" ] output = system_webview_pak_whitelist } } @@ -723,6 +730,10 @@ repack("repack_100_percent") { repack_whitelist = system_webview_pak_whitelist deps += [ ":system_webview_pak_whitelist" ] } + if (webview_includes_weblayer) { + sources += [ "$target_gen_dir/components_resources_100_percent.pak" ] + deps += [ ":generate_components_scaled_resources" ] + } } android_assets("pak_file_assets") { @@ -926,6 +937,29 @@ grit("generate_components_resources") { ] } +grit("generate_components_scaled_resources") { + source = "../components/resources/components_scaled_resources.grd" + + # See :generate_webui_resources for an explanation of the allowlist + _allowlist = rebase_path("$target_gen_dir/grit_resources_allowlist.txt", + root_build_dir) + + grit_flags = [ + "-w", + _allowlist, + ] + outputs = [ + "grit/components_scaled_resources.h", + "grit/components_scaled_resources_map.cc", + "grit/components_scaled_resources_map.h", + "components_resources_100_percent.pak", + "components_resources_200_percent.pak", + "components_resources_300_percent.pak", + ] + + deps = [ ":concatenate_resources_allowlists" ] +} + grit("generate_components_strings") { source = "../components/components_strings.grd" |