From b5eb9af66373d55a3a7e6fb3f7c9cee3f7917f2b Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 9 Jun 2026 12:27:23 -0700 Subject: [PATCH] [build] Fix RBE fallback on pkg, ddc and dyn bots. Also fix --check-clean. `ninja target -t commands` reports the commands for the default target, fix to use `ninja -t commands target` instead. Change-Id: Ice179290e75b083a96abadb7540ca960eafcc982 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510440 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- tools/build.py | 12 ++++++++---- utils/dart2wasm/BUILD.gn | 9 ++++++--- utils/ddc/BUILD.gn | 26 +++++++++++++------------- utils/dynamic_module_runner/BUILD.gn | 3 ++- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/tools/build.py b/tools/build.py index 65116df08a9..c1a1534da78 100755 --- a/tools/build.py +++ b/tools/build.py @@ -198,8 +198,8 @@ def RunOneBuildCommand(build_config, args, env): return 0 -def CheckCleanBuild(build_config, args, rbe, env): - explain_args = args + ['-n', '-d', 'explain'] +def CheckCleanBuild(build_config, args, rbe, targets, env): + explain_args = args[0:3] + ['-n', '-d', 'explain'] + targets print(' '.join(explain_args)) process = subprocess.Popen(explain_args, env=env, @@ -218,7 +218,7 @@ def CheckCleanBuild(build_config, args, rbe, env): return 1 if rbe: - list_args = args + ['-t', 'commands'] + list_args = args[0:3] + ['-t', 'commands'] + targets print(' '.join(list_args)) process = subprocess.Popen(list_args, env=env, @@ -298,7 +298,11 @@ def Build(configs, env, options): if options.check_clean: for (build_config, args, rbe) in configs: - if CheckCleanBuild(build_config, args, rbe, env=env) != 0: + if CheckCleanBuild(build_config, + args, + rbe, + options.build_targets, + env=env) != 0: return 1 return 0 diff --git a/utils/dart2wasm/BUILD.gn b/utils/dart2wasm/BUILD.gn index c848f4cbc39..c5764afd8f3 100644 --- a/utils/dart2wasm/BUILD.gn +++ b/utils/dart2wasm/BUILD.gn @@ -11,11 +11,14 @@ template("wasm_module") { action(target_name) { script = rebase_path("//build/gn_run_binary.py") args = [ - rebase_path("//third_party/emsdk/upstream/emscripten/emcc"), + rebase_path("//third_party/emsdk/upstream/emscripten/emcc", + root_build_dir), "--no-entry", - rebase_path("//tests/web/wasm/ffi/${invoker.module_name}.c"), + rebase_path("//tests/web/wasm/ffi/${invoker.module_name}.c", + root_build_dir), "-o", - rebase_path("$root_out_dir/wasm/${invoker.module_name}.wasm"), + rebase_path("$root_out_dir/wasm/${invoker.module_name}.wasm", + root_build_dir), "-O", ] inputs = [ "//tests/web/wasm/ffi/${invoker.module_name}.c" ] diff --git a/utils/ddc/BUILD.gn b/utils/ddc/BUILD.gn index b8df0347534..9390123bc43 100644 --- a/utils/ddc/BUILD.gn +++ b/utils/ddc/BUILD.gn @@ -205,9 +205,8 @@ template("ddc_compile") { mnemonic = "DDC" script = "../../pkg/dev_compiler/bin/dartdevc.dart" package_name = invoker.package - out_dir = rebase_path("$js_gen_dir") - sdk_path = rebase_path(sdk_outline_dill) - pkg_root = rebase_path("$root_build_dir/../../pkg") + sdk_path = rebase_path(sdk_outline_dill, root_build_dir) + pkg_root = rebase_path("../../pkg", root_build_dir) deps = [ ":ddc_files_stamp", @@ -229,7 +228,8 @@ template("ddc_compile") { args += [ "--modules=$module", - "-o$out_dir/$module/$package_name.js", + "-o" + + rebase_path("$js_gen_dir/$module/$package_name.js", root_build_dir), ] } @@ -251,7 +251,7 @@ template("ddc_compile") { if (defined(invoker.package_dependencies)) { foreach(dep, invoker.package_dependencies) { deps += [ ":${dep}_js" ] - args += [ "-s$out_dir/$dep.dill" ] + args += [ "-s" + rebase_path("$out_dir/$dep.dill", root_build_dir) ] } } @@ -272,10 +272,10 @@ template("package_kernel_outline") { module = invoker.package output = "$target_gen_dir/${module}_outline.dill" - sdk_outline = rebase_path(sdk_outline_dill) + sdk_outline = rebase_path(sdk_outline_dill, root_build_dir) package_config = - rebase_path("$root_out_dir/../../.dart_tool/package_config.json") + rebase_path("../../.dart_tool/package_config.json", root_build_dir) prebuilt_dart_action(target_name) { deps = [ @@ -286,16 +286,16 @@ template("package_kernel_outline") { outputs = [ output ] args = [ "--packages-file", - "file:///$package_config", + package_config, "--summary-only", "--target", "ddc", "--dart-sdk-summary", - "file:///$sdk_outline", + sdk_outline, "--source", "package:$module/$module.dart", "--output", - rebase_path(output), + rebase_path(output, root_build_dir), ] if (defined(invoker.extra_libraries)) { foreach(lib, invoker.extra_libraries) { @@ -462,7 +462,7 @@ template("ddc_compile_sdk") { "--modules", "$module", "-o", - rebase_path("$js_gen_dir/$module/dart_sdk.js"), + rebase_path("$js_gen_dir/$module/dart_sdk.js", root_build_dir), ] } @@ -481,8 +481,8 @@ template("ddc_compile_sdk") { # orignal source files while running SDK test suites. # These JavaScript files and source maps are no longer packaged into the # released SDK. - rebase_path("$target_gen_dir/../../../dart-sdk"), - rebase_path("$sdk_full_dill"), + rebase_path("$target_gen_dir/../../../dart-sdk", root_build_dir), + rebase_path("$sdk_full_dill", root_build_dir), ] if (invoker.canary) { diff --git a/utils/dynamic_module_runner/BUILD.gn b/utils/dynamic_module_runner/BUILD.gn index d550347dff6..cc4897fedba 100644 --- a/utils/dynamic_module_runner/BUILD.gn +++ b/utils/dynamic_module_runner/BUILD.gn @@ -15,7 +15,8 @@ aot_snapshot("dynamic_module_runner_snapshot") { name = "dynamic_module_runner" gen_kernel_args = [ "--dynamic-interface=" + rebase_path( - "$_dart_root/utils/dynamic_module_runner/dynamic_interface.yaml") ] + "$_dart_root/utils/dynamic_module_runner/dynamic_interface.yaml", + root_build_dir) ] } aot_snapshot("dynamic_modules_test_suite_snapshot") {