6.0.0-rc3
NEW FEATURES
When used with Bazel 7, Protobuf Toolchainization is now available. This allows you to choose where the protobuf compiler (protoc
) comes from, as well as configure a toolchain for each language you generate proto stubs for.
This de-couples rules_proto from the https://github.com/protocolbuffers/protobuf repository; rules_proto
no longer depends on com_google_protobuf
. The Bazel rules in that repository are now maintained by the protobuf team for Google use cases, and may diverge from rules_proto over time.
rules_proto does not include the toolchain implementation. See https://registry.bazel.build/modules/toolchains_protoc for an example module that registers the prebuilt binary from https://github.com/protocolbuffers/protobuf/releases.
The tracking issue for this feature is #179
BREAKING CHANGES
Upgrading from rules_proto 5.x requires some changes:
- The
load
site forrules_proto_toolchains
has changed. See the new WORKSPACE snippet below. - As mentioned above, rules_proto no longer depends on the protobuf repo (commonly as
com_google_protobuf
). As a result, therules_proto_dependencies
macro no longer fetches one. For WORKSPACE users, this may affect what version of protobuf you end up with. We recommend explicitly fetchingcom_google_protobuf
early in the WORKSPACE file, as the first declaration wins.
Using bzlmod with Bazel 6 or later:
-
[Bazel 6] Add
common --enable_bzlmod
to.bazelrc
. -
Add to your
MODULE.bazel
file:
bazel_dep(name = "rules_proto", version = "6.0.0-rc3")
Using WORKSPACE:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_proto",
sha256 = "a88d018bdcb8df1ce8185470eb4b4899d778f9ac3a66cb36d514beb81e345282",
strip_prefix = "rules_proto-6.0.0-rc3",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc3/rules_proto-6.0.0-rc3.tar.gz",
)
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
rules_proto_dependencies()
load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")
rules_proto_toolchains()
What's Changed
Full Changelog: 6.0.0-rc2...6.0.0-rc3