buildozer dict_add/dict_set does not allow for colons in keys
The current buildozer syntax for dict_add and dict_set requires users to pass in colon-delimited strings do distinguish between keys and values. Unfortunately, at least one use case, the label_keyed_string_dict attribute, is not supported by this scheme -- there is no way to tell buildozer what colon to use for the split -- it always tries to use the first one.
Say you have a rule like this:
foo(
name = "foo",
)
With an attribute d that is a label_keyed_string_dict. I want to add a value like "//foo/bar:baz": hello-there" to d. The only available buildozer syntax is something like this:
$ buildozer 'dict_add d //foo/bar:baz:hello-there' //:foo
Which results in:
foo(
name = "foo",
d = {"//foo/bar": "baz:hello-there"},
)
Which is not desired. Escaping the first colon with \'s does not work either: they end up in the key string.
Potential solutions:
- Allow for escaping the colons that are not to be used as split parameters
- Change the input to allow for keys and values to be separate arguments
I just ran into the same thing and it broke some targets. It's definitely surprising that quoting works for the value but not for the key.