buildtools icon indicating copy to clipboard operation
buildtools copied to clipboard

Buildozer: Handle multiple glob arguments in 'set' arguments

Open stagnation opened this issue 11 months ago • 1 comments

Following on #100 and #99

Ideally, we'd find a more general solution.

The special case for single argument glob works fine, but with multiple arguments it again parses the glob as individual files.

$ buildozer 'set srcs glob(["*.c"])' //:foobar
fixed /.../buildozer/glob-multiple-args/BUILD.bazel
$ cat BUILD.bazel
cc_library(
    name = "foobar",
    srcs = glob(["*.c"]),
)
$ buildozer 'set srcs glob(["*.c", "*.h"])' //:foobar
fixed /.../buildozer/glob-multiple-args/BUILD.bazel
$ cat BUILD.bazel
cc_library(
    name = "foobar",
    srcs = [
        "\"*.h\"])",
        "glob([\"*.c\",",
    ],
)

stagnation avatar Mar 11 '24 10:03 stagnation

I'll take a look and see if I can improve the special handling of globs here.

stagnation avatar Mar 11 '24 11:03 stagnation