Skip to content

Conversation

@meltsufin
Copy link
Member

Based on https://github.com/googleapis/google-cloud-go/tree/main/internal/librariangen/generate with adaptation for Java.

Currently it's just the scaffolding and more work is needed to generate a usable GAPIC library.

The generate package contains the core logic for the generation process, including:

  • Reading and parsing the generate-request.json from librarian.
  • Parsing BUILD.bazel files in the googleapis repository to extract GAPIC configuration.
  • Building and executing protoc with the gapic-generator-java plugin.
  • Unzipping and restructuring the generated files into the final library layout.

A run-generate-library.sh script is included for local development and end-to-end testing of the generation process.

Additionally, a go.work file has been added to the root of the repository to support the multi-module workspace structure.

Based on https://github.com/googleapis/google-cloud-go/tree/main/internal/librariangen/generate with adaptation for Java.

Currently it's just the scaffolding and more work is need to generate a usable GAPIC library.

The `generate` package contains the core logic for the generation process, including:
- Reading and parsing the `generate-request.json` from librarian.
- Parsing `BUILD.bazel` files in the googleapis repository to extract GAPIC configuration.
- Building and executing `protoc` with the `gapic-generator-java` plugin.
- Unzipping and restructuring the generated files into the final library layout.

A `run-generate-library.sh` script is included for local development and end-to-end testing of the generation process.

Additionally, a `go.work` file has been added to the root of the repository to support the multi-module workspace structure.
@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Oct 17, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @meltsufin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational generate package within librariangen, aiming to automate the creation of Java GAPIC client libraries. It sets up the core orchestration for the generation process, including reading input requests, interpreting Bazel build configurations, executing the protoc compiler with the gapic-generator-java plugin, and organizing the resulting files into the final library structure. This initial scaffolding is designed to be extensible, with future work planned to fully enable usable GAPIC library generation. The changes also include tooling for local development and testing, such as a go.work file for workspace management and a shell script to run the generation end-to-end.

Highlights

  • New generate package: Introduced a new generate package within librariangen that encapsulates the core logic for generating Java GAPIC client libraries. This includes reading generation requests, parsing Bazel configurations, invoking protoc with the gapic-generator-java plugin, and restructuring the generated output.
  • Bazel Configuration Parsing Enhancement: The bazel package's Config struct and Parse function have been updated to extract the gapic_yaml field from BUILD.bazel files, which is crucial for configuring the GAPIC generator.
  • Local Development Script: A run-generate-library.sh script has been added to facilitate local development and end-to-end testing of the generation process. This script handles setting up a workspace, downloading dependencies, compiling librariangen, and executing the generate command.
  • Go Workspace Integration: A go.work file was added to the repository root, enabling a multi-module workspace structure and simplifying development across different librariangen modules.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.37%. Comparing base (feabef3) to head (bc5d135).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3952      +/-   ##
==========================================
- Coverage   93.81%   88.37%   -5.44%     
==========================================
  Files           5        6       +1     
  Lines         194      370     +176     
==========================================
+ Hits          182      327     +145     
- Misses          9       30      +21     
- Partials        3       13      +10     
Flag Coverage Δ
librariangen 88.37% <ø> (-5.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the generate package and command to librariangen, a tool for generating Java client libraries. The changes encompass the core generation logic, which includes parsing configurations, executing protoc, and organizing the output. Additionally, a test script and thorough unit tests have been added. The code is well-organized. I have identified a few opportunities for enhancement concerning resource management, the robustness of test code, and the portability of the script.

@sonarqubecloud
Copy link

@meltsufin meltsufin requested a review from suztomo October 17, 2025 13:47
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@meltsufin meltsufin merged commit 2f6c75d into main Oct 17, 2025
63 of 64 checks passed
@meltsufin meltsufin deleted the librarian-generate branch October 17, 2025 15:29
meltsufin added a commit that referenced this pull request Oct 24, 2025
diegomarquezp pushed a commit that referenced this pull request Nov 1, 2025
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants