Skip to content

Implement run_shell in Starlark - #64

Open
fmeum wants to merge 3 commits into
mainfrom
fmeum/run_shell_subrule
Open

Implement run_shell in Starlark#64
fmeum wants to merge 3 commits into
mainfrom
fmeum/run_shell_subrule

Conversation

@fmeum

@fmeum fmeum commented Jun 9, 2026

Copy link
Copy Markdown
Member

No description provided.

fmeum and others added 3 commits June 9, 2026 15:12
- Load bzl_library in shell/toolchains/BUILD (was a build failure)
- Correct run_shell ctx docstring to reference the exec toolchain type and
  document shadowed_action/resource_set
- Guard the Unix sh_exec_toolchain target on a non-empty shell path, matching
  the Windows template; fix "runtim" typo
- Route run_shell_script_args and run_shell_helper_script_args through the new
  run_shell wrapper, and add the missing exec toolchain to those rules
- run_shell forwards `arguments` into the spilled helper script, so update the
  helper_script_args_spilled golden and comments accordingly, fixing
  bazelbuild/bazel#29365
- Misc comment/grammar fixes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Now that run_shell forwards arguments into the spilled helper script, the
output path no longer needs to be embedded directly in the command.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fmeum
fmeum requested a review from dzbarsky June 9, 2026 17:08
@fmeum

fmeum commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@dzbarsky This is ready for a first review :-)

@fmeum
fmeum marked this pull request as ready for review June 9, 2026 17:08
_UNIX_SH_TOOLCHAIN_TEMPLATE = """
_UNIX_SH_TOOLCHAINS_TEMPLATE = """
sh_toolchain(
name = "{os}_sh",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we rename this one to _target and alias the old name?

toolchain = ":{os}_sh",
toolchain_type = "@rules_shell//shell:toolchain_type",
toolchain_type = SH_TOOLCHAIN_TYPE,
target_compatible_with = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, i had never looked at this before, didn't realize it was always target-only. I'm surprised this ever really worked :)

build, for example, "Compiling foo.cc to create foo.o". The message
may contain `%{label}`, `%{input}`, or `%{output}` patterns, which
are substituted with label string, first input, or output's path,
respectively. Prefer to use patterns instead of static strings,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Prefer to use patterns instead of concatenated strings" or similar? A true static string is fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants