Repository dependencies in workspace rules
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the problem / feature request:
In a workspace rule, I can specify attributes of Label type. These labels, however, can only be used in limited ways. In particular, when fed to `repository_ctx.path()` they must refer to *one* regular file, and a regular file at that, and one that can't be generated. If I want one external repository A to depend on the entire content of another repository B, I can't express that. I have to list specific files as inputs. If the content of those files I list as inputs doesn't change as frequently as B, then I get an under approximation of how often the rule for A has to be rerun.
### Feature requests: what underlying problem are you trying to solve with this feature?
In `BUILD` files, I can depend on *targets* rather than files. So I can have a target that stands for say a filegroup of all files under a directory. In `WORKSPACE` files, I don't have that. Understandably, I can't depend on generated files, but it would be very convenient if target-like special cases would be supported. For example, I would imagine that allowing a label that refers to the entire external repository would be easy to implement.
For the sake of discussion, let me steal some syntax for such a label. Say `@foo` means "all the files in repository foo". Then I could have:
```
some_rule(
name = "bar",
deps = ["@foo"],
...
)
```
Then Bazel would always rerun the rule for `@bar` if it reran the rule for `@foo`.
cc @guibou
Contributor guide
Assessment
This issue has not been assessed yet.