Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto: handle go proto library deprecation #5662

Merged
merged 3 commits into from
Jan 9, 2024

Conversation

sluongng
Copy link
Contributor

@sluongng sluongng commented Jan 8, 2024

In bazel-contrib/rules_go#3761, rules_go started deprecating away
the usage of https://github.com/golang/protobuf in favor of a combination of
https://github.com/protocolbuffers/protobuf-go and https://github.com/grpc/grpc-go/blob/master/cmd/protoc-gen-go-grpc.

This results in go_proto_library requiring these 2 new compilers.
As an convinience, a go_grpc_library macro was introduced to wrap around go_proto_library
to ensure that these 2 compilers are set by default.

Effectively, in our go_proto_library targets, switch our usage of the old compiler to the new pair of compilers.
We are not using go_grpc_library yet because Gazelle has yet to support it. bazel-contrib/bazel-gazelle#1711

Related issues: N/A

@sluongng
Copy link
Contributor Author

sluongng commented Jan 8, 2024

This PR is based on #5655 and should only be merged after.

@sluongng sluongng marked this pull request as ready for review January 8, 2024 11:07
proto/BUILD Show resolved Hide resolved
@sluongng sluongng force-pushed the sluongng/handle-go-proto-library-deprecation branch from 06b2765 to babe1e7 Compare January 9, 2024 10:22
@sluongng sluongng merged commit 3a6a716 into master Jan 9, 2024
14 checks passed
@sluongng sluongng deleted the sluongng/handle-go-proto-library-deprecation branch January 9, 2024 10:50
sluongng added a commit that referenced this pull request Jan 9, 2024
This is a follow-up for #5662.

Turn out our external dependencies also need some proto love

```bash
WARNING: /private/var/tmp/_bazel_sluongng/06e573a93bc2d6a9cad4ad41f00b4310/external/com_github_buildbuddy_io_tensorflow_proto/tensorflow_serving/apis/BUILD.bazel:27:17:
  in go_proto_library rule @@com_github_buildbuddy_io_tensorflow_proto//tensorflow_serving/apis:apis_go_proto:
    target '@@com_github_buildbuddy_io_tensorflow_proto//tensorflow_serving/apis:apis_go_proto'
    depends on deprecated target '@@io_bazel_rules_go//proto:go_grpc':
      Migrate to //proto:go_grpc_v2 compiler (which you'll get automatically if you use the go_grpc_library() rule).
```

Ensure that when Gazelle is run on external dependencies, the proper
directive is also applied so that the newer compilers are used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants