Always expose ctx.var["BINDIR"] to actions
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
At aspect we're working on a new ruleset where every action spawn of a `js_binary` needs to know the `BINDIR` variable.
Every Bazel action implicitly knows the bindir, as the paths for output files have it as a prefix. Thus adding it shouldn't cause any new action cache invalidations.
Today users can already do this, such as in `genrule` by referencing `BINDIR=$(BINDIR)` or in `ctx.actions.run` with `env = { "BINDIR": ctx.bin_dir.path}`. However, this makes an extra burden for users of rules there is no standard name for this environment variable, and the tool which needs this in the environment ought to be an abstraction which doesn't leak to the callsites.
Contributor guide
Research direction
Start by tracing how actions expose environment variables and how ctx.var and BINDIR are handled for js_binary and ctx.actions.run. Confirm the behavior against existing genrule handling; done means every action can access BINDIR without callers explicitly adding it or causing new action cache invalidations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100