feat(internal/librarian/java): support alternate license header files#6311
feat(internal/librarian/java): support alternate license header files#6311sofisl wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for alternate license headers in Java modules by adding an AlternateHeaders configuration field and updating the post-processing logic to read from this file if provided. The review feedback focuses on improving test robustness by using bytes.HasPrefix instead of bytes.Contains to verify headers, optimizing the license text retrieval to return []byte directly to avoid unnecessary string conversions, and properly wrapping errors.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: sofisl <55454395+sofisl@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: sofisl <55454395+sofisl@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: sofisl <55454395+sofisl@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for configuring alternate license headers in Java modules. It adds an alternate_headers field to the configuration schema and the JavaModule struct, and updates the post-processing logic to read and apply the alternate header text from the specified file path. Comprehensive unit tests have been added to verify this new behavior, including error handling for missing header files. No review comments were provided, so there is no additional feedback to address.
Co-authored-by: Joe Wang <106995533+JoeWang1127@users.noreply.github.com> Signed-off-by: sofisl <55454395+sofisl@users.noreply.github.com>
| content: "some text", | ||
| }, | ||
| { | ||
| name: "alternate header", |
There was a problem hiding this comment.
Is this test case different from TestPostProcessAPI_AlternateHeaders?
There was a problem hiding this comment.
you're right, can be safely removed
There was a problem hiding this comment.
Did you remove this test? I still see it in the pull request.
Added support for custom external alternate license header files during Java code regeneration.
When
alternate_headersis configured with a relative file path in the library'sjavaconfiguration block, Librarian reads that file and appends its contents as the license header instead of the standard header. A temporary, backwards-compatible migration check ensures monolithic libraries retain their existing skip behavior until their config is updated.There will be two f/u PRs: the first in google-cloud-java to add the property and the header. The second in librarian to remove the monolithic block since (I think) it only applies to grafeas, and just rely on the alternate headers path.
For #6178