Skip to content

Commit 6262699

Browse files
committed
refactor: use the pre-built protoc toolchain
By calling the protoc toolchain module first its registered toolchain wins for compiling protoc. This follows discussions in buildbarn/bb-storage#248
1 parent a26c16b commit 6262699

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

MODULE.bazel

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bazel_dep(name = "googletest", version = "1.15.2")
1414
bazel_dep(name = "jsonnet_go", version = "0.20.0")
1515
bazel_dep(name = "opentelemetry-proto", version = "1.5.0")
1616
bazel_dep(name = "platforms", version = "0.0.11")
17+
bazel_dep(name = "toolchains_protoc", version = "0.4.2") # must come BEFORE protobuf so the toolchain registration wins
1718
bazel_dep(name = "protobuf", version = "29.3")
1819
bazel_dep(name = "remote_config_cc")
1920
bazel_dep(name = "remote_config_sh")
@@ -29,7 +30,11 @@ bazel_dep(name = "rules_shell", version = "0.3.0")
2930
# but held back to be compatible with bb-remote-execution.
3031
bazel_dep(name = "rules_proto", version = "7.1.0")
3132
bazel_dep(name = "toolchains_llvm", version = "1.3.0")
32-
bazel_dep(name = "toolchains_protoc", version = "0.3.4")
33+
34+
# Mirror the protoc setup from bb-storage: https://github.com/buildbarn/bb-storage/pull/248
35+
# NB: Match protobuf above, until it ships a pre-built binary toolchain itself
36+
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
37+
protoc.toolchain(version = "v29.3")
3338

3439
# # Workarounds 2024-06-27
3540
# ERROR: in tag at https://bcr.bazel.build/modules/grpc-java/1.62.2/MODULE.bazel:89:15: no repository visible as '@com_google_protobuf_javalite' to the repository '@@grpc-java~', but referenced by label '@com_google_protobuf_javalite//:protobuf_javalite' in attribute 'target' of tag 'override'. Is the module 'grpc-java' missing a bazel_dep or use_repo(..., "com_google_protobuf_javalite")?

MODULE.bazel.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)