Skip to content

Commit 3522358

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
Reland "[build] Use an absolute path for the snapshot"
When constructing the command line for creating the kernel service snapshot, the variable `abs_output` actually contains a relative path, which means that copy/pasting the generated command line fails if not within the root build directory. This CL fixes that. Previous revert: https://dart-review.googlesource.com/c/sdk/+/200940 Passes `--depfile-output-filename` with the path relative to the output folder so that the written depfiles do not contain the absolute file paths. ninja only accepts paths relative to the build folder in the .d files. Manually tested that the dependencies now work with running the build twice: `tools/build.py --no-start-goma -mrelease create_platform_sdk` Inspecting the .d file in question that caused the revert: `cat out/ReleaseX64/gen/kernel-service.dart.snapshot.d` TEST=SDK build Change-Id: Id781d2ed94ad7a0041e5899b8fded598de81242b Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200876 Reviewed-by: Tess Strickland <[email protected]> Commit-Queue: Daco Harkes <[email protected]>
1 parent 4d50558 commit 3522358

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

runtime/bin/main.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ static void WriteDepsFile(Dart_Isolate isolate) {
109109
Options::depfile());
110110
}
111111
bool success = true;
112-
if (Options::snapshot_filename() != NULL) {
113-
success &= file->Print("%s: ", Options::snapshot_filename());
114-
} else {
112+
if (Options::depfile_output_filename() != NULL) {
115113
success &= file->Print("%s: ", Options::depfile_output_filename());
114+
} else {
115+
success &= file->Print("%s: ", Options::snapshot_filename());
116116
}
117117
if (kernel_isolate_is_running) {
118118
Dart_KernelCompilationResult result = Dart_KernelListDependencies();

utils/application_snapshot.gni

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ template("_application_snapshot") {
145145
dfe = "$_dart_root/pkg/vm/bin/kernel_service.dart"
146146

147147
abs_depfile = rebase_path(depfile)
148-
abs_output = rebase_path(output, root_build_dir)
148+
abs_output = rebase_path(output)
149+
rel_output = rebase_path(output, root_build_dir)
149150

150151
vm_args = [
151152
"--deterministic",
152153
"--packages=$dot_packages",
153154
"--snapshot=$abs_output",
154155
"--snapshot-depfile=$abs_depfile",
156+
"--depfile-output-filename=$rel_output",
155157
] + snapshot_vm_args
156158

157159
if (dart_snapshot_kind == "kernel") {

0 commit comments

Comments
 (0)