chromium/android_webview/system_webview_bundle.gni

# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//components/crash/android/silent_java_assert_reporting.gni")
import("//device/vr/buildflags/buildflags.gni")

template("system_webview_bundle") {
  _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome

  assert(_is_trichrome == defined(invoker.static_library_provider))

  android_app_bundle(target_name) {
    command_line_flags_file = "webview-command-line"
    if (!is_java_debug) {
      proguard_enabled = true
      repackage_classes = "WV"
    }
    enable_language_splits = true
    if (_is_trichrome) {
      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 (!defined(proguard_android_sdk_dep)) {
      proguard_android_sdk_dep = webview_framework_dep
    }

    if (enable_silent_java_assert_reporting) {
      custom_assertion_handler = crash_reporting_assertion_handler
    }

    # For this to be respected, it must also be set on the base module target.
    strip_unused_resources = is_official_build

    forward_variables_from(invoker, "*")
  }
}