Generate flutter-flavoured dart patched sdk and platform.dill (flutter/engine#3814)

* Build Flutter patched-sdk with kernel artifacts

* Switch to new dart_host_toolchain argument mechanism to let dart patch_sdk know of host_toolchain.

* Update dart dependency

* Updated licenses

* Rename dart dependencies tag so they have just 'dart_'-prefixed dart's names.

* Fix indentation and line breaks for newly added deps.

* Add toolchain for windows host

* Update dart revision

* Licenses

* Update licenses

* Revert changes to licenses_third_party
This commit is contained in:
Alexander Aprelev
2017-06-27 02:44:04 +00:00
committed by GitHub
parent 3a25188784
commit e68386fee6
6 changed files with 240 additions and 57 deletions

View File

@@ -7,6 +7,7 @@ group("flutter") {
deps = [
"//flutter/lib/snapshot:generate_snapshot_bin",
"//flutter/lib/snapshot:patched_sdk",
"//flutter/sky",
]

View File

@@ -2,9 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//flutter/lib/snapshot/toolchain.gni")
import("//flutter/lib/ui/dart_ui.gni")
import("//dart/runtime/vm/gypi_contents.gni")
import("//dart/utils/generate_patch_sdk.gni")
if (is_fuchsia) {
import("//apps/mozart/lib/flutter/sdk_ext/sdk_ext.gni")
import("//lib/fidl/dart/sdk_ext/sdk_ext.gni")
@@ -245,3 +247,123 @@ source_set("snapshot") {
"$target_gen_dir/vm_snapshot_instructions.S",
]
}
# Generate flutter_patched_sdk
template("process_library_source") {
assert(defined(invoker.libsources), "Need libsources in $target_name")
assert(defined(invoker.output), "Need output in $target_name")
action(target_name) {
deps = [
":generate_dart_ui",
]
visibility = [ ":*" ] # Only targets in this file can see this.
libsources = invoker.libsources
script = invoker.script
inputs = invoker.inputs + libsources
outputs = [
invoker.output,
]
args = invoker.args + rebase_path(libsources, root_build_dir)
}
}
template("concatenate_patch") {
assert(defined(invoker.libsources), "Need a sources in $target_name")
assert(defined(invoker.output), "Need an output in $target_name")
process_library_source(target_name) {
libsources = invoker.libsources
inputs = []
output = invoker.output
script = "//dart/runtime/tools/concatenate_patches.py"
args = [
"--output",
rebase_path(output, root_build_dir),
]
}
}
template("generate_vm_patched_sdk") {
assert(defined(invoker.libraries), "Need libraries in $target_name")
concatenation_target_names = []
# Concatenate vm library patches.
foreach(library, invoker.libraries) {
name = library[0]
target_output = "$target_gen_dir/patches/${name}_patch.dart"
concatenate_patch("concatenate_${name}_patch") {
libsources = rebase_path(library[1], ".", library[2])
output = target_output
}
concatenation_target_names += [ ":concatenate_${name}_patch" ]
}
# Build the patched sdk out of the concatenated patches and the special
# libraries.
generate_patched_sdk(target_name) {
mode = "flutter"
deps = concatenation_target_names + ["//dart/runtime/vm:patched_sdk"]
input_patches_dir = "$target_gen_dir/patches"
patched_sdk_dir = "flutter_patched_sdk"
}
}
generate_vm_patched_sdk("patched_sdk") {
libraries = [
[
"async",
processed_gypis.async_runtime_sources,
"//dart/runtime/lib",
],
[
"collection",
processed_gypis.collection_runtime_sources,
"//dart/runtime/lib",
],
[
"convert",
processed_gypis.convert_runtime_sources,
"//dart/runtime/lib",
],
[
"core",
processed_gypis.core_runtime_sources,
"//dart/runtime/lib",
],
[
"developer",
processed_gypis.developer_runtime_sources,
"//dart/runtime/lib",
],
[
"internal",
processed_gypis.internal_runtime_sources,
"//dart/runtime/lib",
],
[
"io",
processed_gypis.bin_io_sources,
"//dart/runtime/bin",
],
[
"isolate",
processed_gypis.isolate_runtime_sources,
"//dart/runtime/lib",
],
[
"math",
processed_gypis.math_runtime_sources,
"//dart/runtime/lib",
],
[
"typed_data",
processed_gypis.typed_data_runtime_sources,
"//dart/runtime/lib",
],
]
}

View File

@@ -1,35 +0,0 @@
# 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("//flutter/common/config.gni") # for flutter_aot
if (target_os == "ios") {
import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator
}
dart_host_toolchain = host_toolchain
# 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_os == "ios" && !use_ios_simulator) {
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")
}
}
if (target_os == "android" && flutter_aot) {
if (target_cpu == "arm") {
if (host_os == "linux") {
dart_host_toolchain = "//build/toolchain/linux:clang_x86"
}
if (host_os == "mac") {
dart_host_toolchain = "//build/toolchain/mac:clang_i386"
}
}
}

View File

@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//flutter/lib/snapshot/toolchain.gni")
group("sky") {
testonly = true

View File

@@ -113,6 +113,20 @@ def to_gn_args(args):
if use_dbc:
gn_args['dart_target_arch'] = 'dbc'
# Modify host_toolchain into dart_host_toolchain so it matches word size of target_cpu
if args.target_os == 'android' and aot and gn_args['target_cpu'] == 'arm':
if sys.platform.startswith('linux'):
gn_args['dart_host_toolchain'] = "//build/toolchain/linux:clang_x86"
elif sys.platform.startswith('darwin'):
gn_args['dart_host_toolchain'] = "//build/toolchain/mac:clang_i386"
elif sys.platform.startswith('win'):
gn_args['dart_host_toolchain'] = "//build/toolchain/win:x86"
elif args.target_os == "ios" and not args.simulator:
if gn_args['target_cpu'] == 'arm':
gn_args['dart_host_toolchain'] = '//build/toolchain/mac:clang_i386'
elif gn_args['target_cpu'] == 'arm64':
gn_args['dart_host_toolchain'] = '//build/toolchain/mac:clang_x64'
gn_args['flutter_runtime_mode'] = args.runtime_mode
if args.target_sysroot: