The symbol has been removed from Bazel 8, so any reference to it results in an error. Using bazel_features, a bzl file with a reference is generated, based on Bazel version. Protobuf 29.x doesn't have this problem because cc_proto_aspect wasn't exposed. But we should still cherry-pick exposing the aspect and this change to 29.x line, to make transition of rules_rust easier. Closes: https://github.com/protocolbuffers/protobuf/pull/19576 PiperOrigin-RevId: 715064854pull/19974/head
parent
4a92a1c9bf
commit
fa02f768e3
4 changed files with 8 additions and 6 deletions
@ -1,6 +1,7 @@ |
||||
"""Exposes cc_proto_aspect to rules_rust""" |
||||
|
||||
load("@proto_bazel_features//:features.bzl", "bazel_features") |
||||
load("//bazel/private:bazel_cc_proto_library.bzl", _cc_proto_aspect = "cc_proto_aspect") # buildifier: disable=bzl-visibility |
||||
load("//bazel/private:native.bzl", _native_cc_proto_aspect = "native_cc_proto_aspect") # buildifier: disable=bzl-visibility |
||||
|
||||
cc_proto_aspect = _cc_proto_aspect if not hasattr(native, "cc_proto_library") else _native_cc_proto_aspect |
||||
# This resolves to Starlark cc_proto_aspect in Bazel 8 or with --incompatible_enable_autoload flag |
||||
cc_proto_aspect = getattr(bazel_features.globals, "cc_proto_aspect", None) or _cc_proto_aspect |
||||
|
Loading…
Reference in new issue