Skip to content

Commit fbc5725

Browse files
committed
Fixed broken protoc toolchain in examples
1 parent d256c7b commit fbc5725

File tree

9 files changed

+39
-22
lines changed

9 files changed

+39
-22
lines changed

examples/proto/MODULE.bazel

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ local_path_override(
2222
#
2323
# Rules for protobuf / gRPC
2424
# https://github.com/bazelbuild/rules_proto/releases
25-
bazel_dep(name = "rules_proto", version = "6.0.2")
26-
27-
# https://github.com/aspect-build/toolchains_protoc/releases
28-
bazel_dep(name = "toolchains_protoc", version = "0.3.1")
25+
bazel_dep(name = "rules_proto", version = "7.1.0")
2926

3027
# https://registry.bazel.build/modules/protobuf
31-
bazel_dep(name = "protobuf", version = "27.1")
28+
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
3229

3330
# https://github.com/bazel-contrib/toolchains_llvm
3431
bazel_dep(name = "toolchains_llvm", version = "1.2.0")
@@ -75,7 +72,10 @@ use_repo(rust, "rust_toolchains")
7572
register_toolchains("@rust_toolchains//:all")
7673

7774
# Custom Prost toolchain
78-
register_toolchains("@//build/prost_toolchain")
75+
register_toolchains(
76+
"@//build/prost_toolchain",
77+
"@//build/proto_toolchain",
78+
)
7979

8080
###############################################################################
8181
# R U S T C R A T E S

examples/proto/README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ In your MODULE.bazel, you add the following:
4747
# rules for proto
4848
###############################################################################
4949
# https://github.com/bazelbuild/rules_proto/releases
50-
bazel_dep(name = "rules_proto", version = "6.0.2")
51-
# https://github.com/aspect-build/toolchains_protoc/releases
52-
bazel_dep(name = "toolchains_protoc", version = "0.3.1")
50+
bazel_dep(name = "rules_proto", version = "7.1.0")
5351
# https://registry.bazel.build/modules/protobuf
54-
bazel_dep(name = "protobuf", version = "27.1")
52+
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
5553
# rules for LLVM
5654
# https://github.com/bazel-contrib/toolchains_llvm
5755
bazel_dep(name = "toolchains_llvm", version = "1.2.0")

examples/proto/build/prost_toolchain/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ rust_prost_toolchain(
2323
prost_types = "@crates//:prost-types",
2424
tonic_plugin = "@crates//:protoc-gen-tonic__protoc-gen-tonic",
2525
tonic_runtime = ":tonic_runtime",
26+
visibility = ["//visibility:public"],
2627
)
2728

2829
toolchain(
2930
name = "prost_toolchain",
3031
toolchain = "prost_toolchain_impl",
3132
toolchain_type = "@rules_rust_prost//:toolchain_type",
33+
visibility = ["//visibility:public"],
3234
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
load("@rules_proto//proto:proto_toolchain.bzl", "proto_toolchain")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
# This macro implicitly creates `{name}_toolchain`
6+
proto_toolchain(
7+
name = "proto",
8+
proto_compiler = "@com_google_protobuf//:protoc",
9+
)

examples/proto_with_toolchain/MODULE.bazel

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ local_path_override(
2222
#
2323
# Rules for protobuf / gRPC
2424
# https://github.com/bazelbuild/rules_proto/releases
25-
bazel_dep(name = "rules_proto", version = "6.0.2")
26-
27-
# https://github.com/aspect-build/toolchains_protoc/releases
28-
bazel_dep(name = "toolchains_protoc", version = "0.3.1")
25+
bazel_dep(name = "rules_proto", version = "7.1.0")
2926

3027
# https://registry.bazel.build/modules/protobuf
31-
bazel_dep(name = "protobuf", version = "27.1")
28+
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
3229

3330
# https://github.com/bazel-contrib/toolchains_llvm
3431
bazel_dep(name = "toolchains_llvm", version = "1.2.0")
@@ -75,7 +72,10 @@ use_repo(rust, "rust_toolchains")
7572
register_toolchains("@rust_toolchains//:all")
7673

7774
# Custom Prost toolchain
78-
register_toolchains("@//build/prost_toolchain")
75+
register_toolchains(
76+
"@//build/prost_toolchain",
77+
"@//build/proto_toolchain",
78+
)
7979

8080
###############################################################################
8181
# R U S T C R A T E S

examples/proto_with_toolchain/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ While the Tonic toolchain works out of the box when its dependencies are matched
3333
Prost requires a custom toolchain that you have to define.
3434

3535
The setup requires three steps to complete:
36+
3637
1. Configure rules and dependencies in MODULE.bazel
3738
2. Configure a custom Prost toolchain
3839
3. Register custom Prost toolchain.
@@ -47,11 +48,9 @@ In your MODULE.bazel, you add the following:
4748
# rules for proto
4849
###############################################################################
4950
# https://github.com/bazelbuild/rules_proto/releases
50-
bazel_dep(name = "rules_proto", version = "6.0.2")
51-
# https://github.com/aspect-build/toolchains_protoc/releases
52-
bazel_dep(name = "toolchains_protoc", version = "0.3.1")
51+
bazel_dep(name = "rules_proto", version = "7.1.0")
5352
# https://registry.bazel.build/modules/protobuf
54-
bazel_dep(name = "protobuf", version = "27.1")
53+
bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
5554
# rules for LLVM
5655
# https://github.com/bazel-contrib/toolchains_llvm
5756
bazel_dep(name = "toolchains_llvm", version = "1.2.0")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
load("@rules_proto//proto:proto_toolchain.bzl", "proto_toolchain")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
# This macro implicitly creates `{name}_toolchain`
6+
proto_toolchain(
7+
name = "proto",
8+
proto_compiler = "@com_google_protobuf//:protoc",
9+
)

extensions/prost/MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bazel_dep(
2727
)
2828
bazel_dep(
2929
name = "rules_proto",
30-
version = "6.0.2",
30+
version = "7.1.0",
3131
)
3232
bazel_dep(
3333
name = "protobuf",

extensions/protobuf/MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bazel_dep(
2727
)
2828
bazel_dep(
2929
name = "rules_proto",
30-
version = "6.0.2",
30+
version = "7.1.0",
3131
)
3232
bazel_dep(
3333
name = "protobuf",

0 commit comments

Comments
 (0)