bazelbuild / rules_proto

Protocol buffer rules for Bazel
Apache License 2.0
161 stars 69 forks source link

Unexpected buildifier error after upgrading to v6.0.0: Repository '@@bazel_features_globals' is not defined #212

Open johanbrandhorst opened 2 months ago

johanbrandhorst commented 2 months ago

Hi! My repository (grpc-gateway) auto-updated to v6.0.0 a while back but the CI buildifier job started failing, like so:

ERROR: error loading package '@@com_github_bazelbuild_buildtools//build_proto': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/defs.bzl:18:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/proto_toolchain.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain.bzl:20:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain_rule.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/bazel_features/features.bzl:3:6: Unable to find package for @@bazel_features_globals//:globals.bzl: The repository '@@bazel_features_globals' could not be resolved: Repository '@@bazel_features_globals' is not defined.
ERROR: /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/com_github_bazelbuild_buildtools/edit/BUILD.bazel:3:11: error loading package '@@com_github_bazelbuild_buildtools//build_proto': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/defs.bzl:18:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/proto_toolchain.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain.bzl:20:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_proto/proto/private/rules/proto_toolchain_rule.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/bazel_features/features.bzl:3:6: Unable to find package for @@bazel_features_globals//:globals.bzl: The repository '@@bazel_features_globals' could not be resolved: Repository '@@bazel_features_globals' is not defined. and referenced by '@@com_github_bazelbuild_buildtools//edit:edit'
ERROR: Analysis of target '//:buildifier' failed; build aborted: Analysis failed

Full log: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9012070457/job/24760663351?pr=4266.

I made the change to WORKSPACE recommended in the release notes but I don't know how to fix this error. Any help would be appreciated. Thanks!

hgminh95 commented 2 months ago
load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()

These 2 lines in WORKSPACE make it works for me.

johanbrandhorst commented 2 months ago

That fixes the @@bazel_features_globals error, thank you, now I'm seeing

he repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined. and referenced by '@@io_bazel_rules_go//proto:protoc'

Any ideas for fixing this? Full logs: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9082583751/job/24959289319?pr=4266

johanbrandhorst commented 1 month ago

Updating rules_proto and rules_go simultaneously seems to have worked! See changes in https://github.com/grpc-ecosystem/grpc-gateway/pull/4356.

johanbrandhorst commented 1 month ago

Spoke too soon, I'm seeing a different error now: The repository '@@rules_python_internal' could not be resolved. Full error text:

ERROR: error loading package '@@com_google_protobuf//': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/com_google_protobuf/protobuf.bzl:3:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/defs.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/py_binary.bzl:19:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_macro_bazel.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_rule_bazel.bzl:19:5: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_executable_bazel.bzl:34:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_internal.bzl:23:6: Unable to find package for @@rules_python_internal//:py_internal.bzl: The repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined.
ERROR: /__w/grpc-gateway/grpc-gateway/protoc-gen-openapiv2/options/BUILD.bazel:21:14: error loading package '@@com_google_protobuf//': at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/com_google_protobuf/protobuf.bzl:3:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/defs.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/py_binary.bzl:19:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_macro_bazel.bzl:17:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_binary_rule_bazel.bzl:19:5: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_executable_bazel.bzl:34:6: at /github/home/.cache/bazel/_bazel_root/13dc60d22ee138725abf21b91435297b/external/rules_python/python/private/common/py_internal.bzl:23:6: Unable to find package for @@rules_python_internal//:py_internal.bzl: The repository '@@rules_python_internal' could not be resolved: Repository '@@rules_python_internal' is not defined. and referenced by '//protoc-gen-openapiv2/options:options_proto'

Log: https://github.com/grpc-ecosystem/grpc-gateway/actions/runs/9212749314/job/25345111154?pr=4356.

I'm reopening this issue rather than the rules_go issue since this seems related to the com_google_protobuf repository. Any help would be greatly appreciated.