andyscott / misc_rules

bazel rules for: shellcheck, yamllint, black
Apache License 2.0
11 stars 3 forks source link

Bazel error #12

Open chrislovecnm opened 4 years ago

chrislovecnm commented 4 years ago

I'm getting

Analysis of target '//cmd/cockroach-operator:cockroach-operator' failed; build aborted: invalid registered toolchain '@misc_rules//toolchains:shellcheck_from_host_path': no such package '@misc_rules//toolchains': BUILD file not found in directory 'toolchains' of external repository @misc_rules. Add a BUILD file to a directory to mark it as a package.

WORKSPACE snippet

git_repository(
    name = "misc_rules",
    commit = "0ad0b02af9e4b46717e8918c4c75b32eb71d9838",
    remote = "git://github.com/andyscott/misc_rules",
)

register_toolchains(
    "@misc_rules//toolchains:shellcheck_from_host_path",
)

Bazel:

$ bazel version
Build label: 3.4.1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jul 14 06:27:53 2020 (1594708073)
Build timestamp: 1594708073
Build timestamp as int: 1594708073

OS:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
shiwano commented 3 years ago

I think the toolchain path is wrong. The error may be fixed by the following code:

register_toolchains(
    "@misc_rules//toolchains/shellcheck:shellcheck_from_host_path",
)

In my case (but yamllint), it worked.