Skip to content

Commit b86317b

Browse files
committed
docs: clarify ordering
1 parent ea9a74d commit b86317b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ Enable the toolchain support by adding this to `.bazelrc`:
5656
common --incompatible_enable_proto_toolchain_resolution
5757
```
5858

59+
Make sure this module wins the toolchain registration for the
60+
[`@rules_proto//proto:toolchain_type` symbol](https://github.com/bazelbuild/rules_proto/blob/74961e561111a3510d5c25233477b950379ae06d/proto/BUILD#L58), either by ensuring the `bazel_dep` for `toolchains_protoc` is listed BEFORE the one for `protobuf`, or explicitly register the toolchain in your own `MODULE.bazel`:
61+
62+
```
63+
# Override the toolchain registration from the protobuf module
64+
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
65+
use_repo(protoc, "toolchains_protoc_hub")
66+
register_toolchains("@toolchains_protoc_hub//:all")
67+
```
68+
5969
### For each language, follow these steps
6070

6171
Since the user installs the proto runtimes through their existing package manager setup,
@@ -99,8 +109,11 @@ See `examples` for several language rules like `py_proto_library` and `java_prot
99109

100110
### Troubleshooting
101111

102-
What if you still see that protoc is compiling? This means that there is still a transitive dependency on the
103-
`com_google_protobuf` module, likely from some macro call in your `WORKSPACE` file.
112+
What if you still see that protoc is compiling?
113+
114+
1. Check that toolchains_protoc `bazel_dep` is BEFORE `protobuf`, see Installation above.
115+
1. This could mean that there is still a transitive dependency on the
116+
`com_google_protobuf` module, likely from some macro call in your `WORKSPACE` file.
104117

105118
> TODO: explain how to track down where the `com_google_protobuf` dependency is coming from.
106119

0 commit comments

Comments
 (0)