feat(librariangen): generate grpc stubs and resource helpers#3967
feat(librariangen): generate grpc stubs and resource helpers#3967
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3967 +/- ##
==========================================
- Coverage 80.27% 78.89% -1.39%
==========================================
Files 8 8
Lines 441 379 -62
==========================================
- Hits 354 299 -55
+ Misses 68 53 -15
- Partials 19 27 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| wget -q "https://repo1.maven.org/maven2/com/google/api/gapic-generator-java/$GAPIC_GENERATOR_VERSION/gapic-generator-java-$GAPIC_GENERATOR_VERSION.jar" -O "$WORKSPACE/gapic-generator-java.jar" | ||
|
|
||
| echo "Downloading protoc-gen-grpc-java..." | ||
| wget -q "https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/$GRPC_PLUGIN_VERSION/protoc-gen-grpc-java-$GRPC_PLUGIN_VERSION-linux-x86_64.exe" -O "$WORKSPACE/protoc-gen-java_grpc" |
There was a problem hiding this comment.
I think Dockerfile needs this too. https://github.com/googleapis/sdk-platform-java/blob/main/internal/librariangen/Dockerfile
This topic is part of how we can make abstraction over GAPIC generators, when thinking about the future in which we would say "All you language team needs to do is to provide their protoc plugins". If we have a consistent way to set protoc plugins across language containers, that would be a step towards it.
There was a problem hiding this comment.
I'll try to refactor this in a separate PR. I would migrate a lot of the logic in run-generate-library.sh to the Dockerfile.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the generation of gRPC stubs and resource helpers in the librariangen tool. It modifies the Generate function to create output directories for GAPIC, gRPC, and proto files, and updates the invokeProtoc function to pass an OutputConfig struct. The restructureOutput function is updated to handle gRPC stubs and resource names, and a copyAndMerge function is added to merge resource name files into the proto destination. The cleanupIntermediateFiles function is updated to remove the GAPIC, gRPC, and proto directories. Tests are updated to reflect these changes. I have identified a few areas where improvements can be made, particularly in error handling and code clarity.
🤖 I have created a release *beep* *boop* --- <details><summary>2.64.0</summary> ## [2.64.0](v2.63.0...v2.64.0) (2025-10-31) ### Features * [common-protos] Add `Carousel` widget ([1e4a7e5](1e4a7e5)) * **librariangen:** add generate package ([#3952](#3952)) ([2f6c75d](2f6c75d)) * **librariangen:** generate grpc stubs and resource helpers ([#3967](#3967)) ([452d703](452d703)) ### Dependencies * Bump grpc-java to v1.76.0 ([#3942](#3942)) ([ffb557c](ffb557c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* Introduces the generation of gRPC stubs and resource helpers. * Modifies the `Generate` function to create output directories for GAPIC, gRPC, and proto files. * Updates the `invokeProtoc` function to pass an `OutputConfig` struct. * Updates the `restructureOutput` function to handle gRPC stubs and resource names. * Adds a `copyAndMerge` function to merge resource name files into the proto destination. * Updates the `cleanupIntermediateFiles` function to remove the GAPIC, gRPC, and proto directories. * Updates tests to reflect these changes. * Improvements in error handling.
🤖 I have created a release *beep* *boop* --- <details><summary>2.64.0</summary> ## [2.64.0](v2.63.0...v2.64.0) (2025-10-31) ### Features * [common-protos] Add `Carousel` widget ([1e4a7e5](1e4a7e5)) * **librariangen:** add generate package ([#3952](#3952)) ([2f6c75d](2f6c75d)) * **librariangen:** generate grpc stubs and resource helpers ([#3967](#3967)) ([452d703](452d703)) ### Dependencies * Bump grpc-java to v1.76.0 ([#3942](#3942)) ([ffb557c](ffb557c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Generatefunction to create output directories for GAPIC, gRPC, and proto files.invokeProtocfunction to pass anOutputConfigstruct.restructureOutputfunction to handle gRPC stubs and resource names.copyAndMergefunction to merge resource name files into the proto destination.cleanupIntermediateFilesfunction to remove the GAPIC, gRPC, and proto directories.