Update to handle rename of java_names.h to names.h in protobuf upstream#9218
Update to handle rename of java_names.h to names.h in protobuf upstream#9218ejona86 merged 3 commits intogrpc:masterfrom
Conversation
|
|
|
This change seems dependent on protobuf version 3.21 - but |
|
Happy to update the gradle file in this PR, but I'm not sure I'm the right person to perform the required amount of testing (unless it's automated). |
|
|
On second look it seems this is quite a more involved change than I anticipated since version 3.19.2 is referenced in a number of places. |
|
Upgrading proto is indeed a bit more involved. 80c3be0 is an example of upgrading it. @jvolkman how did you notice this? It looks like you may be using Bazel? It looks like this requires a lock-step upgrade, which is bad form. It is probably worthwhile to file a bug on Protobuf to request a forwarding header file (that maybe includes a warning) that could be removed after a release or two releases. I heard C core was also impacted by the renames and I think protobuf went back and properly added back the old header names which just #include the new names. @jvolkman, if you are using Bazel, then feel free to make a protobuf issue and CC me. But I think we can solve this a bit more simply. Since this is a java-specific header, we can still reference PROTOBUF_VERSION. |
|
@ejona86 we are indeed using Bazel, and I happened to push an update with a switch based on |
And the commit shows up just when I make my comment, although apparently there is a GOOGLE_PROTOBUF_VERSION in addition to PROTOBUF_VERSION. |
ejona86
left a comment
There was a problem hiding this comment.
I really am not too sure what is in /stubs/, but this seems fine.
Yeah, I agree. But the top comment in so it seemed appropriate. |
The solution looks great(hacky)! I was thinking a proper way (if in gradle) is to resolve the dependency version, isn't it? |
@YifeiZhuang, well, the user here isn't using the specific dependency versions that we are defining. They are using Bazel and choosing a different Protobuf version. So Gradle isn't used at all. |
no i guess my question was why we can not specify a version around here: grpc-java/compiler/BUILD.bazel Line 14 in d4fa0ec so that the customer can perfectly use a newer version but the :grpc-compiler would use an old version. Not something so important to know tho. |
|
@YifeiZhuang, we specify a version in Line 114 in d4fa0ec However, that is only a recommendation. The user is free to define "com_google_protobuf" themselves and then our version won't be used: Lines 86 to 87 in d4fa0ec Bazel dependencies are shared by the entire workspace, so we can't use a different version from the rest of the user's application. That's okay. We normally allow users to upgrade dependencies; it's just less frequently done for the protoc plugin. |
|
@jvolkman, thank you! |
|
Any plan for release gRPC with this fix soon? GAX-java repository is facing the compilation error. (No hard deadline but we're thinking whether to revert Protobuf versions in some artifacts, or wait for gRPC release) CC: @Neenu1995 |
|
@suztomo, the fix here was included in 1.47.0. |
|
Thank you. Indeed I see v1.47.0's https://github.com/grpc/grpc-java/blob/v1.47.0/compiler/src/java_plugin/cpp/java_generator.cpp#L32 has the fix in this pull request. |
Protobuf 3.21 renamed
google/protobuf/compiler/java/java_names.htogoogle/protobuf/compiler/java/names.hFixes #9220