Skip to content

Commit

Permalink
Generate flutter-flavoured dart patched sdk and platform.dill (flutte…
Browse files Browse the repository at this point in the history
…r#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
  • Loading branch information
aam authored Jun 27, 2017
1 parent 38b3e89 commit 009d470
Show file tree
Hide file tree
Showing 6 changed files with 240 additions and 57 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ group("flutter") {

deps = [
"//flutter/lib/snapshot:generate_snapshot_bin",
"//flutter/lib/snapshot:patched_sdk",
"//flutter/sky",
]

Expand Down
121 changes: 102 additions & 19 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,37 @@ vars = {
# When updating the Dart revision, ensure that all entries that are
# dependencies of Dart are also updated to match the entries in the
# Dart SDK's DEPS file for that revision of Dart. The DEPS file for
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //dart/tools/create_updated_fluter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '3c543bb210711dd6761d592a863fd6f32e1f1279',
# Dart calls the next one "boringssl_gen_rev"
'dart_boringssl_gen_revision': '753224969dbe43dad29343146529727b5066c0f3',
# Dart calls the next one "boringssl_rev"
'dart_boringssl_revision': 'd519bf6be0b447fb80fbc539d4bff4479b5482a2',
# Dart calls the next one "observatory_pub_packages_rev"
'dart_observatory_packages_revision': '26aad88f1c1915d39bbcbff3cad589e2402fdcf1',
# Dart calls the next one "root_certificates_rev"
'dart_root_certificates_revision': 'a4c7c6f23a664a37bc1b6f15a819e3f2a292791a',

'dart_args_tag': '0.13.7',
'dart_async_tag': 'daf66909019d2aaec1721fc39d94ea648a9fdc1d',
'dart_boringssl_gen_rev': '753224969dbe43dad29343146529727b5066c0f3',
'dart_boringssl_rev': 'd519bf6be0b447fb80fbc539d4bff4479b5482a2',
'dart_charcode_tag': 'v1.1.1',
'dart_collection_tag': '1.13.0',
'dart_convert_tag': '2.0.1',
'dart_crypto_tag': '2.0.1',
'dart_csslib_tag': '0.13.3+1',
'dart_dart2js_info_tag': '0.5.4+2',
'dart_glob_tag': '1.1.3',
'dart_html_tag': '0.13.1',
'dart_isolate_tag': '1.0.0',
'dart_logging_tag': '0.11.3+1',
'dart_observatory_pub_packages_rev': '26aad88f1c1915d39bbcbff3cad589e2402fdcf1',
'dart_package_config_tag': '1.0.0',
'dart_path_tag': '1.4.1',
'dart_plugin_tag': '0.2.0',
'dart_pub_semver_tag': '1.3.2',
'dart_root_certificates_rev': 'a4c7c6f23a664a37bc1b6f15a819e3f2a292791a',
'dart_source_span_tag': '1.4.0',
'dart_string_scanner_tag': '1.0.1',
'dart_typed_data_tag': '1.1.3',
'dart_utf_tag': '0.9.0+3',
'dart_watcher_tag': '0.9.7+3',
'dart_yaml_tag': '2.1.12',

# Build bot tooling for iOS
'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f',
Expand Down Expand Up @@ -85,30 +106,92 @@ deps = {
'src/buildtools':
Var('fuchsia_git') + '/buildtools' + '@' + Var('buildtools_revision'),

'src/ios_tools':
'src/ios_tools':
Var('chromium_git') + '/chromium/src/ios.git' + '@' + Var('ios_tools_revision'),

'src/third_party/icu':
Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'c3f79166089e5360c09e3053fce50e6e296c3204',

'src/dart':
Var('chromium_git') + '/external/github.com/dart-lang/sdk.git' + '@' + Var('dart_revision'),
Var('chromium_git') + '/external/github.com/dart-lang/sdk.git' + '@' + Var('dart_revision'),

'src/third_party/boringssl':
Var('github_git') + '/dart-lang/boringssl_gen.git' + '@' + Var('dart_boringssl_gen_revision'),
Var('github_git') + '/dart-lang/boringssl_gen.git' + '@' + Var('dart_boringssl_gen_rev'),

'src/third_party/boringssl/src':
'https://boringssl.googlesource.com/boringssl.git' + '@' + Var('dart_boringssl_revision'),
'https://boringssl.googlesource.com/boringssl.git' + '@' + Var('dart_boringssl_rev'),

'src/dart/third_party/observatory_pub_packages':
Var('chromium_git') +
'/external/github.com/dart-lang/observatory_pub_packages' + '@' +
Var('dart_observatory_packages_revision'),
Var('chromium_git') + '/external/github.com/dart-lang/observatory_pub_packages' + '@' + Var('dart_observatory_pub_packages_rev'),

'src/dart/third_party/pkg/args':
Var('chromium_git') + '/external/github.com/dart-lang/args' + '@' + Var('dart_args_tag'),

'src/dart/third_party/pkg/async':
Var('chromium_git') + '/external/github.com/dart-lang/async' + '@' + Var('dart_async_tag'),

'src/dart/third_party/pkg/charcode':
Var('chromium_git') + '/external/github.com/dart-lang/charcode' + '@' + Var('dart_charcode_tag'),

'src/dart/third_party/pkg/collection':
Var('chromium_git') + '/external/github.com/dart-lang/collection' + '@' + Var('dart_collection_tag'),

'src/dart/third_party/pkg/convert':
Var('chromium_git') + '/external/github.com/dart-lang/convert' + '@' + Var('dart_convert_tag'),

'src/dart/third_party/pkg/crypto':
Var('chromium_git') + '/external/github.com/dart-lang/crypto' + '@' + Var('dart_crypto_tag'),

'src/dart/third_party/pkg/csslib':
Var('chromium_git') + '/external/github.com/dart-lang/csslib' + '@' + Var('dart_csslib_tag'),

'src/dart/third_party/pkg/dart2js_info':
Var('chromium_git') + '/external/github.com/dart-lang/dart2js_info' + '@' + Var('dart_dart2js_info_tag'),

'src/dart/third_party/pkg/isolate':
Var('chromium_git') + '/external/github.com/dart-lang/isolate' + '@' + Var('dart_isolate_tag'),

'src/dart/third_party/pkg/glob':
Var('chromium_git') + '/external/github.com/dart-lang/glob' + '@' + Var('dart_glob_tag'),

'src/dart/third_party/pkg/html':
Var('chromium_git') + '/external/github.com/dart-lang/html' + '@' + Var('dart_html_tag'),

'src/dart/third_party/pkg/logging':
Var('chromium_git') + '/external/github.com/dart-lang/logging' + '@' + Var('dart_logging_tag'),

'src/dart/third_party/pkg_tested/package_config':
Var('chromium_git') + '/external/github.com/dart-lang/package_config' + '@' + Var('dart_package_config_tag'),

'src/dart/third_party/pkg/path':
Var('chromium_git') + '/external/github.com/dart-lang/path' + '@' + Var('dart_path_tag'),

'src/dart/third_party/pkg/plugin':
Var('chromium_git') + '/external/github.com/dart-lang/plugin' + '@' + Var('dart_plugin_tag'),

'src/dart/third_party/pkg/pub_semver':
Var('chromium_git') + '/external/github.com/dart-lang/pub_semver' + '@' + Var('dart_pub_semver_tag'),

'src/dart/third_party/pkg/source_span':
Var('chromium_git') + '/external/github.com/dart-lang/source_span' + '@' + Var('dart_source_span_tag'),

'src/dart/third_party/pkg/string_scanner':
Var('chromium_git') + '/external/github.com/dart-lang/string_scanner' + '@' + Var('dart_string_scanner_tag'),

'src/dart/third_party/pkg/typed_data':
Var('chromium_git') + '/external/github.com/dart-lang/typed_data' + '@' + Var('dart_typed_data_tag'),

'src/dart/third_party/pkg/utf':
Var('chromium_git') + '/external/github.com/dart-lang/utf' + '@' + Var('dart_utf_tag'),

'src/dart/third_party/pkg/watcher':
Var('chromium_git') + '/external/github.com/dart-lang/watcher' + '@' + Var('dart_watcher_tag'),

'src/dart/third_party/pkg/yaml':
Var('chromium_git') + '/external/github.com/dart-lang/yaml' + '@' + Var('dart_yaml_tag'),

'src/third_party/root_certificates':
Var('chromium_git') +
'/external/github.com/dart-lang/root_certificates' + '@' +
Var('dart_root_certificates_revision'),
Var('chromium_git') + '/external/github.com/dart-lang/root_certificates' + '@' + Var('dart_root_certificates_rev'),

'src/third_party/skia':
Var('skia_git') + '/skia.git' + '@' + Var('skia_revision'),
Expand Down
124 changes: 123 additions & 1 deletion lib/snapshot/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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",
],
]
}
35 changes: 0 additions & 35 deletions lib/snapshot/toolchain.gni

This file was deleted.

2 changes: 0 additions & 2 deletions sky/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 009d470

Please sign in to comment.