blob: 83ff0904d5a67f6359d5207065edaa38241d5efb [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/engine/bindings/bindings.gni")
import("//build/config/templates/templates.gni")
template("sky_precompilation_sdk") {
assert(is_ios, "The precompilation SDK is only supported for iOS targets")
assert(defined(invoker.sdk_name), "The SDK name must be defined")
sdk_name = invoker.sdk_name
sdk_dir = "$root_out_dir/$sdk_name"
tools_dir_name = "Tools"
tools_dir = "$tools_dir_name/common"
# The architecture specific suffixes are chosen to match the ${PLATFORM_NAME}
# used by the .xcconfig files
arch_tools_dir = "$tools_dir_name/iphoneos"
if (use_ios_simulator) {
arch_tools_dir = "$tools_dir_name/iphonesimulator"
}
snapshotter_copy_gen_target_name = target_name + "_copy_snapshotter"
copy(snapshotter_copy_gen_target_name) {
snapshotter_target = "//dart/runtime/bin:gen_snapshot($dart_host_toolchain)"
snapshotter_directory = get_label_info(snapshotter_target, "root_out_dir")
snapshotter_name = get_label_info(snapshotter_target, "name")
sources = [ "$snapshotter_directory/$snapshotter_name" ]
outputs = [ "$sdk_dir/$arch_tools_dir/Snapshotter" ]
deps = [ snapshotter_target ]
}
script_snapshotter_copy_gen_target_name =
target_name + "_copy_script_snapshotter"
copy(script_snapshotter_copy_gen_target_name) {
script_snapshotter_target = "//sky/tools/sky_snapshot($dart_host_toolchain)"
script_snapshotter_directory =
get_label_info(script_snapshotter_target, "root_out_dir")
script_snapshotter_name = get_label_info(script_snapshotter_target, "name")
sources = [ "$script_snapshotter_directory/$script_snapshotter_name" ]
outputs = [ "$sdk_dir/$tools_dir/ScriptSnapshotter" ]
deps = [ script_snapshotter_target ]
}
copy("embedder_entry_points") {
sources = [ "//sky/engine/bindings/dart_vm_entry_points.txt" ]
outputs = [ "$sdk_dir/$tools_dir/EmbedderEntryPoints" ]
}
copy("precompilation_xcode_scripts") {
sources = [
"//sky/build/SnapshotterInvoke",
"//sky/build/PackagerInvoke",
]
outputs = [ "$sdk_dir/$tools_dir/{{source_file_part}}" ]
}
copy("copy_sdk_xcode_harness") {
sources = [
"//sky/build/sdk_xcode_harness/Flutter.xcconfig",
"//sky/build/sdk_xcode_harness/FlutterApplication",
"//sky/build/sdk_xcode_harness/FlutterApplication.xcodeproj",
"//sky/build/sdk_xcode_harness/Local.xcconfig",
"//sky/build/sdk_xcode_harness/Runner",
]
outputs = [ "$sdk_dir/{{source_file_part}}" ]
}
# All user editable files are copied to the out directory so that developers
# tinkering on the engine still have a fully functional project harness
copy("copy_user_editable_files") {
sources = [
"//sky/build/Info.plist",
"//sky/build/LaunchScreen.storyboard",
"//sky/build/Assets.xcassets",
]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
executable_gen_target_name = target_name + "_runner"
executable(executable_gen_target_name) {
libs = [
"AudioToolbox.framework",
"AVFoundation.framework",
"OpenGLES.framework",
"QuartzCore.framework",
"UIKit.framework",
]
deps = [ "//sky/shell:ios_scaffolding" ]
}
copy_runner_gen_target_name = target_name + "_copy_runner"
copy(copy_runner_gen_target_name) {
sources = [ "$root_out_dir/$executable_gen_target_name" ]
outputs = [ "$sdk_dir/$arch_tools_dir/FlutterRunner" ]
deps = [ ":$executable_gen_target_name" ]
}
copy_data_gen_target_name = target_name + "_copy_data"
copy(copy_data_gen_target_name) {
set_sources_assignment_filter([])
sources = [ "//third_party/icu/android/icudtl.dat" ]
outputs = [ "$sdk_dir/$tools_dir/{{source_file_part}}" ]
set_sources_assignment_filter(sources_assignment_filter)
}
group(target_name) {
deps = [
":$snapshotter_copy_gen_target_name",
":$script_snapshotter_copy_gen_target_name",
":embedder_entry_points",
":$copy_runner_gen_target_name",
":$copy_data_gen_target_name",
":precompilation_xcode_scripts",
":copy_sdk_xcode_harness",
":copy_user_editable_files",
]
}
}