Skip to content

Commit

Permalink
Fix compatibility with rules_proto 7 (#30)
Browse files Browse the repository at this point in the history
* Fix compatibility with rules_proto 7

* Apply buildifier fixes
  • Loading branch information
fmeum authored Nov 14, 2024
1 parent 0ffd305 commit 382ae8d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_python//python:proto.bzl", "py_proto_library")
load("@rules_go//proto:def.bzl", "go_proto_library")

package(default_visibility = ["//visibility:public"])

Expand Down
2 changes: 1 addition & 1 deletion examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ register_toolchains("@toolchains_protoc_hub//:all")
# - proto_lang_toolchain rule [name]
# - toolchain rule [name]_toolchain
# and the second one is valid for registration.
# Attempting to register a proto_lang_toolchain rule as a toolchain gives a baffling error like
# Attempting to register a proto_lang_toolchain rule as a toolchain gives a baffling error like
# Misconfigured toolchains: //tools:protoc_java_toolchain is declared as a toolchain but has inappropriate dependencies.
# Declared toolchains should be created with the 'toolchain' rule and should not have dependencies that themselves require toolchains.
register_toolchains("//tools/toolchains:all")
Expand Down
2 changes: 1 addition & 1 deletion examples/tools/toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ define a cc toolchain that doesn't work, by using 'false' as the compiler.
See https://bazel.build/tutorials/ccp-toolchain-config
"""

load("defs.bzl", "cc_toolchain_config")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
load("defs.bzl", "cc_toolchain_config")

# Configure protoc to have the right arguments for generating Python stubs.
# NB: the protobuf team intends to remove --python_out and instead use a protoc plugin for Python stub emit.
Expand Down
7 changes: 4 additions & 3 deletions protoc/private/prebuilt_protoc_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ def _prebuilt_protoc_repo_impl(rctx):
)
build_content = """\
# Generated by @rules_proto//proto/toolchains:prebuilt_protoc_toolchain.bzl
load("@rules_proto//proto/private/rules:proto_toolchain_rule.bzl", "proto_toolchain")
package(default_visibility=["//visibility:public"])
# This is a workaround for proto_toolchain not allowing to set visibility.
package(default_visibility = ["//visibility:public"])
load("@rules_proto//proto:proto_toolchain.bzl", "proto_toolchain")
proto_toolchain(
name = "prebuilt_protoc_toolchain",
proto_compiler = "{protoc_label}",
visibility = ["//visibility:public"],
)
""".format(
protoc_label = ":bin/protoc.exe" if rctx.attr.platform.startswith("win") else ":bin/protoc",
Expand Down

0 comments on commit 382ae8d

Please sign in to comment.