From 5c76d099a6cd6b0ce6a45b6ed51685263ba3d286 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 8 Mar 2023 22:10:42 +0000 Subject: [PATCH] [build] Use relative paths. go/remotely-cacheable TEST=ci Change-Id: Idee4ab56de2df15e90c5e4106b6200bf82e76155 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287320 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- build/dart/dart_action.gni | 14 +++++++------- runtime/bin/BUILD.gn | 8 ++++---- runtime/observatory/BUILD.gn | 15 ++++++++------- utils/aot_snapshot.gni | 8 ++++---- utils/application_snapshot.gni | 19 +++++++------------ utils/compiler/BUILD.gn | 8 +++++--- utils/gen_kernel/BUILD.gn | 8 ++++---- utils/kernel-service/BUILD.gn | 11 +++++------ 8 files changed, 44 insertions(+), 47 deletions(-) diff --git a/build/dart/dart_action.gni b/build/dart/dart_action.gni index 53472a0fe5a..12c3d56ac61 100644 --- a/build/dart/dart_action.gni +++ b/build/dart/dart_action.gni @@ -133,16 +133,16 @@ template("_prebuilt_tool_action") { args = [ "compiled_action", - rebase_path(invoker.binary), + rebase_path(invoker.binary, root_build_dir), ] + vm_args if (defined(invoker.packages)) { - args += [ "--packages=" + rebase_path(invoker.packages) ] + args += [ "--packages=" + rebase_path(invoker.packages, root_build_dir) ] } if (defined(invoker.dfe)) { - args += [ "--dfe=" + rebase_path(invoker.dfe) ] + args += [ "--dfe=" + rebase_path(invoker.dfe, root_build_dir) ] } if (defined(invoker.script)) { - args += [ rebase_path(invoker.script) ] + args += [ rebase_path(invoker.script, root_build_dir) ] } args += invoker.args } @@ -261,10 +261,10 @@ template("_built_tool_action") { args = vm_args if (defined(invoker.packages)) { - args += [ "--packages=" + rebase_path(invoker.packages) ] + args += [ "--packages=" + rebase_path(invoker.packages, root_build_dir) ] } if (defined(invoker.script)) { - args += [ rebase_path(invoker.script) ] + args += [ rebase_path(invoker.script, root_build_dir) ] } args += invoker.args } @@ -320,7 +320,7 @@ template("dart_action") { # Dart has an implicit dependency on the kernel service so unless DFE is # passed, we need to add this dep. if (defined(invoker.dfe)) { - vm_args += [ "--dfe=" + rebase_path(invoker.dfe) ] + vm_args += [ "--dfe=" + rebase_path(invoker.dfe, root_build_dir) ] } else { if (!defined(invoker.deps)) { deps = [] diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index a8e57044e61..e757b71d483 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -527,7 +527,7 @@ gen_snapshot_action("generate_snapshot_bin") { rebase_path(isolate_snapshot_data, root_build_dir), "--isolate_snapshot_instructions=" + rebase_path(isolate_snapshot_instructions, root_build_dir), - rebase_path(platform_dill), + rebase_path(platform_dill, root_build_dir), ] } @@ -548,7 +548,7 @@ template("bin_to_assembly") { "--input", rebase_path(invoker.input, root_build_dir), "--output", - rebase_path(output), + rebase_path(output, root_build_dir), "--symbol_name", invoker.symbol, "--target_os", @@ -587,9 +587,9 @@ template("bin_to_coff") { output = invoker.input + ".o" args = [ "--input", - rebase_path(invoker.input), + rebase_path(invoker.input, root_build_dir), "--output", - rebase_path(output), + rebase_path(output, root_build_dir), "--symbol_name", invoker.symbol, ] diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn index 54580f91b2c..518b6322048 100644 --- a/runtime/observatory/BUILD.gn +++ b/runtime/observatory/BUILD.gn @@ -23,9 +23,10 @@ prebuilt_dart_action("build_observatory") { "compile", "js", "-o", - rebase_path(output), - "--packages=" + rebase_path("../../.dart_tool/package_config.json"), - rebase_path("web/main.dart"), + rebase_path(output, root_build_dir), + "--packages=" + + rebase_path("../../.dart_tool/package_config.json", root_build_dir), + rebase_path("web/main.dart", root_build_dir), ] if (is_debug) { args += [ "--enable-asserts" ] @@ -142,9 +143,9 @@ template("observatory_archive") { script = "../tools/create_archive.py" args = [ "--tar_output", - rebase_path(output), + rebase_path(output, root_build_dir), "--client_root", - rebase_path("$target_out_dir/observatory/deployed/web/"), + rebase_path("$target_out_dir/observatory/deployed/web/", root_build_dir), ] if (enable_compression) { args += [ "--compress" ] @@ -211,9 +212,9 @@ template("observatory_archive_source") { script = "../tools/create_archive.py" args = [ "--tar_input", - rebase_path(invoker.archive_file), + rebase_path(invoker.archive_file, root_build_dir), "--output", - rebase_path(output), + rebase_path(output, root_build_dir), "--outer_namespace", invoker.outer_namespace, "--inner_namespace", diff --git a/utils/aot_snapshot.gni b/utils/aot_snapshot.gni index 86de3ba4fa5..731fe4c2ac8 100644 --- a/utils/aot_snapshot.gni +++ b/utils/aot_snapshot.gni @@ -80,11 +80,11 @@ template("aot_snapshot") { script = gen_kernel_kernel args = [ - "--packages=" + rebase_path(dot_packages), - "--platform=" + rebase_path(platform_dill), + "--packages=" + rebase_path(dot_packages, root_build_dir), + "--platform=" + rebase_path(platform_dill, root_build_dir), "--aot", "--output=" + rebase_path(output, root_build_dir), - "--depfile=" + rebase_path(depfile), + "--depfile=" + rebase_path(depfile, root_build_dir), # Ensure the compiled application (e.g. kernel-service, frontend-server, # ...) will use this SDK hash when consuming/producing kernel. @@ -94,7 +94,7 @@ template("aot_snapshot") { "-Dsdk_hash=$sdk_hash", ] args += gen_kernel_args - args += [ rebase_path(main_dart) ] + args += [ rebase_path(main_dart, root_build_dir) ] if (product_mode) { args += [ "-Ddart.vm.product=true" ] } diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni index 336645fbb68..82c7892e851 100644 --- a/utils/application_snapshot.gni +++ b/utils/application_snapshot.gni @@ -120,13 +120,13 @@ template("_application_snapshot") { is_product_flag = dart_runtime_mode == "release" args = [ - "--packages=" + rebase_path(dot_packages), - "--platform=" + rebase_path(platform_dill), + "--packages=" + rebase_path(dot_packages, root_build_dir), + "--platform=" + rebase_path(platform_dill, root_build_dir), "--no-aot", "--no-embed-sources", "--no-link-platform", "--output=" + rebase_path(output, root_build_dir), - "--depfile=" + rebase_path(depfile), + "--depfile=" + rebase_path(depfile, root_build_dir), # Ensure the compiled application (e.g. kernel-service, frontend-server, # ...) will use this SDK hash when consuming/producing kernel. @@ -137,7 +137,7 @@ template("_application_snapshot") { "-Ddart.vm.product=$is_product_flag", ] args += gen_kernel_args - args += [ rebase_path(main_dart) ] + args += [ rebase_path(main_dart, root_build_dir) ] } # Create a snapshot from kernel built above. @@ -168,16 +168,11 @@ template("_application_snapshot") { # snapshot (creating a circular dep. for kernel-service_snapshot). dfe = "NEVER_LOADED" - abs_depfile = rebase_path(depfile) - abs_output = rebase_path(output) - rel_output = rebase_path(output, root_build_dir) - vm_args = [ "--deterministic", - "--packages=$dot_packages", - "--snapshot=$abs_output", - "--snapshot-depfile=$abs_depfile", - "--depfile-output-filename=$rel_output", + "--packages=" + rebase_path(dot_packages, root_build_dir), + "--snapshot=" + rebase_path(output, root_build_dir), + "--snapshot-depfile=" + rebase_path(depfile, root_build_dir), ] + snapshot_vm_args if (dart_snapshot_kind == "app-jit") { diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn index c1166a46cb0..758637f59a2 100644 --- a/utils/compiler/BUILD.gn +++ b/utils/compiler/BUILD.gn @@ -63,12 +63,14 @@ application_snapshot("dart2js") { vm_args = [] main_dart = "$target_gen_dir/dart2js.dart" training_args = [ - "--packages=" + rebase_path("../../.dart_tool/package_config.json"), - "--libraries-spec=" + rebase_path("$sdk_root/lib/libraries.json"), + "--packages=" + + rebase_path("../../.dart_tool/package_config.json", root_build_dir), + "--libraries-spec=" + + rebase_path("$sdk_root/lib/libraries.json", root_build_dir), # Specifying the platform explicitly elides running the CFE on the sdk # sources. - "--platform-binaries=" + rebase_path("$root_out_dir/"), + "--platform-binaries=" + rebase_path("$root_out_dir/", root_build_dir), rebase_path("../../pkg/compiler/lib/src/util/memory_compiler.dart"), ] diff --git a/utils/gen_kernel/BUILD.gn b/utils/gen_kernel/BUILD.gn index 8206342af42..04bbf71a790 100644 --- a/utils/gen_kernel/BUILD.gn +++ b/utils/gen_kernel/BUILD.gn @@ -28,12 +28,12 @@ prebuilt_dart_action("bootstrap_gen_kernel") { vm_args = [ "--snapshot-kind=kernel", "--snapshot=" + rebase_path(output, root_build_dir), - "--depfile=" + rebase_path(depfile), + "--depfile=" + rebase_path(depfile, root_build_dir), # Ensure gen_kernel.dart will use this SDK hash when consuming/producing kernel. "-Dsdk_hash=$sdk_hash", - "--packages=" + rebase_path(dot_packages), + "--packages=" + rebase_path(dot_packages, root_build_dir), ] script = gen_kernel_script args = [] @@ -52,8 +52,8 @@ application_snapshot("gen_kernel") { vm_platform = "$vm_platform_out/vm_platform_strong.dill" training_args = [ "--platform", - rebase_path(vm_platform), - rebase_path("../../pkg/vm/bin/gen_kernel.dart"), + rebase_path(vm_platform, root_build_dir), + rebase_path("../../pkg/vm/bin/gen_kernel.dart", root_build_dir), "-o -", ] } diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn index 824a8d55926..4735e412e63 100644 --- a/utils/kernel-service/BUILD.gn +++ b/utils/kernel-service/BUILD.gn @@ -80,12 +80,10 @@ template("kernel_service_dill") { outputs = [ output ] depfile = "$root_gen_dir/kernel_service" + invoker.target_name + "_dill.d" - abs_depfile = rebase_path(depfile) - rebased_output = rebase_path(output, root_build_dir) vm_args = [ - "--depfile=$abs_depfile", - "--depfile_output_filename=$rebased_output", + "--depfile=" + rebase_path(depfile, root_build_dir), + "--depfile_output_filename=" + rebase_path(output, root_build_dir), # Ensure gen_kernel.dart will use this SDK hash when consuming/producing # kernel. @@ -102,12 +100,13 @@ template("kernel_service_dill") { "-Dsdk_hash=$sdk_hash", "--packages=" + scheme + ":///.dart_tool/package_config.json", - "--platform=" + rebase_path("$root_out_dir/vm_platform_strong.dill"), + "--platform=" + rebase_path("$root_out_dir/vm_platform_strong.dill", + root_build_dir), "--filesystem-root=" + rebase_path("../../"), "--filesystem-scheme=" + scheme, "--no-aot", "--no-embed-sources", - "--output=" + rebase_path(output), + "--output=" + rebase_path(output, root_build_dir), ] args += [ scheme + ":///pkg/vm/bin/kernel_service.dart" ] }