rules_proto
rules_proto copied to clipboard
Add current_proto_toolchain
After asking in https://bazelbuild.slack.com/archives/C04281DTLH0/p1716279966809639 I gave it a tried, and it seems to be working.
The implementation is based on https://github.com/bazelbuild/rules_python/blob/730a2e39bd2702910f28629d4583b3ec49f4ee5e/python/current_py_toolchain.bzl
Tested with the following snippet:
load("@rules_proto//proto:defs.bzl", "current_proto_toolchain")
current_proto_toolchain(
name = "current_proto_toolchain",
visibility = ["//visibility:public"],
)
genrule(
name = "x",
srcs = [":current_proto_toolchain"],
outs = ["x"],
cmd = "$(PROTOC) > $(OUTS)",
toolchains = [":current_proto_toolchain"],
)
How should we test this feature?
Is there any other preferred alternative for exposing the current protoc binary after toolchain resolution?