blob: 804b2f9de9e5f33b46acb9f58a5f6c231ef2d064 [file] [log] [blame]
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//base/android/proguard/proguard.gni")
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//build/util/version.gni")
import("//chrome/android/trichrome.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
template("system_webview_apk_tmpl") {
android_apk(target_name) {
forward_variables_from(invoker, "*")
deps += [
"//android_webview:license_assets",
"//android_webview:locale_pak_assets",
"//android_webview:pak_file_assets",
"//android_webview/apk:webview_license_activity_java",
"//android_webview/apk:webview_license_provider_java",
"//android_webview/glue",
"//android_webview/support_library:support_lib_glue_java",
"//base:base_java",
]
if (!defined(alternative_android_sdk_dep)) {
alternative_android_sdk_dep = webview_framework_dep
}
_use_trichrome_library =
defined(use_trichrome_library) && use_trichrome_library
if (!_use_trichrome_library || !trichrome_shared_assets) {
deps += [ "//android_webview:monochrome_webview_assets" ]
}
if (!_use_trichrome_library) {
shared_libraries = [ "//android_webview:libwebviewchromium" ]
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
loadable_modules = [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
if (build_apk_secondary_abi && android_64bit_target_cpu) {
secondary_abi_shared_libraries = [ "//android_webview:libwebviewchromium($android_secondary_abi_toolchain)" ]
_trampoline = "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline($android_secondary_abi_toolchain)"
deps += [ _trampoline ]
_secondary_out_dir = get_label_info(_trampoline, "root_out_dir")
secondary_abi_loadable_modules =
[ "$_secondary_out_dir/libcrashpad_handler_trampoline.so" ]
}
shared_resources = true
} else {
uncompress_shared_libraries = true
app_as_shared_lib = true
if (trichrome_synchronized_proguard) {
emit_resource_ids = true
}
# Include placeholder libraries to ensure we are treated as the desired
# architecture.
if (android_64bit_target_cpu) {
shared_libraries = [ "//android_webview:monochrome" ]
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
loadable_modules = [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
if (build_apk_secondary_abi) {
secondary_native_lib_placeholders = [ "libdummy.so" ]
if (use_v8_context_snapshot) {
deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ]
} else {
deps += [ "//v8:v8_external_startup_data_assets" ]
}
}
} else {
native_lib_placeholders = [ "libdummy.so" ]
}
}
if (!_use_trichrome_library || android_64bit_target_cpu) {
# 32-bit TrichromeWebView doesn't have a native library, so only do this
# for other configs.
native_lib_version_rule = "//build/util:chrome_version_json"
_native_lib_file =
rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
}
aapt_locale_whitelist = locales
resource_blacklist_regex = "[/-]xxxhdpi[/-]"
# Exception rationale in https://crbug.com/691733.
resource_blacklist_exceptions = [
"*shadow*", # Combination of gradient & transparency cause pixelation.
"*.9.*", # Most nine-patches contain shadows.
]
# Used as an additional apk in test scripts.
never_incremental = true
if (!is_java_debug) {
proguard_enabled = true
if (!defined(proguard_configs)) {
proguard_configs = []
}
proguard_configs += [
"//android_webview/apk/java/proguard.flags",
"//base/android/proguard/chromium_apk.flags",
"//base/android/proguard/chromium_code.flags",
]
if (enable_proguard_obfuscation) {
proguard_configs +=
[ "//base/android/proguard/enable_obfuscation.flags" ]
} else {
proguard_configs +=
[ "//base/android/proguard/disable_all_obfuscation.flags" ]
}
png_to_webp = true
}
command_line_flags_file = "webview-command-line"
if (!defined(version_code)) {
if (_use_trichrome_library) {
version_code = trichrome_version_code
} else if (android_channel == "dev") {
version_code = webview_dev_version_code
} else if (android_channel == "beta") {
version_code = webview_beta_version_code
} else {
version_code = webview_stable_version_code
}
}
if (!defined(version_name)) {
version_name = chrome_version_name
}
}
}