blob: ce66f6b534040f5126f584995143c6a62d758c39 [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("//sky/build/skyx.gni")
template("sky_app") {
skyx_target_name = target_name
if (is_android || is_ios || is_mac) {
skyx_target_name = "app"
}
skyx(skyx_target_name) {
main_dart = invoker.main_dart
if (defined(invoker.manifest)) {
manifest = invoker.manifest
}
if (defined(invoker.sources)) {
sources = invoker.sources
}
}
if (is_android) {
import("//build/config/android/rules.gni")
bundle_prefix = target_name
copy("gen_${bundle_prefix}_bundle") {
sources = [
"$target_gen_dir/app.skyx",
]
outputs = [
"$target_gen_dir/${bundle_prefix}.skyx",
]
deps = [
":app",
]
}
copy_ex("assets") {
clear_dir = true
dest = "$target_gen_dir/assets"
sources = [
"$root_build_dir/icudtl.dat",
"$target_gen_dir/app.skyx",
]
deps = [
":$skyx_target_name",
":gen_${bundle_prefix}_bundle",
"//third_party/icu:icudata",
]
if (defined(invoker.bundles)) {
foreach(bundle, invoker.bundles) {
bundle_gen_dir = get_label_info(bundle, "target_gen_dir")
bundle_dir = get_label_info(bundle, "dir")
bundle_name = get_label_info(bundle, "name")
sources += [ "$bundle_gen_dir/${bundle_name}.skyx" ]
deps += [
"$bundle_dir:gen_${bundle_name}_bundle",
]
}
}
}
android_apk(target_name) {
apk_name = invoker.apk_name
android_manifest = "apk/AndroidManifest.xml"
native_libs = [ "libsky_shell.so" ]
asset_location = "$target_gen_dir/assets"
extensions_to_not_compress = ".skyx"
deps = [
"//base:base_java",
"//sky/shell:assets",
"//sky/shell:java",
"//sky/shell:sky_shell",
":assets",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
} else if (is_ios && defined(invoker.info_plist)) {
import("//build/config/ios/rules.gni")
import("//build/config/ios/ios_sdk.gni")
ios_app(target_name) {
app_name = target_name + "_app"
code_signing_identity = ios_code_signing_identity
info_plist = invoker.info_plist
if (defined(invoker.entitlements_path)) {
entitlements_path = invoker.entitlements_path
} else {
entitlements_path = "//sky/shell/ios/Entitlements.xcent"
}
resources_gen_target_name = target_name + "_res"
resource_copy_ios(resources_gen_target_name) {
resources = [
"//third_party/icu/android/icudtl.dat",
"$target_gen_dir/app.skyx",
]
if (defined(invoker.launcher_resources)) {
resources += invoker.launcher_resources
}
bundle_directory = "."
deps = [ ":app" ]
}
deps = [
"//sky/shell:ios_scaffolding",
":$resources_gen_target_name",
":$skyx_target_name",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
} else if(is_mac && defined(invoker.info_plist)) {
import("//build/config/mac/rules.gni")
mac_app(target_name) {
app_name = target_name + "_app"
info_plist = invoker.info_plist
xibs = invoker.xibs
resources_gen_target_name = target_name + "_res"
resource_copy_mac(resources_gen_target_name) {
resources = [
"//third_party/icu/android/icudtl.dat",
"$target_gen_dir/app.skyx",
]
if (defined(invoker.launcher_resources)) {
resources += invoker.launcher_resources
}
bundle_directory = "."
deps = [ ":app" ]
}
deps = [
":$resources_gen_target_name",
"//sky/shell:mac_scaffolding",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
} else if(is_ios || is_mac) {
# No Info.plist specified. But we still need an empty target
group(target_name) {
}
}
}