[fuchsia] Package flutter_frontend_server snapshot for fuchsia (flutter/engine#13865)

This commit is contained in:
Kaushik Iska
2019-11-14 14:18:19 -08:00
committed by GitHub
parent 9c643907f0
commit 4620ef2a3b
3 changed files with 70 additions and 58 deletions

View File

@@ -2,6 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/dart/utils/application_snapshot.gni")
# TODO(kaushikiska@): Leaving this here to make it a soft-transition
# Remove this once we no longer need engine sources in fuchsia/topaz.
if (is_fuchsia_host || is_fuchsia) {
import("//build/dart/dart_library.gni")
import("//build/dart/dart_tool.gni")
@@ -42,62 +46,60 @@ if (is_fuchsia_host || is_fuchsia) {
":flutter_frontend_server",
]
}
} else {
import("//third_party/dart/utils/application_snapshot.gni")
frontend_server_files =
exec_script("//third_party/dart/tools/list_dart_files.py",
[
"absolute",
rebase_path("."),
],
"list lines")
frontend_server_files +=
exec_script("//third_party/dart/tools/list_dart_files.py",
[
"absolute",
rebase_path("../../third_party/dart/pkg"),
],
"list lines")
application_snapshot("frontend_server") {
main_dart = "bin/starter.dart"
deps = [
":package_incremental_compiler",
"$flutter_root/lib/snapshot:kernel_platform_files",
]
dot_packages = rebase_path(".packages")
flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
training_args = [
"--train",
"--sdk-root=$flutter_patched_sdk",
rebase_path(main_dart),
]
inputs = frontend_server_files
}
# For flutter/flutter#36738 we make the source files available so that
# we can generate a local frontend_server snapshot in the tools cache.
action("package_incremental_compiler") {
script = "$flutter_root/flutter_frontend_server/package_incremental.py"
inputs = frontend_server_files
outputs = [
"$root_gen_dir/dart-pkg/flutter_frontend_server/pubspec.yaml",
"$root_gen_dir/dart-pkg/vm/pubspec.yaml",
"$root_gen_dir/dart-pkg/build_integration/pubspec.yaml",
"$root_gen_dir/dart-pkg/front_end/pubspec.yaml",
"$root_gen_dir/dart-pkg/kernel/pubspec.yaml",
"$root_gen_dir/dart-pkg/dev_compiler/pubspec.yaml",
]
args = [
"--input-root=" + rebase_path("//third_party/dart/pkg"),
"--output-root=" + rebase_path("$root_gen_dir/dart-pkg"),
"--frontend-server=" + rebase_path("$flutter_root"),
]
}
}
frontend_server_files =
exec_script("//third_party/dart/tools/list_dart_files.py",
[
"absolute",
rebase_path("."),
],
"list lines")
frontend_server_files +=
exec_script("//third_party/dart/tools/list_dart_files.py",
[
"absolute",
rebase_path("../../third_party/dart/pkg"),
],
"list lines")
application_snapshot("frontend_server") {
main_dart = "bin/starter.dart"
deps = [
":package_incremental_compiler",
"$flutter_root/lib/snapshot:kernel_platform_files",
]
dot_packages = rebase_path(".packages")
flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
training_args = [
"--train",
"--sdk-root=$flutter_patched_sdk",
rebase_path(main_dart),
]
inputs = frontend_server_files
}
# For flutter/flutter#36738 we make the source files available so that
# we can generate a local frontend_server snapshot in the tools cache.
action("package_incremental_compiler") {
script = "$flutter_root/flutter_frontend_server/package_incremental.py"
inputs = frontend_server_files
outputs = [
"$root_gen_dir/dart-pkg/flutter_frontend_server/pubspec.yaml",
"$root_gen_dir/dart-pkg/vm/pubspec.yaml",
"$root_gen_dir/dart-pkg/build_integration/pubspec.yaml",
"$root_gen_dir/dart-pkg/front_end/pubspec.yaml",
"$root_gen_dir/dart-pkg/kernel/pubspec.yaml",
"$root_gen_dir/dart-pkg/dev_compiler/pubspec.yaml",
]
args = [
"--input-root=" + rebase_path("//third_party/dart/pkg"),
"--output-root=" + rebase_path("$root_gen_dir/dart-pkg"),
"--frontend-server=" + rebase_path("$flutter_root"),
]
}

View File

@@ -45,8 +45,11 @@ if (using_fuchsia_sdk) {
}
_kernel_compiler_label = "dart:kernel_compiler($host_toolchain)"
_frontend_server_label =
"$flutter_root/flutter_frontend_server:frontend_server($host_toolchain)"
deps = [
_frontend_server_label,
_gen_snapshot_to_use,
_kernel_compiler_label,
]
@@ -59,7 +62,12 @@ if (using_fuchsia_sdk) {
rebase_path(get_label_info(_kernel_compiler_label, "root_gen_dir") +
"/kernel_compiler.dart.snapshot")
_frontend_server_path =
rebase_path(get_label_info(_frontend_server_label, "root_gen_dir") +
"/frontend_server.dart.snapshot")
sources = [
_frontend_server_path,
_gen_snapshot_bin_path,
_kernel_compiler_path,
]

View File

@@ -110,6 +110,8 @@ def CopyGenSnapshotIfExists(source, destination):
FindFileAndCopyTo('gen_snapshot_product', source_root, destination_base)
FindFileAndCopyTo('kernel_compiler.dart.snapshot', source_root,
destination_base, 'kernel_compiler.snapshot')
FindFileAndCopyTo('frontend_server.dart.snapshot', source_root,
destination_base, 'flutter_frontend_server.snapshot')
def CopyFlutterTesterBinIfExists(source, destination):