bazel-contrib / bazel-contrib/bazel-lib
Feature request: genrule with directory output / run_binary with command input
- Dominant language
- Starlark
- Stars
- 182
- Forks
- 134
- Avg merge
- 1d 46m
- Merged PRs (30d)
- 1
Description
I'm interested in a rule that takes a shell command string as input like `genrule` but supports directories as outputs like `run_binary`. Would the maintainers of this library be receptive to a PR adding one?
My intuition would be to add a rule `run_shell` that shares a lot of the code of `run_binary`. But I can also imagine just adding a parameter to `run_binary` (incompatible with `tool`).
Yes, one can just use `run_binary` with `sh_binary`, but that requires to targets instead of one, plus a `.sh` file (or a third `write_file` target). If your script is more than a few lines, that's probably the better approach anyways, but it feels like a lot of boilerplate when I just want to do a simple transformation over an indeterminate number of files.
Contributor guide
Research direction
Read the existing genrule and run_binary implementations first, then compare the proposed run_shell rule with the alternatives using sh_binary and write_file. Clarify whether the API should be a new rule or a run_binary parameter, and whether tool support is excluded. Done means a shell-command rule can produce directory outputs without the extra target and script boilerplate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100