blob: 285a1eb8025616e16acfde1d8718286a3b899668 [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("//build/config/android/rules.gni")
declare_args() {
# The origin URL of the WebAPK. Used to generate a unique package name for
# WebAPK. Example: "foo.com"
webapk_manifest_package_origin = "template"
# The URL that the WebAPK should navigate to when it is launched.
webapk_start_url = "https://www.template.com/home_page"
# The browser that the WebAPK will be bound to.
webapk_runtime_host = "com.google.android.apps.chrome"
# The scope of the urls that the WebAPK can navigate to.
webapk_scope_url = "https://www.template.com"
# Host part of |webapk_scope|.
webapk_scope_url_host = "www.template.com"
}
shell_apk_manifest_package =
"org.chromium.webapk.$webapk_manifest_package_origin"
shell_apk_manifest = "$target_gen_dir/shell_apk_manifest/AndroidManifest.xml"
jinja_template("shell_apk_manifest") {
input = "AndroidManifest.xml"
output = shell_apk_manifest
variables = [
"manifest_package=$shell_apk_manifest_package",
"host_url=$webapk_start_url",
"runtime_host=$webapk_runtime_host",
"scope_url=$webapk_scope_url",
"scope_url_host=$webapk_scope_url_host",
]
}
android_resources("shell_apk_resources") {
resource_dirs = [ "res" ]
custom_package = "org.chromium.webapk.shell_apk"
}
android_library("dex_loader_lib") {
java_files = [ "src/org/chromium/webapk/shell_apk/DexLoader.java" ]
}
# 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.
android_apk("webapk") {
android_manifest = shell_apk_manifest
apk_name = "WebApk.$webapk_manifest_package_origin"
java_files = [
"src/org/chromium/webapk/shell_apk/MainActivity.java",
"src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java",
]
deps = [
":dex_loader_lib",
":shell_apk_manifest",
":shell_apk_resources",
"//chrome/android/webapk/libs/common",
"//chrome/android/webapk/libs/runtime_library",
]
if (!is_debug) {
proguard_enabled = true
proguard_configs = [ "//chrome/android/java/proguard.flags" ]
}
}
android_library("shell_apk_javatests") {
testonly = true
java_files =
[ "javatests/src/org/chromium/webapk/shell_apk/DexLoaderTest.java" ]
deps = [
":dex_loader_lib",
"//base:base_java",
"//base:base_java_test_support",
"//chrome/android/webapk/libs/common",
"//content/public/test/android:content_java_test_support",
]
srcjar_deps = [ "javatests/dex_optimizer:dex_optimizer_service_aidl" ]
}