diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index c827f9d..ce6cb5f 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -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"]) diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 55d5a28..90ea055 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -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") diff --git a/examples/tools/toolchains/BUILD.bazel b/examples/tools/toolchains/BUILD.bazel index 1febe31..1286682 100644 --- a/examples/tools/toolchains/BUILD.bazel +++ b/examples/tools/toolchains/BUILD.bazel @@ -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. diff --git a/protoc/private/prebuilt_protoc_toolchain.bzl b/protoc/private/prebuilt_protoc_toolchain.bzl index 738af0b..795591e 100644 --- a/protoc/private/prebuilt_protoc_toolchain.bzl +++ b/protoc/private/prebuilt_protoc_toolchain.bzl @@ -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",