Add support for expansions in expand_template#525
Add support for expansions in expand_template#525keith wants to merge 1 commit intobazelbuild:mainfrom
Conversation
44814b2 to
1b19c61
Compare
This can be useful for encoding the paths to things in your expansions
1b19c61 to
d5ae39f
Compare
| def _expand_template_impl(ctx): | ||
| expanded_substitutions = {} | ||
| for key, value in ctx.attr.substitutions.items(): | ||
| expanded_substitutions[key] = ctx.expand_make_variables( |
There was a problem hiding this comment.
ctx.expand_make_variable is marked as "Deprecated" in Bazel documentation. People before me marked it that way and I think we shouldn't introduce new uses.
Please remove it's use.
I believe it's implementable in Starlark, and skylib would be a nice location for such an implementation. (And we might already have one implementation in the C++ rules in builtins).
The rest of the PR seems fine.
There was a problem hiding this comment.
relevant convo https://groups.google.com/g/bazel-discuss/c/WEnG-WocaTc
so you're saying we should make a new function to do the same thing in skylib and use that here?
There was a problem hiding this comment.
Yes. I bumped bazelbuild/bazel#5859 to P3.
And I noticed also #486 which might already be doing that. Would you like to help in review?
There might be other PRs, I haven't gone through all of them yet.
This is useful for providing paths from data, and custom variables from toolchains