buildtools
buildtools copied to clipboard
[buildozer]: Support adding symbols instead of literal strings
If I want to, for example, add a symbol with a value to a list, that is not possible right now.
buildozer 'add tags SOME_CONST' //pkg:target
-->
some_rule(
name = "target",
tags = ["SOME_CONST"],
...
)
What I want is the ability to do something such as:
buildozer --symbol 'add tags SOME_CONST' //pkg:target
-->
some_rule(
name = "target",
tags = [SOME_CONST],
...
)
and
buildozer --symbol 'set tags LIST_CONST' //pkg:target
-->
some_rule(
name = "target",
tags = LIST_CONST,
...
)
In this way, we can use buildozer better for larger refactors if we want to centralize control of a few key attributes without needing to create a mess of macros and rules.
Nice idea! I have historically wanted all tags to be included as literals, to have a centralized location with documentation for what they all mean. And to reduce the risk of typos that are very hard to catch after the fact.
At one point I tried to do a post-process sed
to make them literals after the fact, I think that should work. I did not look into the tables
configuration to temporarily define tags as not-strings either, though maybe that works.