From d907fbb72bbc4db22fef8b7255115a7b6a6ea42e Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 26 May 2026 10:19:40 -0700 Subject: [PATCH] [build] Fix more invocations to use relative paths. Change-Id: I417ff793567a8adbbc4cc4fd4f77792c9a451f89 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506280 Commit-Queue: Ryan Macnak Reviewed-by: Alexander Aprelev --- build/dart/copy_tree.gni | 8 ++++---- build/toolchain/fuchsia/fuchsia_toolchain.gni | 3 ++- build/toolchain/gcc_toolchain.gni | 3 ++- build/toolchain/mac/mac_toolchain.gni | 3 ++- sdk/BUILD.gn | 8 ++++---- utils/analysis_server/BUILD.gn | 4 ++-- utils/aot_snapshot.gni | 12 ++++++------ utils/compiler/BUILD.gn | 2 +- utils/create_timestamp.gni | 4 ++-- utils/ddc/BUILD.gn | 16 ++++++++-------- utils/kernel-service/BUILD.gn | 6 +----- 11 files changed, 34 insertions(+), 35 deletions(-) diff --git a/build/dart/copy_tree.gni b/build/dart/copy_tree.gni index ad8bc7694a0..28054904812 100644 --- a/build/dart/copy_tree.gni +++ b/build/dart/copy_tree.gni @@ -36,13 +36,13 @@ template("copy_tree") { common_args = [ "--from", - rebase_path(source), + rebase_path(source, root_build_dir), "--to", - rebase_path(dest), + rebase_path(dest, root_build_dir), "--depfile", - rebase_path(depfile), + rebase_path(depfile, root_build_dir), "--stamp", - rebase_path(stampfile), + rebase_path(stampfile, root_build_dir), ] if (defined(invoker.exclude)) { common_args += [ diff --git a/build/toolchain/fuchsia/fuchsia_toolchain.gni b/build/toolchain/fuchsia/fuchsia_toolchain.gni index 2eb002711f5..2f613624ef6 100644 --- a/build/toolchain/fuchsia/fuchsia_toolchain.gni +++ b/build/toolchain/fuchsia/fuchsia_toolchain.gni @@ -165,7 +165,8 @@ template("fuchsia_toolchain") { rspfile = "$outfile.rsp" symfile = "$outfile.sym" symbolizer_script = - rebase_path("//runtime/tools/dart_profiler_symbols.py") + rebase_path("//runtime/tools/dart_profiler_symbols.py", + root_build_dir) # Note that the unstripped_outfile is in the exe.stripped folder. # We should probably clean this up, but changing this and dart.cmx diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 63b44a0a385..428c8d0fe0b 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -202,7 +202,8 @@ template("gcc_toolchain") { command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" symbolizer_script = - rebase_path("//runtime/tools/dart_profiler_symbols.py") + rebase_path("//runtime/tools/dart_profiler_symbols.py", + root_build_dir) symbolize_command = "$symbolizer_script --nm $nm --output $symfile --binary $outfile" command += " && $symbolize_command" diff --git a/build/toolchain/mac/mac_toolchain.gni b/build/toolchain/mac/mac_toolchain.gni index 08a38e17131..9f4b0d8bce8 100644 --- a/build/toolchain/mac/mac_toolchain.gni +++ b/build/toolchain/mac/mac_toolchain.gni @@ -203,7 +203,8 @@ template("mac_toolchain") { commands += [ "$dsymutil -o $dsymdir $outfile" ] symbolizer_script = - rebase_path("//runtime/tools/dart_profiler_symbols.py") + rebase_path("//runtime/tools/dart_profiler_symbols.py", + root_build_dir) commands += [ "$symbolizer_script --nm $nm --output $symfile --binary $outfile" ] diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index c41ab7034db..7c205e32541 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -318,7 +318,7 @@ action("build_devtools") { script = "../tools/build_devtools.py" args = [ "--output", - rebase_path(output), + rebase_path(output, root_build_dir), ] } @@ -820,7 +820,7 @@ action("write_version_file") { script = "../tools/write_version_file.py" args = [ "--output", - rebase_path(output), + rebase_path(output, root_build_dir), ] if (!dart_version_git_info) { args += [ "--no-git-hash" ] @@ -836,7 +836,7 @@ action("write_revision_file") { script = "../tools/write_revision_file.py" args = [ "--output", - rebase_path(output), + rebase_path(output, root_build_dir), ] if (!dart_version_git_info) { args += [ "--no-git-hash" ] @@ -866,7 +866,7 @@ action("write_dartdoc_options") { script = "../tools/write_dartdoc_options_file.py" args = [ "--output", - rebase_path(output), + rebase_path(output, root_build_dir), ] if (!dart_version_git_info) { args += [ "--no-git-hash" ] diff --git a/utils/analysis_server/BUILD.gn b/utils/analysis_server/BUILD.gn index 10ee5468b80..95b99955665 100644 --- a/utils/analysis_server/BUILD.gn +++ b/utils/analysis_server/BUILD.gn @@ -30,7 +30,7 @@ aot_snapshot("analysis_server_aot_product") { application_snapshot("analysis_server") { main_dart = "../../pkg/analysis_server/bin/server.dart" training_args = [ - "--sdk=" + rebase_path("../../sdk/"), - "--train-using=" + rebase_path("../../pkg/compiler/lib"), + "--sdk=" + rebase_path("../../sdk/", root_build_dir), + "--train-using=" + rebase_path("../../pkg/compiler/lib", root_build_dir), ] } diff --git a/utils/aot_snapshot.gni b/utils/aot_snapshot.gni index 51c65cc63a4..31a8492235d 100644 --- a/utils/aot_snapshot.gni +++ b/utils/aot_snapshot.gni @@ -121,27 +121,27 @@ template("aot_snapshot") { outputs = [ unsigned_snapshot ] - abs_output = rebase_path(unsigned_snapshot) + rebased_output = rebase_path(unsigned_snapshot, root_build_dir) # TODO(60813): Generate PE DLL on Windows. if (is_mac) { vm_args = [ "--deterministic", "--snapshot-kind=app-aot-macho-dylib", - "--macho=$abs_output", + "--macho=$rebased_output", ] + gen_snapshot_args } else { vm_args = [ "--deterministic", "--snapshot-kind=app-aot-elf", - "--elf=$abs_output", + "--elf=$rebased_output", ] + gen_snapshot_args } if (defined(invoker.vm_args)) { vm_args += invoker.vm_args } - args = [ rebase_path(dill) ] + args = [ rebase_path(dill, root_build_dir) ] force_product_mode = product_mode } @@ -158,9 +158,9 @@ template("aot_snapshot") { "--identity", codesigning_identity, "--input", - rebase_path(unsigned_snapshot), + rebase_path(unsigned_snapshot, root_build_dir), "--output", - rebase_path(signed_snapshot), + rebase_path(signed_snapshot, root_build_dir), ] } } else { diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn index f6214192703..83d0848a510 100644 --- a/utils/compiler/BUILD.gn +++ b/utils/compiler/BUILD.gn @@ -44,7 +44,7 @@ prebuilt_dart_action("dart2js_create_snapshot_entry") { packages = "../../.dart_tool/package_config.json" - args = [ "--output_dir=$output_dir" ] + args = [ "--output_dir=" + rebase_path(output_dir, root_build_dir) ] if (!dart_version_git_info) { args += [ "--no-git-hash" ] } diff --git a/utils/create_timestamp.gni b/utils/create_timestamp.gni index 3b392997ad5..be85b7684b2 100644 --- a/utils/create_timestamp.gni +++ b/utils/create_timestamp.gni @@ -12,8 +12,8 @@ template("create_timestamp_file") { action(target_name) { script = "$_dart_root/tools/list_dart_files_as_depfile.py" args = [ - rebase_path(output), - path, + rebase_path(output, root_build_dir), + rebase_path(path, root_build_dir), ] if (defined(invoker.pattern)) { args += [ invoker.pattern ] diff --git a/utils/ddc/BUILD.gn b/utils/ddc/BUILD.gn index 879e7e1938e..23c191ffe5f 100644 --- a/utils/ddc/BUILD.gn +++ b/utils/ddc/BUILD.gn @@ -41,12 +41,12 @@ application_snapshot("dartdevc") { training_args = [ "--packages", - rebase_path("../../.dart_tool/package_config.json"), + rebase_path("../../.dart_tool/package_config.json", root_build_dir), "--dart-sdk-summary", - rebase_path(sdk_outline_dill), + rebase_path(sdk_outline_dill, root_build_dir), "-o", "dartdevc.js", - rebase_path("../../pkg/dev_compiler/bin/dartdevc.dart"), + rebase_path("../../pkg/dev_compiler/bin/dartdevc.dart", root_build_dir), ] training_deps = [ ":ddc_platform" ] @@ -58,8 +58,8 @@ template("dart2js_compile") { main = invoker.main assert(defined(invoker.out), "Must specify the out file") out = invoker.out - abs_main = rebase_path(main) - abs_output = rebase_path(out) + rebased_main = rebase_path(main, root_build_dir) + rebased_output = rebase_path(out, root_build_dir) prebuilt_dart_action(target_name) { deps = invoker.deps + [ "../compiler:compile_dart2js_platform" ] @@ -77,12 +77,12 @@ template("dart2js_compile") { vm_args = [ "-Dsdk_hash=$sdk_hash" ] args = [ - "$abs_main", + "$rebased_main", "-m", "--invoker=gn_build", - "-o$abs_output", + "-o$rebased_output", "--no-source-maps", - "--platform-binaries=" + rebase_path("$root_out_dir"), + "--platform-binaries=" + rebase_path("$root_out_dir", root_build_dir), ] } } diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn index 89069fc1061..157d9017ae9 100644 --- a/utils/kernel-service/BUILD.gn +++ b/utils/kernel-service/BUILD.gn @@ -29,11 +29,7 @@ application_snapshot("kernel-service_snapshot") { main_dart = "../../$_kernel_service_script" training_args = [ "--train", - - # Force triple-slashes both on Windows and otherwise. - # Becomes e.g. file:///full/path/to/file and "file:///C:/full/path/to/file. - # Without the ', "/"' part, on Linux it would get four slashes. - "file:///" + rebase_path("../../$_kernel_service_script", "/"), + rebase_path("../../$_kernel_service_script", root_build_dir), ] output = "$root_gen_dir/kernel-service.dart.snapshot" }