rules-proto-grpc / rules_proto_grpc

Bazel rules for building Protobuf and gRPC code and libraries from proto_library targets
https://rules-proto-grpc.com
Apache License 2.0
256 stars 159 forks source link

Fix wrong toolchains label in Custom Plugins document #318

Closed Ginakira closed 4 months ago

Ginakira commented 5 months ago

Version: v4.6.0 In custom plugin, if I defined toolchain attribute as @rules_proto_grpc//protoc:toolchain_type in proto compile rule just same as document:

# Create compile rule
example_compile = rule(
    implementation = proto_compile_impl,
    attrs = dict(
       ...
    ),
    toolchains = [str(Label("@rules_proto_grpc//protoc:toolchain_type"))],
)

It has error when build:

(11:16:43) ERROR: /.../BUILD:29:20: While resolving toolchains for target //foo_protoc:foo_proto: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@rules_proto_grpc//protoc': BUILD file not found in directory 'protoc' of external repository @rules_proto_grpc. Add a BUILD file to a directory to mark it as a package.

Replace it to @rules_proto_grpc//protobuf:toolchain_type will resolve this problem. And I found there is no folder named protoc under the <bazel_cache_dir>/external/rules_proto_grpc.

Maybe code of the document is outdated. Please review this pull request, thanks!

aaliddell commented 4 months ago

Thanks, but you are looking at the docs for the v5 release but using the v4 release. The docs for the version you are using are at https://rules-proto-grpc.com/en/4.5.0/custom_plugins.html (4.6.0 is not being shown by RTD for some reason)

Ginakira commented 4 months ago

Thanks, but you are looking at the docs for the v5 release but using the v4 release. The docs for the version you are using are at https://rules-proto-grpc.com/en/4.5.0/custom_plugins.html (4.6.0 is not being shown by RTD for some reason)

Sorry, I didn't notice that. Thanks for your reply! :)