Move py_proto_library toolchain into protobuf repository.

PiperOrigin-RevId: 671292735
pull/18068/head
Protobuf Team Bot 6 months ago committed by Copybara-Service
parent b8764f0941
commit 3c3d4900bc
  1. 5
      bazel/private/BUILD
  2. 8
      bazel/py_proto_library.bzl

@ -7,6 +7,11 @@ toolchain_type(
name = "proto_toolchain_type",
)
toolchain_type(
name = "python_toolchain_type",
visibility = ["//visibility:public"],
)
bzl_library(
name = "upb_proto_library_internal_bzl",
srcs = [

@ -5,7 +5,7 @@ load("//bazel/common:proto_common.bzl", "proto_common")
load("//bazel/common:proto_info.bzl", "ProtoInfo")
load("//bazel/private:toolchain_helpers.bzl", "toolchains")
PY_PROTO_TOOLCHAIN = "@rules_python//python/proto:toolchain_type"
_PY_PROTO_TOOLCHAIN = Label("//bazel/private:python_toolchain_type")
_PyProtoInfo = provider(
doc = "Encapsulates information needed by the Python proto rules.",
@ -50,9 +50,9 @@ def _py_proto_aspect_impl(target, ctx):
))
if proto_common.INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION:
toolchain = ctx.toolchains[PY_PROTO_TOOLCHAIN]
toolchain = ctx.toolchains[_PY_PROTO_TOOLCHAIN]
if not toolchain:
fail("No toolchains registered for '%s'." % PY_PROTO_TOOLCHAIN)
fail("No toolchains registered for '%s'." % _PY_PROTO_TOOLCHAIN)
proto_lang_toolchain_info = toolchain.proto
else:
proto_lang_toolchain_info = getattr(ctx.attr, "_aspect_proto_toolchain")[proto_common.ProtoLangToolchainInfo]
@ -126,7 +126,7 @@ _py_proto_aspect = aspect(
attr_aspects = ["deps"],
required_providers = [ProtoInfo],
provides = [_PyProtoInfo],
toolchains = toolchains.use_toolchain(PY_PROTO_TOOLCHAIN),
toolchains = toolchains.use_toolchain(_PY_PROTO_TOOLCHAIN),
)
def _py_proto_library_rule(ctx):

Loading…
Cancel
Save