Expand make variables depricated?

130 views
Skip to first unread message

Sergey Vlasov

unread,
Jun 30, 2024, 7:04:13 PM6/30/24
to bazel-discuss
Hi
I saw in the document:

https://bazel.build/rules/lib/builtins/ctx#expand_make_variables

that ctx.expand_make_variables is depricated and "Use ctx.var to access the variables instead". 

But ctx.var is only a dictionary... 

Now I need implement expanding function myself?

Alex Humesky

unread,
Jul 1, 2024, 5:09:47 PM7/1/24
to Sergey Vlasov, bazel-discuss

This is the relevant github issue: https://github.com/bazelbuild/bazel/issues/5859
It's a P4 and I don't think anybody has thought about it seriously in a couple years, so I think it will be fine for a while.
You could go with the suggestion in the github issue and instead of using the "$(var)" syntax, you could use "{var}" and use the built-in format function:

ctx.attr.content.format(**ctx.var)

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/117b6901-2deb-4100-ab17-034ea2d23e30n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages