Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.

Commit d613a64

Browse files
committed
Include correction hint
1 parent 31bae05 commit d613a64

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

generate/rules.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@bazel_skylib//lib:shell.bzl", "shell")
22
load("//util:path.bzl", "output_name", "runfile_path")
33
load(":providers.bzl", "FormatterInfo")
44

5-
def _create_runner(runfiles_fn, name, bash_runfiles, actions, bin, diff_bin, dir_mode, file_mode, run_bin, runner_template, file_defs, workspace_name):
5+
def _create_runner(runfiles_fn, name, bash_runfiles, actions, bin, diff_bin, dir_mode, file_mode, label, run_bin, runner_template, file_defs, workspace_name):
66
check_args = ["--"]
77
write_args = []
88
diffs = []
@@ -41,6 +41,7 @@ def _create_runner(runfiles_fn, name, bash_runfiles, actions, bin, diff_bin, dir
4141
substitutions = {
4242
"%{check_args}": shell.quote(runfile_path(workspace_name, check_args_file)),
4343
"%{dir_mode}": shell.quote(dir_mode),
44+
"%{label}": shell.quote(str(label)),
4445
"%{file_mode}": shell.quote(file_mode),
4546
"%{write_args}": shell.quote(runfile_path(workspace_name, write_args_file)),
4647
},
@@ -95,6 +96,7 @@ def _format_impl(ctx):
9596
dir_mode = dir_mode,
9697
file_defs = file_defs,
9798
file_mode = file_mode,
99+
label = label,
98100
name = name,
99101
run_bin = run,
100102
runfiles_fn = ctx.runfiles,
@@ -211,6 +213,7 @@ def _generate_impl(ctx):
211213
dir_mode = dir_mode,
212214
file_defs = file_defs,
213215
file_mode = file_mode,
216+
label = label,
214217
name = name,
215218
run_bin = run,
216219
runfiles_fn = ctx.runfiles,

generate/runner.sh.tpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
1414
set -e
1515

1616
if [ "${1-}" = check ]; then
17-
exec "$(rlocation rules_file/generate/run/bin)" check @"$(rlocation %{check_args})"
17+
if "$(rlocation rules_file/generate/run/bin)" check @"$(rlocation %{check_args})"; then
18+
exit
19+
else
20+
code="$?"
21+
echo 'To correct, run bazel run '%{label}
22+
exit "$code"
23+
fi
1824
fi
1925

2026
if ! [ -z "${BUILD_WORKSPACE_DIRECTORY-}" ]; then

0 commit comments

Comments
 (0)