Notice how the default key for the _windows_runner attribute, references runner.bat.template by the external dependency @com_github_bazelbuild_buildtools but the other _runner refers to it with an absolute path.
I use this project to configure a buildifier target in my own Bazel project:
load("@bazel_buildtools//buildifier:def.bzl", "buildifier")
buildifier(
name = "buildifier",
)
But when I upgraded to the latest version, v7.1.0, the target now fails with:
ERROR: /home/steve-261370/.cache/bazel/_bazel_steve-261370/2914a5da309afa1aa83708b7e78fb71f/external/com_github_bazelbuild_buildtools/buildifier/BUILD.bazel: no such target '@@com_github_bazelbuild_buildtools//buildifier:runner.bat.template': target 'runner.bat.template' not declared in package 'buildifier' defined by /home/steve-261370/.cache/bazel/_bazel_steve-261370/2914a5da309afa1aa83708b7e78fb71f/external/com_github_bazelbuild_buildtools/buildifier/BUILD.bazel (did you mean runner.bash.template?)
ERROR: /home/steve-261370/my-bazel-project/BUILD.bazel:10:11: every rule of type _buildifier implicitly depends upon the target '@@com_github_bazelbuild_buildtools//buildifier:runner.bat.template', but this target could not be found because of: no such target '@@com_github_bazelbuild_buildtools//buildifier:runner.bat.template': target 'runner.bat.template' not declared in package 'buildifier' defined by /home/steve-261370/.cache/bazel/_bazel_steve-261370/2914a5da309afa1aa83708b7e78fb71f/external/com_github_bazelbuild_buildtools/buildifier/BUILD.bazel (did you mean runner.bash.template?)
In #1011 support for windows was added. It added the new attribute label
_windows_runner
as follows:https://github.com/bazelbuild/buildtools/blob/v7.1.0/buildifier/internal/factory.bzl#L83
Notice how the default key for the
_windows_runner
attribute, referencesrunner.bat.template
by the external dependency@com_github_bazelbuild_buildtools
but the other_runner
refers to it with an absolute path.default = "//buildifier:runner.bash.template",
vs
default = "@com_github_bazelbuild_buildtools//buildifier:runner.bat.template",
I use this project to configure a buildifier target in my own Bazel project:
But when I upgraded to the latest version, v7.1.0, the target now fails with:
I ended up fixing this by replacing the line:
default = "@com_github_bazelbuild_buildtools//buildifier:runner.bat.template",
with
default = "//buildifier:runner.bat.template",