blob: 5f129007795118160d28a8913bcf9ebf0272afaa [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("//android_webview/variables.gni")
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")
import("//weblayer/variables.gni")
declare_args() {
# Android package name to use when compiling the system_webview_apk and
# trichrome_webview_apk targets. This should be used if the Android build
# on which you are going to install WebView is configured to load a
# different package name than the default used in AOSP.
system_webview_package_name = "com.android.webview"
}
template("system_webview_apk_tmpl") {
android_apk(target_name) {
forward_variables_from(invoker, "*")
deps += [
"//android_webview:locale_pak_assets",
"//android_webview:pak_file_assets",
"//android_webview/glue",
"//android_webview/nonembedded:nonembedded_java",
"//android_webview/support_library:support_lib_glue_java",
"//base:base_java",
]
target_sdk_version = android_sdk_version
product_config_java_packages = [ webview_product_config_java_package ]
if (webview_includes_weblayer) {
deps += [ "//weblayer:locale_pak_assets" ]
product_config_java_packages += [ weblayer_product_config_java_package ]
}
if (!defined(alternative_android_sdk_dep)) {
alternative_android_sdk_dep = webview_framework_dep
}
if (webview_devui_show_icon) {
deps += [ "//android_webview/nonembedded:devui_launcher_icon_resources" ]
}
_use_trichrome_library =
defined(use_trichrome_library) && use_trichrome_library
if (!_use_trichrome_library) {
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
# Include placeholder libraries to ensure we are treated as the desired
# architecture.
if (android_64bit_target_cpu) {
if (defined(is_64_bit_browser) && is_64_bit_browser) {
native_lib_placeholders = [ "libdummy.so" ]
if (build_apk_secondary_abi) {
secondary_abi_shared_libraries = [ "//android_webview:monochrome_64($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" ]
deps += [ "//android_webview:v8_snapshot_secondary_abi_assets" ]
}
} else {
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 if (defined(is_64_bit_browser) && is_64_bit_browser) {
shared_libraries = [ "//android_webview:monochrome_64" ]
deps += [
"//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline",
]
loadable_modules = [ "$root_out_dir/libcrashpad_handler_trampoline.so" ]
} 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
# Match drawables, but not mipmaps.
resource_blacklist_regex = "drawable[^/]*-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/nonembedded/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) {
if (defined(is_64_bit_browser) && is_64_bit_browser) {
version_code = trichrome_64_32_version_code
} else {
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
}
}
}