bazelbuild / buildtools

A bazel BUILD file formatter and editor
Apache License 2.0
1.01k stars 415 forks source link

buildozer doesn't accept "BUILD.bazel" #1240

Open Zemnmez opened 7 months ago

Zemnmez commented 7 months ago

my repo uses "BUILD.bazel" instead of "BUILD", which I believe is the current standard. however, buildozer doesn't support this :(

/home/thomas/devel/monorepo/sh/project/cultist/multiplayer/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/ts/math/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/ts/react/CopyToClipboard/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/ts/pulumi/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/bzl/hash/test/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/ts/math/canvas/braille/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/ts/pulumi/pleaseintroducemetoyour.dog/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/bzl/transcode_web/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/project/zemn.me/components/BUILD: file not found or not readable
/home/thomas/devel/monorepo/sh/project/ck3/recursive-vassals/BUILD: file not found or not readable
stagnation commented 7 months ago

What commands do you run?

Do you have mixed BUILD and BUILD.bazel files? I looked around and could not reproduce it with only BUILD.bazel files, but if I create a BUILD in the root and a nested BUILD.bazel it fails.

$ ls
$ touch BUILD.bazel
$ buildozer 'new cc_library foobar'  //:__pkg__
fixed .../task/buildozer/build-files/BUILD.bazel
$ buildozer 'add srcs foobar.c' //:foobar
fixed .../task/buildozer/build-files/BUILD.bazel
$ buildozer -f <(echo 'new cc_library bar|//:__pkg__')
fixed .../task/buildozer/build-files/BUILD.bazel
$ cat BUILD.bazel
cc_library(
    name = "foobar",
    srcs = ["foobar.c"],
)

cc_library(name = "bar")

Now create a root BUILD and a nested BUILD.bazel

$ mkdir nested
$ touch BUILD.bazel
$ mv BUILD.bazel BUILD
$ buildozer 'new py_library nested' //nested:__pkg__
.../task/buildozer/build-files/nested/BUILD: file not found or not readable