910e62b5创建于 1月15日历史提交
# 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"
    }

    # TODO(crbug.com/41486995): Set this back to true once split translations
    # are working again.
    enable_language_splits = false
    system_image_locale_allowlist = platform_pak_locales
    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, "target should not be enabled: $target_name")
      }
    }

    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, "*")
  }
}