Skip to content

Commit ea9a74d

Browse files
committed
fix: bzlmod users don't need to register toolchain
The toolchains_protoc MODULE file registers the protoc toolchain itself.
1 parent f467eb3 commit ea9a74d

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

.github/workflows/release_prep.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,16 @@ cat << EOF
2222
2. Add to your \`MODULE.bazel\` file:
2323
2424
\`\`\`starlark
25+
# NB: this must come BEFORE bazel_dep(name = "protobuf") because they register the from-source toolchain,
26+
# and the first registration wins.
2527
bazel_dep(name = "toolchains_protoc", version = "${TAG:1}")
2628
2729
# Optional: choose a version of protoc rather than the latest.
2830
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
2931
protoc.toolchain(
30-
# Creates a repository to satisfy well-known-types dependencies such as
31-
# deps=["@com_google_protobuf//:any_proto"]
32-
google_protobuf = "com_google_protobuf",
3332
# Pin to any version of protoc
3433
version = "v26.0",
3534
)
36-
use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub")
37-
38-
register_toolchains("@toolchains_protoc_hub//:all")
3935
\`\`\`
4036
4137
## Using WORKSPACE

examples/.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ common --host_platform=//tools:no_cgo_host_platform
77
common --@aspect_rules_ts//ts:skipLibCheck=always
88
common --@aspect_rules_ts//ts:default_to_tsc_transpiler
99

10+
common --java_runtime_version=remotejdk_11
11+
1012
# Ensure that we don't accidentally build protobuf or gRPC
1113
common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
1214
common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT

examples/MODULE.bazel

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ protoc.toolchain(
3737
# Demonstrate overriding the default version
3838
version = "v28.0",
3939
)
40-
use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub")
41-
42-
register_toolchains("@toolchains_protoc_hub//:all")
40+
use_repo(protoc, "com_google_protobuf")
4341

4442
# NB: the `:all` here is critical, because `proto_lang_toolchain` expands into two targets:
4543
# - proto_lang_toolchain rule [name]

0 commit comments

Comments
 (0)