Skip to content

Commit

Permalink
Fallback to native cc_proto_aspect
Browse files Browse the repository at this point in the history
This is needed to support older Bazel versions.

PiperOrigin-RevId: 688817336
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Oct 23, 2024
1 parent 5706140 commit 914a1f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion bazel/private/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ bzl_library(

bzl_library(
name = "cc_proto_aspect_bzl",
srcs = ["cc_proto_aspect.bzl"],
srcs = [
"cc_proto_aspect.bzl",
],
deps = [":bazel_cc_proto_library_bzl"],
)

Expand Down
5 changes: 3 additions & 2 deletions bazel/private/cc_proto_aspect.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Exposes cc_proto_aspect to rules_rust"""

load("//bazel/private:bazel_cc_proto_library.bzl", _cc_proto_aspect = "cc_proto_aspect")
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
cc_proto_aspect = _cc_proto_aspect if not hasattr(native, "cc_proto_library") else _native_cc_proto_aspect
2 changes: 2 additions & 0 deletions bazel/private/native.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Renames toplevel symbols so they can be exported in Starlark under the same name"""

native_proto_common = proto_common_do_not_use

native_cc_proto_aspect = cc_proto_aspect

0 comments on commit 914a1f4

Please sign in to comment.