[build] Speed up debug and simulator builds by running steps on the prebuilt VM.

Only generating a snapshot really requires running the VM produced during the build.

Change-Id: Ic07bf8b61609c39c9e2dc910737ed56e64decd43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116749
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2019-09-12 16:43:51 +00:00
committed by commit-bot@chromium.org
parent 59bcc4ea1e
commit 74cff6c7df
4 changed files with 77 additions and 41 deletions
+62 -13
View File
@@ -74,11 +74,64 @@ template("_application_snapshot") {
if (defined(invoker.output)) {
output = invoker.output
}
# Build the kernel file using the prebuilt VM to speed up the debug and
# simulator builds.
prebuilt_dart_action(target_name + "_dill") {
deps = extra_deps + [
"../../runtime/vm:kernel_platform_files($dart_host_toolchain)",
"../../runtime/vm:vm_platform",
]
gen_kernel_script = "../../pkg/vm/bin/gen_kernel.dart"
platform_dill = "$root_out_dir/vm_platform_strong.dill"
inputs = extra_inputs + [
gen_kernel_script,
platform_dill,
main_dart,
dot_packages,
]
output = "$root_gen_dir/$name.dart.dill"
outputs = [
output,
]
depfile = "$output.d"
abs_depfile = rebase_path(depfile)
rebased_output = rebase_path(output, root_build_dir)
vm_args = [
"--depfile=$abs_depfile",
"--depfile_output_filename=$rebased_output",
]
script = gen_kernel_script
args = [
"--packages=" + rebase_path(dot_packages),
"--platform=" + rebase_path(platform_dill),
"--no-aot",
"--no-embed-sources",
"--no-link-platform",
"--output=" + rebase_path(output),
]
# TODO(bytecode): Remove special case for the kernel service once
# interpreter-compiled transitions no longer cause stack overflows in
# the language_2/deep_nesting* tests.
if (dart_platform_bytecode && (name != "kernel-service_snapshot")) {
args += [
"--gen-bytecode",
"--drop-ast",
"--bytecode-options=source-positions",
]
}
args += [ rebase_path(main_dart) ]
}
dart_action(target_name) {
deps = extra_deps
deps = extra_deps + [ ":${target_name}_dill" ]
depfile = "$output.d"
script = main_dart
script = "$root_gen_dir/$name.dart.dill"
inputs = extra_inputs
@@ -90,16 +143,14 @@ template("_application_snapshot") {
abs_output = rebase_path(output, root_build_dir)
vm_args = [
"--deterministic",
"--packages=$dot_packages",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
] + snapshot_vm_args
"--deterministic",
"--packages=$dot_packages",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
] + snapshot_vm_args
if (dart_snapshot_kind == "kernel") {
vm_args += [
"--snapshot-kind=kernel",
]
vm_args += [ "--snapshot-kind=kernel" ]
assert(training_args != "", "Ignoring unused argument")
args = []
} else if (dart_snapshot_kind == "app-jit") {
@@ -141,9 +192,7 @@ template("application_snapshot") {
if (!defined(invoker.deps)) {
deps = []
}
deps += [
"$_dart_root/utils/kernel-service:kernel-service"
]
deps += [ "$_dart_root/utils/kernel-service:kernel-service" ]
}
}
+2 -7
View File
@@ -3,8 +3,8 @@
# BSD-style license that can be found in the LICENSE file.
import("../../utils/compile_platform.gni")
import("../create_timestamp.gni")
import("../application_snapshot.gni")
import("../create_timestamp.gni")
create_timestamp_file("dart2js_files_stamp") {
path = rebase_path("../../pkg/compiler/lib")
@@ -21,18 +21,13 @@ create_timestamp_file("dartdoc_files_stamp") {
output = "$target_gen_dir/dartdoc_files.stamp"
}
dart_action("dart2js_create_snapshot_entry") {
prebuilt_dart_action("dart2js_create_snapshot_entry") {
deps = [
":dart2js_files_stamp",
":dartdoc_files_stamp",
":runtime_lib_files_stamp",
]
# dart_action() needs kernel service snapshot to run in Dart 2 mode.
# This can't be added as a dependency to dart_action() itself as it will
# create a circular dependency.
deps += [ "../../utils/kernel-service:kernel-service" ]
output_dir = rebase_path(target_gen_dir)
script = "create_snapshot_entry.dart"
+12 -14
View File
@@ -30,7 +30,9 @@ application_snapshot("dartdevc") {
":dartdevc_kernel_sdk_outline",
]
inputs = [ sdk_dill ]
inputs = [
sdk_dill,
]
}
sdk_lib_files = exec_script("../../tools/list_dart_files.py",
@@ -62,16 +64,11 @@ template("dart2js_compile") {
abs_main = rebase_path(main)
abs_output = rebase_path(out)
dart_action(target_name) {
prebuilt_dart_action(target_name) {
deps = [
"../compiler:compile_dart2js_platform",
]
# dart_action() needs kernel service snapshot to run in Dart 2 mode.
# This can't be added as a dependency to dart_action() itself as it will
# create a circular dependency.
deps += [ "../../utils/kernel-service:kernel-service" ]
inputs = sdk_lib_files + compiler_files + dev_compiler_files + [
"$root_out_dir/dart2js_platform.dill",
"$root_out_dir/dart2js_outline.dill",
@@ -89,6 +86,7 @@ template("dart2js_compile") {
"-m",
"-o$abs_output",
"--no-source-maps",
"--platform-binaries=" + rebase_path("$root_out_dir"),
]
}
}
@@ -211,8 +209,8 @@ prebuilt_dart_action("dartdevc_sdk") {
group("dartdevc_test") {
deps = [
":dartdevc",
":dartdevc_sdk",
":dartdevc_kernel_sdk",
":dartdevc_sdk",
":dartdevc_test_pkg",
"../../sdk:create_sdk",
]
@@ -223,8 +221,8 @@ group("dartdevc_test") {
# building the Dart VM and create_sdk.
group("dartdevc_test_local") {
deps = [
":dartdevc_sdk",
":dartdevc_kernel_sdk",
":dartdevc_sdk",
":dartdevc_test_pkg",
]
}
@@ -244,10 +242,10 @@ create_timestamp_file("dartdevc_sdk_patch_stamp") {
prebuilt_dart_action("dartdevc_test_pkg") {
deps = [
":dartdevc_files_stamp",
":dartdevc_sdk",
":dartdevc_kernel_sdk",
":dartdevc_kernel_sdk_outline",
":dartdevc_kernel_sdk_libraries_json",
":dartdevc_kernel_sdk_outline",
":dartdevc_sdk",
"../../pkg:pkg_files_stamp",
]
@@ -319,9 +317,9 @@ prebuilt_dart_action("dartdevc_test_pkg") {
prebuilt_dart_action("dartdevc_kernel_sdk_outline") {
deps = [
"../../pkg:pkg_files_stamp",
":dartdevc_files_stamp",
":dartdevc_sdk_patch_stamp",
"../../pkg:pkg_files_stamp",
]
inputs = [
@@ -349,7 +347,7 @@ prebuilt_dart_action("dartdevc_kernel_sdk_outline") {
"--output",
rebase_path(sdk_dill),
"--source",
"dart:core"
"dart:core",
]
}
@@ -365,9 +363,9 @@ copy("dartdevc_kernel_sdk_libraries_json") {
# Compiles the DDC SDK's kernel summary and JS code.
prebuilt_dart_action("dartdevc_kernel_sdk") {
deps = [
"../../pkg:pkg_files_stamp",
":dartdevc_files_stamp",
":dartdevc_sdk_patch_stamp",
"../../pkg:pkg_files_stamp",
]
inputs = [
+1 -7
View File
@@ -10,7 +10,6 @@ import("../application_snapshot.gni")
group("kernel-service") {
if (create_kernel_service_snapshot) {
deps = [
# TODO(rmacnak): Link this into 'dart'.
":copy_kernel-service_snapshot",
]
} else {
@@ -20,13 +19,8 @@ group("kernel-service") {
}
}
# TODO: Switch this to use kernel based app-jit snapshot
# when we are ready to switch to the kernel based core snapshots.
kernel_application_snapshot("kernel-service_snapshot") {
main_dart = "$root_gen_dir/kernel_service.dill"
deps = [
":kernel_service_dill",
]
main_dart = "../../pkg/vm/bin/kernel_service.dart"
training_args = [
"--train",
"file:///" + rebase_path("../../pkg/compiler/lib/src/dart2js.dart"),