|
|
@ -5,7 +5,7 @@ load("//bazel/common:proto_common.bzl", "proto_common") |
|
|
|
load("//bazel/common:proto_info.bzl", "ProtoInfo") |
|
|
|
load("//bazel/common:proto_info.bzl", "ProtoInfo") |
|
|
|
load("//bazel/private:toolchain_helpers.bzl", "toolchains") |
|
|
|
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( |
|
|
|
_PyProtoInfo = provider( |
|
|
|
doc = "Encapsulates information needed by the Python proto rules.", |
|
|
|
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: |
|
|
|
if proto_common.INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION: |
|
|
|
toolchain = ctx.toolchains[PY_PROTO_TOOLCHAIN] |
|
|
|
toolchain = ctx.toolchains[_PY_PROTO_TOOLCHAIN] |
|
|
|
if not 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 |
|
|
|
proto_lang_toolchain_info = toolchain.proto |
|
|
|
else: |
|
|
|
else: |
|
|
|
proto_lang_toolchain_info = getattr(ctx.attr, "_aspect_proto_toolchain")[proto_common.ProtoLangToolchainInfo] |
|
|
|
proto_lang_toolchain_info = getattr(ctx.attr, "_aspect_proto_toolchain")[proto_common.ProtoLangToolchainInfo] |
|
|
@ -126,7 +126,7 @@ _py_proto_aspect = aspect( |
|
|
|
attr_aspects = ["deps"], |
|
|
|
attr_aspects = ["deps"], |
|
|
|
required_providers = [ProtoInfo], |
|
|
|
required_providers = [ProtoInfo], |
|
|
|
provides = [_PyProtoInfo], |
|
|
|
provides = [_PyProtoInfo], |
|
|
|
toolchains = toolchains.use_toolchain(PY_PROTO_TOOLCHAIN), |
|
|
|
toolchains = toolchains.use_toolchain(_PY_PROTO_TOOLCHAIN), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def _py_proto_library_rule(ctx): |
|
|
|
def _py_proto_library_rule(ctx): |
|
|
|