mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #1966 from chinmaygarde/master
GN rules for the precompilation SDK
This commit is contained in:
commit
aa1aff35d2
86
sky/build/sky_precompilation_sdk.gni
Normal file
86
sky/build/sky_precompilation_sdk.gni
Normal file
@ -0,0 +1,86 @@
|
||||
# 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")
|
||||
|
||||
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"
|
||||
|
||||
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/Tools/Snapshotter" ]
|
||||
|
||||
deps = [ snapshotter_target ]
|
||||
}
|
||||
|
||||
copy("embedder_entry_points") {
|
||||
sources = [ "//sky/engine/bindings/dart_vm_entry_points.txt" ]
|
||||
outputs = [ "$sdk_dir/Tools/EmbedderEntryPoints" ]
|
||||
}
|
||||
|
||||
copy("precompilation_xcode_scripts") {
|
||||
sources = [
|
||||
"//sky/build/SnapshotterInvoke",
|
||||
"//sky/build/PackagerInvoke",
|
||||
]
|
||||
outputs = [ "$sdk_dir/Tools/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
copy("copy_sdk_xcode_harness") {
|
||||
sources = [
|
||||
"//sky/build/sdk_xcode_harness/FlutterApplication",
|
||||
"//sky/build/sdk_xcode_harness/FlutterApplication.xcodeproj",
|
||||
"//sky/build/sdk_xcode_harness/Runner",
|
||||
]
|
||||
outputs = [ "$sdk_dir/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
executable_gen_target_name = target_name + "_runner"
|
||||
executable(executable_gen_target_name) {
|
||||
libs = [
|
||||
"UIKit.framework",
|
||||
"AVFoundation.framework",
|
||||
"QuartzCore.framework",
|
||||
"OpenGLES.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/RunnerResources/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/RunnerResources/{{source_file_part}}" ]
|
||||
set_sources_assignment_filter(sources_assignment_filter)
|
||||
}
|
||||
|
||||
group(target_name) {
|
||||
deps = [
|
||||
":$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",
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -49,26 +49,26 @@ idl_compiler_files = [
|
||||
"scripts/v8_utilities.py",
|
||||
]
|
||||
|
||||
dart_host_toolchain = host_toolchain
|
||||
if (target_os == "ios" && !use_ios_simulator) {
|
||||
# During precompilation, a 64 bit Dart VM cannot generate code for a 32 bit
|
||||
# architecture (and vice-versa). The snapshotter that is running on the host
|
||||
# needs to know about the target architecture and built accordingly.
|
||||
if (target_cpu == "arm") {
|
||||
dart_host_toolchain = "//build/toolchain/mac:clang_i386"
|
||||
} else if (target_cpu == "arm64") {
|
||||
dart_host_toolchain = "//build/toolchain/mac:clang_x64"
|
||||
} else {
|
||||
assert(false, "Unknown active architecture on iOS")
|
||||
}
|
||||
}
|
||||
|
||||
template("dart_precompile") {
|
||||
assert(defined(invoker.dart_package_root),
|
||||
"The dart package root must be defined")
|
||||
assert(defined(invoker.dart_script),
|
||||
"The dart script must be specified")
|
||||
|
||||
dart_host_toolchain = host_toolchain
|
||||
if (target_os == "ios" && !use_ios_simulator) {
|
||||
# During precompilation, a 64 bit Dart VM cannot generate code for a 32 bit
|
||||
# architecture (and vice-versa). The snapshotter that is running on the host
|
||||
# needs to know about the target architecture and built accordingly.
|
||||
if (target_cpu == "arm") {
|
||||
dart_host_toolchain = "//build/toolchain/mac:clang_i386"
|
||||
} else if (target_cpu == "arm64") {
|
||||
dart_host_toolchain = "//build/toolchain/mac:clang_x64"
|
||||
} else {
|
||||
assert(false, "Unknown active architecture on iOS")
|
||||
}
|
||||
}
|
||||
|
||||
vm_isolate_snapshot_name = target_name + "_vm_isolate.bin"
|
||||
vm_isolate_snapshot = "$target_gen_dir/$vm_isolate_snapshot_name"
|
||||
isolate_snapshot_name = target_name + "_isolate.bin"
|
||||
|
||||
@ -189,6 +189,7 @@ if (is_android) {
|
||||
} else if (is_ios) {
|
||||
import("//build/config/ios/rules.gni")
|
||||
import("//build/config/ios/ios_sdk.gni")
|
||||
import("//sky/build/sky_precompilation_sdk.gni")
|
||||
|
||||
source_set("ios_scaffolding") {
|
||||
sources = [
|
||||
@ -220,9 +221,8 @@ if (is_android) {
|
||||
]
|
||||
}
|
||||
|
||||
group("shell") {
|
||||
# iOS only supports application bundles with a precompiled instruction
|
||||
# buffer. There is not Shell target for the same.
|
||||
sky_precompilation_sdk("shell") {
|
||||
sdk_name = "SkySDK"
|
||||
}
|
||||
} else if (is_linux) {
|
||||
executable("shell") {
|
||||
@ -269,9 +269,6 @@ if (is_android) {
|
||||
app_name = "SkyShell"
|
||||
info_plist = "mac/Info.plist"
|
||||
|
||||
# entitlements_path = ""
|
||||
# code_signing_identity = ""
|
||||
|
||||
xibs = [ "mac/sky_mac.xib" ]
|
||||
|
||||
resource_copy_mac("sky_resources") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user