Can not pass @glob ITEMs to other @glob goals
I have, not for the first time, encountered the following situation:
A directory contains a set of similar files, lets call them definitions.
./
- definitions/
- def1
- def2
- Makesurefile
- makesure
A Makesurefile contains glob goals for these definitions.
@goal make-foo @glob 'definitions/*'
process "$ITEM" "$(target_name_for "$ITEM")"
@goal upload-foo @glob 'definitions/*'
upload "$(target_name_for "$ITEM")"
Now upload-foo cannot depend on make-foo by forwarding its ITEM. I tried:
@depends_on 'make-foo@$ITEM'@depends_on "make-foo@$ITEM"@depends_on 'make-foo' @args ITEM@depends_on 'make-foo' @glob@depends_on 'make-foo' @glob ITEM@depends_on 'make-foo' @args "$ITEM"@depends_on 'make-foo' @args '$ITEM'
(I know not all are legal)
I also can not build a hybrid @param-@glob solution, since @globs are not callable (outside of calling makesure recursively), and @globs also can not forward their item.
I have two suggested solutions, in order of preference:
- Allow using
ITEMlike any other parameter, without any restrictions; and also allow calling@globgoals (with unmatched globbed items simply resulting in "goal not found" errors). - Allow forwarding between
@globgoals with identical glob strings by appending@globto the@depends_on(here, a more descriptive error message might be appropriate).
I can't think of really evil ways of abusing the first proposal, but the second one would of course be a lot more restricted and declarative. What do you think? I might even try contributing a patch if I find the time.
On further reflection, I underestimated the problem, since parameterized goals do not get instantiated without a dependency on them and the specific argument list. That makes even recursive makesure calls a non-viable workaround. I could still call @glob goals recursively, but then I need to implement the globbing in shell scripts as well.
I still think a lot would be gained by glob-forwarding and allowing ITEM after @args.
Thank you for this case. Indeed this looks like a useful feature to have. I’ll try to assess a viable implementation strategy.