v0.4.0
Using Bzlmod with Bazel 6 or later
- (Bazel 6 only) Enable with
common --enable_bzlmod
in.bazelrc
. - Add to your
MODULE.bazel
file:
bazel_dep(name = "toolchains_protoc", version = "0.4.0")
# Optional: choose a version of protoc rather than the latest.
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
protoc.toolchain(
# Creates a repository to satisfy well-known-types dependencies such as
# deps=["@com_google_protobuf//:any_proto"]
google_protobuf = "com_google_protobuf",
# Pin to any version of protoc
version = "v26.0",
)
use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub")
register_toolchains("@toolchains_protoc_hub//:all")
Using WORKSPACE
Paste this snippet into your WORKSPACE.bazel
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "toolchains_protoc",
sha256 = "270ff656a305e8e2fef22628a13b948554f80c69f53b47dfa7bf09cd99743062",
strip_prefix = "toolchains_protoc-0.4.0",
url = "https://github.com/aspect-build/toolchains_protoc/releases/download/v0.4.0/toolchains_protoc-v0.4.0.tar.gz",
)
######################
# toolchains_protoc setup #
######################
# Fetches the toolchains_protoc dependencies.
# If you want to have a different version of some dependency,
# you should fetch it *before* calling this.
# Alternatively, you can skip calling this function, so long as you've
# already fetched all the dependencies.
load("@toolchains_protoc//protoc:repositories.bzl", "rules_protoc_dependencies")
rules_protoc_dependencies()
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
rules_proto_dependencies()
load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()
load("@toolchains_protoc//protoc:toolchain.bzl", "protoc_toolchains")
protoc_toolchains(
name = "protoc_toolchains",
version = "v25.3",
)
What's Changed
- Changes by create-pull-request action by @github-actions in #46
- chore: upgrade rules_uv by @alexeagle in #45
- feat: re-enable Python example of using pre-built protoc by @alexeagle in #42
- chore: update example to latest bazel deps by @alexeagle in #49
- chore(deps): update to new rules_python RC by @alexeagle in #50
- Changes by create-pull-request action by @github-actions in #51
- Changes by create-pull-request action by @github-actions in #52
- feat: add examples of Rust and TypeScript by @alexeagle in #53
- fix: break protobuf and grpc building from source by @thesayyn in #54
- Changes by create-pull-request action by @github-actions in #55
- Remove git_override for rules_python by @jklukas in #56
- Changes by create-pull-request action by @github-actions in #57
- Changes by create-pull-request action by @github-actions in #63
- chore: publish attestations to BCR by @alexeagle in #65
New Contributors
Full Changelog: v0.3.7...v0.4.0