Skip to content

Conversation

@arjan-bal
Copy link
Collaborator

@arjan-bal arjan-bal commented Jul 2, 2025

This PR includes the following:

  1. A tonic codec that uses protobuf-rust.
  2. A protoc plugin that generates tonic compatible client code.
  3. A grpc-build crate that helps generate code during cargo builds.
  4. Interop tests that use the new client codgen running against a Go server. This is used as an integration test for the new codegen.

To keep the CI fast, the protoc plugin binary for each OS is cached. The plugin binaries are re-built only if the plugin's code or build files are updated.

Notes

  • The codegen is generating code for tonic. It will be changed when the gRPC API design is finalized and the channel implementation is complete.

@arjan-bal arjan-bal changed the title gRPC client codegen [WIP] gRPC client codegen Jul 2, 2025
@arjan-bal arjan-bal changed the title [WIP] gRPC client codegen gRPC client codegen Jul 2, 2025
@arjan-bal arjan-bal marked this pull request as draft July 2, 2025 18:33
@LucioFranco LucioFranco changed the title gRPC client codegen feat(grpc): Add protobuf codegen Jul 2, 2025
@arjan-bal arjan-bal force-pushed the grpc-codegen branch 4 times, most recently from d39e0f5 to de384b4 Compare July 4, 2025 08:54
@arjan-bal arjan-bal force-pushed the grpc-codegen branch 17 times, most recently from 9e45ab4 to dfc5213 Compare July 4, 2025 22:43
arjan-bal and others added 2 commits July 17, 2025 19:12
@arjan-bal arjan-bal requested a review from LucioFranco July 17, 2025 18:00
Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I tested this locally, the absolute paths is what solved it for me. We can merge this but I want to merge #2321 first and then rebase this ontop of that before we merge this.

copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this pull request Jul 24, 2025
This check was meant to enforce that the version of the protobuf crate exactly
matches the version of the codegen crate, but this is not strictly necessary.
Tonic would also like to re-export our crate from the `tonic-protobuf` crate,
and the `DEP_UPB_VERSION` check is causing problems with that since the
environment variable is set only for crates that directly depend on the
`protobuf` crate (see
[discussion](hyperium/tonic#2320 (comment))).

While I was at it I also removed the code in the protobuf build script that
sets the `DEP_UPB_INCLUDE` variable, which is unnecessary now that we no longer
generate any C code which would need to know where to find upb's headers.

PiperOrigin-RevId: 786745312
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this pull request Jul 24, 2025
This check was meant to enforce that the version of the protobuf crate exactly
matches the version of the codegen crate, but this is not strictly necessary.
Tonic would also like to re-export our crate from the `tonic-protobuf` crate,
and the `DEP_UPB_VERSION` check is causing problems with that since the
environment variable is set only for crates that directly depend on the
`protobuf` crate (see
[discussion](hyperium/tonic#2320 (comment))).

While I was at it I also removed the code in the protobuf build script that
sets the `DEP_UPB_INCLUDE` variable, which is unnecessary now that we no longer
generate any C code which would need to know where to find upb's headers.

PiperOrigin-RevId: 786745312
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this pull request Jul 24, 2025
This check was meant to enforce that the version of the protobuf crate exactly
matches the version of the codegen crate, but this is not strictly necessary.
Tonic would also like to re-export our crate from the `tonic-protobuf` crate,
and the `DEP_UPB_VERSION` check is causing problems with that since the
environment variable is set only for crates that directly depend on the
`protobuf` crate (see
[discussion](hyperium/tonic#2320 (comment))).

While I was at it I also removed the code in the protobuf build script that
sets the `DEP_UPB_INCLUDE` variable, which is unnecessary now that we no longer
generate any C code which would need to know where to find upb's headers.

PiperOrigin-RevId: 786760264
acozzette pushed a commit to acozzette/protobuf that referenced this pull request Jul 24, 2025
This check was meant to enforce that the version of the protobuf crate exactly
matches the version of the codegen crate, but this is not strictly necessary.
Tonic would also like to re-export our crate from the `tonic-protobuf` crate,
and the `DEP_UPB_VERSION` check is causing problems with that since the
environment variable is set only for crates that directly depend on the
`protobuf` crate (see
[discussion](hyperium/tonic#2320 (comment))).

While I was at it I also removed the code in the protobuf build script that
sets the `DEP_UPB_INCLUDE` variable, which is unnecessary now that we no longer
generate any C code which would need to know where to find upb's headers.

PiperOrigin-RevId: 786760264
acozzette pushed a commit to protocolbuffers/protobuf that referenced this pull request Jul 24, 2025
This check was meant to enforce that the version of the protobuf crate exactly
matches the version of the codegen crate, but this is not strictly necessary.
Tonic would also like to re-export our crate from the `tonic-protobuf` crate,
and the `DEP_UPB_VERSION` check is causing problems with that since the
environment variable is set only for crates that directly depend on the
`protobuf` crate (see
[discussion](hyperium/tonic#2320 (comment))).

While I was at it I also removed the code in the protobuf build script that
sets the `DEP_UPB_INCLUDE` variable, which is unnecessary now that we no longer
generate any C code which would need to know where to find upb's headers.

PiperOrigin-RevId: 786760264
@arjan-bal
Copy link
Collaborator Author

Hi @dfawley, @LucioFranco can you please have another look?

@dfawley dfawley merged commit d244567 into hyperium:master Jul 30, 2025
20 checks passed
cjqzhao pushed a commit to cjqzhao/tonic that referenced this pull request Aug 7, 2025
cjqzhao pushed a commit to cjqzhao/tonic that referenced this pull request Aug 7, 2025
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.

5 participants