From 40acd3277876dce0067ce8f5d623dcc61e623114 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 3 Jun 2026 12:33:31 -0700 Subject: [PATCH] [build] Remove unused "exec_script" mode from gn_run_binary.py. Change-Id: Ie7d184dfe1694985fdff318736f34b45267a5bf3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509141 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- build/dart/dart_action.gni | 6 ++---- build/gn_run_binary.py | 23 ++++++----------------- tools/debian_package/BUILD.gn | 1 - utils/compile_platform.gni | 10 ++++------ utils/dart2wasm/BUILD.gn | 1 - utils/kernel-service/BUILD.gn | 9 +++------ 6 files changed, 15 insertions(+), 35 deletions(-) diff --git a/build/dart/dart_action.gni b/build/dart/dart_action.gni index 244dc70a43f..be565f337b0 100644 --- a/build/dart/dart_action.gni +++ b/build/dart/dart_action.gni @@ -89,9 +89,7 @@ template("_compiled_action") { deps += invoker.deps } - # The "compiled_action" argument to gn_run_binary.py indicates that - # it will exit with a non-zero status when the target program does. - args = [ "compiled_action" ] + args = [] if (_is_dart && use_rbe && host_os == rbe_os && host_cpu == rbe_cpu) { args += [ @@ -147,7 +145,7 @@ template("_prebuilt_tool_action") { inputs += [ invoker.dfe ] } - args = [ "compiled_action" ] + args = [] if (_is_dart && use_rbe && host_os == rbe_os && host_cpu == rbe_cpu) { args += [ diff --git a/build/gn_run_binary.py b/build/gn_run_binary.py index 26dc769a7e6..aa8f5fe00cb 100755 --- a/build/gn_run_binary.py +++ b/build/gn_run_binary.py @@ -5,12 +5,9 @@ """Helper script for GN to run an arbitrary binary. See compiled_action.gni. Run with: - python3 gn_run_binary.py [args ...] + python3 gn_run_binary.py [args ...] -Where is either "compiled_action" or "exec_script". If it is -"compiled_action" the script has a non-zero exit code on a failure. If it is -"exec_script" the script has no output on success and produces output otherwise, -but always has an exit code of 0. +Swallows output on success. """ import os @@ -36,30 +33,22 @@ def _decode(bytes): def main(argv): - error_exit = 0 - if argv[1] == "compiled_action": - error_exit = 1 - elif argv[1] != "exec_script": - print("The first argument should be either " - "'compiled_action' or 'exec_script") - return 1 - # Unless the path is absolute, this script is designed to run binaries # produced by the current build, which is the current working directory when # this script is run. - path = os.path.abspath(argv[2]) + path = os.path.abspath(argv[1]) if not os.path.isfile(path): print("Binary not found: " + path) - return error_exit + return 1 # The rest of the arguments are passed directly to the executable. - args = [path] + argv[3:] + args = [path] + argv[2:] result = run_command(args) if result != 0: print(result) - return error_exit + return 1 return 0 diff --git a/tools/debian_package/BUILD.gn b/tools/debian_package/BUILD.gn index ab73660b1b7..d49f8d5c301 100644 --- a/tools/debian_package/BUILD.gn +++ b/tools/debian_package/BUILD.gn @@ -38,7 +38,6 @@ if (is_linux) { outputs = [ "$root_out_dir/dart_${version}-1_${debian_arch}.deb" ] script = "../../build/gn_run_binary.py" args = [ - "compiled_action", rebase_path("create_debian_package.py"), "--version=$version", "--timestamp=$timestamp", diff --git a/utils/compile_platform.gni b/utils/compile_platform.gni index 78780b061cf..4bdd9a8b6f9 100644 --- a/utils/compile_platform.gni +++ b/utils/compile_platform.gni @@ -68,12 +68,10 @@ template("compile_platform") { depfile = outputs[0] + ".d" script = "$_dart_root/build/gn_run_binary.py" - args = [ - "compiled_action", - rebase_path(get_label_info(compile_platform_tool, "root_out_dir") + - "/compile_platform.exe", - root_build_dir), - ] + args = + [ rebase_path(get_label_info(compile_platform_tool, "root_out_dir") + + "/compile_platform.exe", + root_build_dir) ] args += invoker.args if (defined(invoker.single_root_scheme)) { args += [ "--single-root-scheme=" + invoker.single_root_scheme ] diff --git a/utils/dart2wasm/BUILD.gn b/utils/dart2wasm/BUILD.gn index 0edf8ffebaf..d0086442462 100644 --- a/utils/dart2wasm/BUILD.gn +++ b/utils/dart2wasm/BUILD.gn @@ -11,7 +11,6 @@ template("wasm_module") { action(target_name) { script = rebase_path("//build/gn_run_binary.py") args = [ - "compiled_action", rebase_path("//third_party/emsdk/upstream/emscripten/emcc"), "--no-entry", rebase_path("//tests/web/wasm/ffi/${invoker.module_name}.c"), diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn index a1af20069ad..7eb3b585329 100644 --- a/utils/kernel-service/BUILD.gn +++ b/utils/kernel-service/BUILD.gn @@ -112,12 +112,9 @@ template("kernel_service_dill") { scheme = "org-dartlang-kernel-service" script = "$_dart_root/build/gn_run_binary.py" - args = [ - "compiled_action", - rebase_path( - get_label_info(gen_kernel_tool, "root_out_dir") + "/gen_kernel.exe", - root_build_dir), - ] + args = [ rebase_path(get_label_info(gen_kernel_tool, "root_out_dir") + + "/gen_kernel.exe", + root_build_dir) ] args += invoker.extra_args args += [ "--depfile=" + rebase_path(depfile, root_build_dir),