From 367ee916d658772e151d2ce5479c4a19ed4f08a0 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 23 Apr 2020 16:47:09 +0000 Subject: [PATCH] [ DartDev ] Generate dartdev.dart.snapshot for runtime builds and place it in the root of the build output directory VM developers rarely run the create_sdk build as it's significantly slower than just building the VM. Since DartDev is coupled to the VM, we should build it to ensure that there's no snapshot errors due to old snapshots from previous create_sdk builds. Change-Id: I7626e0f3c791f2a6e69830641d9abf043ec5138f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144465 Reviewed-by: Jaime Wren Commit-Queue: Ben Konyi --- BUILD.gn | 1 + runtime/bin/dartdev_utils.cc | 3 +-- utils/dartdev/BUILD.gn | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index dc28b546923..5619e4927b1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -55,6 +55,7 @@ group("runtime") { "runtime/bin:sample_extension", "runtime/bin:test_extension", "runtime/vm:kernel_platform_files($host_toolchain)", + "utils/dartdev:dartdev", "utils/kernel-service:kernel-service", ] } diff --git a/runtime/bin/dartdev_utils.cc b/runtime/bin/dartdev_utils.cc index 0314d6e0dcc..3f14bc45ab7 100644 --- a/runtime/bin/dartdev_utils.cc +++ b/runtime/bin/dartdev_utils.cc @@ -40,8 +40,7 @@ bool DartDevUtils::TryResolveDartDevSnapshotPath(char** script_name) { // If we're not in dart-sdk/bin, we might be in one of the $SDK/out/* // directories. Try to use a snapshot from a previously built SDK. - snapshot_path = Utils::SCreate( - "%sdart-sdk/bin/snapshots/dartdev.dart.snapshot", dir_prefix.get()); + snapshot_path = Utils::SCreate("%sdartdev.dart.snapshot", dir_prefix.get()); if (File::Exists(nullptr, snapshot_path)) { *script_name = snapshot_path; return true; diff --git a/utils/dartdev/BUILD.gn b/utils/dartdev/BUILD.gn index 495643d7f51..87797c12fb4 100644 --- a/utils/dartdev/BUILD.gn +++ b/utils/dartdev/BUILD.gn @@ -18,8 +18,15 @@ dartfix_files = exec_script("../../tools/list_dart_files.py", ], "list lines") -application_snapshot("dartdev") { +copy("dartdev") { + deps = [ ":dartdev_snapshot" ] + sources = [ "$root_gen_dir/dartdev.dart.snapshot" ] + outputs = [ "$root_out_dir/dartdev.dart.snapshot" ] +} + +application_snapshot("dartdev_snapshot") { main_dart = "../../pkg/dartdev/bin/dartdev.dart" training_args = [ "--help" ] inputs = dartdev_files + dartfix_files + output = "$root_gen_dir/dartdev.dart.snapshot" }