buildtools
buildtools copied to clipboard
should print formatting be 'source' compatible
$ buildozer 'print srcs' //some:target
glob(
["*.foo"],
exclude = [
"a.foo",
"b.foo",
],
)
however, if i do the same with a simple srcs list
$ buildozer 'print srcs' //some/other:target
[a.foo b.foo]
i get no quotation marks and no commas.
I naively assumed expected the result of 'print' to be similar to the actual source code in the BUILD file
deleting this condition https://github.com/bazelbuild/buildtools/blob/master/edit/buildozer.go#L310
fixes this issue, @laurentlb thought this might break users.
This effectively makes the output not parseable since spaces in the attributes are indistinguishable from the separators - any chance an argument could be added to print the output with commas & quotes to not break existing users?
@vladmos I could try to hack a PR together if you had a preferred approach here?
Perhaps we can try to change the current behavior and I'll try to estimate how many existing users are broken by that, at least internally. Then we can decide if we need a special flag.
@leos If you want to send a PR please do it.
Thanks @vladmos - is there a guide/wiki on setting up a dev env and running tests for buildozer?
Just running bazel test //...
in the repository root should be enough.
+1 to the list of users broken by this behavior (we use Bazel in googleapis org and we sometimes have values with spaces which all get screwed up). I was thinking, do you folks look into changing the existing behavior of print
command (possibly breaking users), or maybe have a better command - call it print_json
, or print_list
, or whatever, that will do the right machine readable thing? Happy to send a PR.