naiveproxy/chrome/android/webapk/shell_apk/BUILD.gn

201 lines
6.9 KiB
Plaintext
Raw Normal View History

2018-01-28 19:30:36 +03:00
# 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("//build/config/android/rules.gni")
import("manifest_processor.gni")
import("shell_apk_version.gni")
shell_apk_manifest = "$target_gen_dir/shell_apk_manifest/AndroidManifest.xml"
unbound_shell_apk_manifest =
"$target_gen_dir/unbound_shell_apk_manifest/AndroidManifest.xml"
shell_apk_manifest_javatests =
"$target_gen_dir/shell_apk_manifest_javatests/AndroidManifest.xml"
manifest_processor_template("shell_apk_manifest") {
input = "AndroidManifest.xml"
config_file = "bound_manifest_config.json"
output = shell_apk_manifest
extra_variables = [ "shell_apk_version=$template_shell_apk_version" ]
}
manifest_processor_template("unbound_shell_apk_manifest") {
input = "AndroidManifest.xml"
config_file = "unbound_manifest_config.json"
output = unbound_shell_apk_manifest
extra_variables = [ "shell_apk_version=$template_shell_apk_version" ]
}
# Manifest for instrumentation tests. Cannot be customized via GN args.
manifest_processor_template("shell_apk_manifest_javatests") {
input = "AndroidManifest.xml"
config_file = "javatest_manifest_config.json"
output = shell_apk_manifest_javatests
extra_variables = [ "shell_apk_version=$template_shell_apk_version" ]
}
android_resources("shell_apk_resources") {
resource_dirs = [ "res" ]
custom_package = "org.chromium.webapk.shell_apk"
deps = [
":webapk_strings_grd",
]
}
android_library("webapk_java") {
java_files = [
"src/org/chromium/webapk/shell_apk/DexLoader.java",
"src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java",
"src/org/chromium/webapk/shell_apk/ChooseHostBrowserDialog.java",
"src/org/chromium/webapk/shell_apk/MainActivity.java",
"src/org/chromium/webapk/shell_apk/IdentityService.java",
"src/org/chromium/webapk/shell_apk/InstallHostBrowserDialog.java",
"src/org/chromium/webapk/shell_apk/WebApkSandboxedProcessService.java",
"src/org/chromium/webapk/shell_apk/WebApkSandboxedProcessService0.java",
"src/org/chromium/webapk/shell_apk/WebApkSandboxedProcessService1.java",
"src/org/chromium/webapk/shell_apk/WebApkSandboxedProcessService2.java",
"src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java",
"src/org/chromium/webapk/shell_apk/WebApkUtils.java",
]
deps = [
":shell_apk_manifest",
":shell_apk_resources",
"//chrome/android/webapk/libs/common:common_java",
]
# Manifest used for linting (determining unused resources).
android_manifest = shell_apk_manifest
}
template("webapk_tmpl") {
android_apk(target_name) {
forward_variables_from(invoker,
[
"android_manifest",
"android_manifest_dep",
"apk_name",
])
deps = [
":webapk_java",
]
never_incremental = true
# Force 32 bit mode on 64 bit devices.
native_lib_placeholders = [ "libfoo.so" ]
if (!is_java_debug) {
proguard_enabled = true
proguard_configs = [
"//chrome/android/java/proguard.flags",
"//base/android/proguard/chromium_apk.flags",
"//base/android/proguard/chromium_code.flags",
]
}
}
}
java_strings_grd("webapk_strings_grd") {
grd_file = "//chrome/android/webapk/strings/android_webapk_strings.grd"
outputs = [
"values-am/android_webapk_strings.xml",
"values-ar/android_webapk_strings.xml",
"values-bg/android_webapk_strings.xml",
"values-ca/android_webapk_strings.xml",
"values-cs/android_webapk_strings.xml",
"values-da/android_webapk_strings.xml",
"values-de/android_webapk_strings.xml",
"values-el/android_webapk_strings.xml",
"values/android_webapk_strings.xml",
"values-en-rGB/android_webapk_strings.xml",
"values-es/android_webapk_strings.xml",
"values-es-rUS/android_webapk_strings.xml",
"values-fa/android_webapk_strings.xml",
"values-fi/android_webapk_strings.xml",
"values-tl/android_webapk_strings.xml",
"values-fr/android_webapk_strings.xml",
"values-hi/android_webapk_strings.xml",
"values-hr/android_webapk_strings.xml",
"values-hu/android_webapk_strings.xml",
"values-in/android_webapk_strings.xml",
"values-it/android_webapk_strings.xml",
"values-iw/android_webapk_strings.xml",
"values-ja/android_webapk_strings.xml",
"values-ko/android_webapk_strings.xml",
"values-lt/android_webapk_strings.xml",
"values-lv/android_webapk_strings.xml",
"values-nl/android_webapk_strings.xml",
"values-nb/android_webapk_strings.xml",
"values-pl/android_webapk_strings.xml",
"values-pt-rBR/android_webapk_strings.xml",
"values-pt-rPT/android_webapk_strings.xml",
"values-ro/android_webapk_strings.xml",
"values-ru/android_webapk_strings.xml",
"values-sk/android_webapk_strings.xml",
"values-sl/android_webapk_strings.xml",
"values-sr/android_webapk_strings.xml",
"values-sv/android_webapk_strings.xml",
"values-sw/android_webapk_strings.xml",
"values-th/android_webapk_strings.xml",
"values-tr/android_webapk_strings.xml",
"values-uk/android_webapk_strings.xml",
"values-vi/android_webapk_strings.xml",
"values-zh-rCN/android_webapk_strings.xml",
"values-zh-rTW/android_webapk_strings.xml",
]
}
# Template for WebAPK. When a WebAPK is generated:
# - Android manifest is customized to the website.
# - App icon is extracted from the website and added to the APK's resources.
webapk_tmpl("webapk") {
android_manifest = shell_apk_manifest
android_manifest_dep = ":shell_apk_manifest"
apk_name = "WebApk"
}
webapk_tmpl("unbound_webapk") {
android_manifest = unbound_shell_apk_manifest
android_manifest_dep = ":unbound_shell_apk_manifest"
apk_name = "UnboundWebApk"
}
# WebAPK for instrumentation tests.
webapk_tmpl("webapk_javatests") {
android_manifest = shell_apk_manifest_javatests
android_manifest_dep = ":shell_apk_manifest_javatests"
apk_name = "webapk_javatests"
}
android_library("shell_apk_javatests") {
testonly = true
java_files =
[ "javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java" ]
deps = [
":webapk_java",
"//base:base_java",
"//base:base_java_test_support",
"//chrome/android/webapk/libs/common:common_java",
"//content/public/test/android:content_java_test_support",
"//third_party/android_support_test_runner:runner_java",
"//third_party/junit",
]
srcjar_deps = [ "javatests/dex_optimizer:dex_optimizer_service_aidl" ]
}
junit_binary("webapk_shell_apk_junit_tests") {
java_files = [
"junit/src/org/chromium/webapk/shell_apk/HostBrowserClassLoaderTest.java",
"junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java",
"junit/src/org/chromium/webapk/shell_apk/WebApkUtilsTest.java",
]
deps = [
":webapk_java",
"//chrome/android/webapk/libs/common:common_java",
"//chrome/android/webapk/test:junit_test_support",
]
}