GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tests: Use fixed copyright year in tests. by blakeli0 · Pull Request #4036 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@blakeli0

@blakeli0 blakeli0 commented Jan 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The generator use the current year to generate copyright headers, so there are multiple tests failing when a new year comes. The general fix is to introduce an environment variable TEST_CURRENT_YEAR so that we can override it in tests. See below for the exact fix for each scenario:

  • Java generator golden unit tests
    • Override it with Maven.
  • Java generator golden integration tests
    • Updated the golden files. These tests are generated from Bazel rules. Bazel builds are pretty hermetic and I couldn't find a way to override the environment variable. This is because the Bazel rule java_gapic_library calls the generator through proto_custom_library which does not pass any environment variables.
  • Python hermetic build scripts unit tests.
    • Override it with mocks. This requires a small refactoring in java.py.
  • Hermetic build scripts integration tests.
    • Changed these tests to non-required for now. These tests use a hardcoded generator version that does not recognize the environment variable. Once the generator is released, we can update the generator version and override the environment variable in CloudBuild yamls.
  • SpringCodeGen unit tests.
    • Once the generator is released, we can override the same environment variable with Maven in spring-cloud-gcp.

Separately, updated zlib version in Bazel build because there is a known incompatibility between old zlib library and the latest macOS version.

fixes: #3547

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@blakeli0
tests: Used fixed copyright year in tests.
a6d204b
@product-auto-label product-auto-label Bot added the size: s Pull request size is small. label Jan 2, 2026
@gemini-code-assist

gemini-code-assist Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @blakeli0, 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 enhances the robustness of the test suite by introducing a configurable copyright year for generated code. By allowing the copyright year to be set via an environment variable, particularly for tests, it ensures that test outcomes remain consistent and independent of the actual calendar year, thereby preventing potential test failures caused by year transitions.

Highlights

  • Test Stability Improvement: Introduced a mechanism to fix the copyright year used in generated code during testing, which prevents tests from failing due to year changes.
  • Configurable Copyright Year: The copyright year can now be overridden for testing purposes using the test_current_year environment variable.
  • Maven Surefire Plugin Configuration: The pom.xml was updated to set the test_current_year environment variable to 2025 specifically for test execution.
  • Dynamic Year Retrieval: A new getCurrentYear() helper method was added to CommentComposer.java to dynamically determine the copyright year, prioritizing the environment variable over the system's current year.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Jan 2, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 a mechanism to use a fixed copyright year for tests by using an environment variable. The changes in pom.xml set this environment variable for the test execution, and CommentComposer.java is updated to read this variable. This is a good approach for making tests deterministic.

I've added one comment with a suggestion to refactor the new getCurrentYear method to improve maintainability by extracting the magic string into a constant and to use the modern java.time API instead of Calendar.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...ator-java/src/main/java/com/google/api/generator/gapic/composer/comment/CommentComposer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@cloud-java-bot
chore: generate libraries at Fri Jan 2 15:31:08 UTC 2026
0559cb1
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jan 2, 2026
blakeli0 added 9 commits January 2, 2026 10:41
@blakeli0
chore: format
fa6a501
@blakeli0
chore: fix python unit tests
1421a00
@blakeli0
chore: set bazel test environment variable.
8938dd6
@blakeli0
Merge branch 'main' into use_fixed_copyright
7c8cb3e
@blakeli0
chore: fix python unit tests
23ad9b0
@blakeli0
chore: fix python unit tests
507ebcb
@blakeli0
chore: Update tests
38e0ca6
@blakeli0
chore: Update showcase scripts to use TEST_CURRENT_YEAR=2025
f62aee7
@blakeli0
chore: Update tests
34cefeb
@blakeli0 blakeli0 changed the title tests: Used fixed copyright year in tests. tests: Use fixed copyright year in tests. Jan 2, 2026
blakeli0 added 13 commits January 2, 2026 12:21
@blakeli0
chore: Update tests
d89df74
@blakeli0
chore: Use environment variable in python tests for getting current y…
f9e00a4
…ear.
@blakeli0
chore: Update tests
1fce5f0
@blakeli0
chore: Update tests
9097e11
@blakeli0
chore: Update java.py
38d90a9
@blakeli0
chore: Update java.py
e7022df
@blakeli0
chore: Update java.py
f9b953f
@blakeli0
chore: Update java.py
f1db946
@blakeli0
chore: Dedent
3b39da7
@blakeli0
chore: Dedent
31c4de6
@blakeli0
Revert "chore: Dedent"
3957c6a
This reverts commit 31c4de6.
@blakeli0
chore: Dedent
06c3616
@blakeli0
chore: Re-generate golden integration tests.
60ad11c
@blakeli0
chore: reformat
9ac79fc
@blakeli0
blakeli0 marked this pull request as ready for review January 5, 2026 18:02
@blakeli0
blakeli0 requested review from lqiu96 and zhumin8 January 5, 2026 18:02
zhumin8
zhumin8 reviewed Jan 5, 2026
View reviewed changes
Comment thread ...ator-java/src/main/java/com/google/api/generator/gapic/composer/comment/CommentComposer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread WORKSPACE Resolved

Uh oh!

There was an error while loading. Please reload this page.

lqiu96
lqiu96 reviewed Jan 5, 2026
View reviewed changes
Comment thread gapic-generator-java/pom.xml Outdated
</additionalClasspathElement>
</additionalClasspathElements>
<environmentVariables>
<TEST_CURRENT_YEAR>2025</TEST_CURRENT_YEAR>

@lqiu96 lqiu96 Jan 5, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

qq, would this override the value of an env var I set locally on my computer? Do you know which one has precendence?

If this takes precedence, maybe we can set this as a maven property so that we can configure this (if we need to ever test locally) with something like -DoverrideYear=YEAR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@blakeli0 blakeli0 Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the suggestion! I made it a Maven property since it's generally a better practice. I tested that this override does take precedence.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
lqiu96
lqiu96 reviewed Jan 5, 2026
View reviewed changes
Comment thread hermetic_build/library_generation/owlbot/synthtool/languages/java.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

lqiu96
lqiu96 reviewed Jan 5, 2026
View reviewed changes
Comment thread .cloudbuild/library_generation/cloudbuild-library-generation-integration-test.yaml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@blakeli0
chore: Address review comments.
35f6d73
@blakeli0
blakeli0 requested review from lqiu96 and zhumin8 January 5, 2026 19:54
zhumin8
zhumin8 reviewed Jan 5, 2026
View reviewed changes

@zhumin8 zhumin8 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LTGM. I'd be great if you could add a bit of documentation:

  • Document this new env variable perhaps in https://github.com/googleapis/sdk-platform-java/blob/main/hermetic_build/README.md
  • Make a note that env var does not apply to "Java generator golden integration tests" as you explained in the description, so this nuance is not lost.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@blakeli0
chore: Add comments.
b45c185
@blakeli0

blakeli0 commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

LTGM. I'd be great if you could add a bit of documentation:

  • Document this new env variable perhaps in https://github.com/googleapis/sdk-platform-java/blob/main/hermetic_build/README.md
  • Make a note that env var does not apply to "Java generator golden integration tests" as you explained in the description, so this nuance is not lost.

I added more comments to CommentComposer, including nuances of the golden integration tests as well.
I don't think we should document this in README though because this is more like a test only thing to make developers' life easier, it's actually better if developers do not notice this at all.

zhumin8 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blakeli0
chore: Add comments.
674dd9e
@blakeli0
blakeli0 requested a review from zhumin8 January 5, 2026 21:37
lqiu96
lqiu96 approved these changes Jan 5, 2026
View reviewed changes
zhumin8
zhumin8 approved these changes Jan 5, 2026
View reviewed changes
@sonarqubecloud

sonarqubecloud Bot commented Jan 5, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
75.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonarqubecloud

sonarqubecloud Bot commented Jan 5, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blakeli0
blakeli0 merged commit 6f59f7c into main Jan 5, 2026
@blakeli0
blakeli0 deleted the use_fixed_copyright branch January 5, 2026 22:03
@zhumin8 zhumin8 mentioned this pull request Jan 7, 2026
Nightly-java8 build on windows-2022 failed. #4042
Closed
@zhumin8 zhumin8 mentioned this pull request Jan 15, 2026
fix: Use ADC in NativeTests GoogleCloudPlatform/spring-cloud-gcp#4280
Merged
@diegomarquezp diegomarquezp mentioned this pull request Jan 15, 2026
chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026 googleapis/java-pubsub#2660
Merged
diegomarquezp added a commit to googleapis/java-pubsub that referenced this pull request Jan 15, 2026
@diegomarquezp
chore: remove usage of GOOD_LICENSE
d37754d
This variable was removed in googleapis/sdk-platform-java#4036
diegomarquezp added a commit to googleapis/java-pubsub that referenced this pull request Jan 15, 2026
@cloud-java-bot @diegomarquezp
chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026 (
fe73614
#2660)

* chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026

* chore: remove usage of GOOD_LICENSE

This variable was removed in googleapis/sdk-platform-java#4036

* chore: generate libraries at Thu Jan 15 16:59:29 UTC 2026

---------

Co-authored-by: Diego Marquez <[email protected]>
blakeli0 added a commit to googleapis/java-pubsub that referenced this pull request Feb 3, 2026
@blakeli0 @cloud-java-bot
@diegomarquezp @michaelpri10 @renovate-bot @release-please
chore: Merge release v1.145.0 into protobuf-3.x (#2680)
930c03c
* chore: Update generation configuration at Thu Dec  4 02:36:21 UTC 2025 (#2616)

* chore: add release-please config for protobuf-4.x (#2620)

* chore: add release-please config for protobuf-4.x

* chore: generate libraries at Wed Dec  3 19:03:35 UTC 2025

* Change release type from java-backport to java-yoshi

* Refactor release-please.yml to remove redundancy

Removed duplicate bumpMinorPreMajor setting for java-yoshi.

---------

Co-authored-by: cloud-java-bot <[email protected]>

* feat: Make v1 the default protocolVersion (#2623)

* deps: update dependency com.google.cloud:google-cloud-bigquery to v2.56.0 (#2617)

Co-authored-by: Mike Prieto <[email protected]>

* chore(deps): update dependency com.google.cloud:libraries-bom to v26.72.0 (#2618)

Co-authored-by: Mike Prieto <[email protected]>

* chore: Update generation configuration at Thu Dec 11 02:39:02 UTC 2025 (#2621)

* chore: Update generation configuration at Fri Dec  5 02:36:42 UTC 2025

* chore: Update generation configuration at Sat Dec  6 02:34:10 UTC 2025

* chore: generate libraries at Sat Dec  6 02:34:39 UTC 2025

* chore: Update generation configuration at Tue Dec  9 02:36:52 UTC 2025

* chore: Update generation configuration at Wed Dec 10 02:37:35 UTC 2025

* chore: Update generation configuration at Thu Dec 11 02:39:02 UTC 2025

* chore: generate libraries at Thu Dec 11 02:39:32 UTC 2025

* deps: update dependency com.google.protobuf:protobuf-java-util to v4.33.2 (#2625)

* deps: update dependency com.google.cloud:google-cloud-core to v2.62.2 (#2632)

* deps: update dependency com.google.cloud:sdk-platform-java-config to v3.54.2 (#2633)

* deps: update actions/checkout action to v6 (#2619)

Co-authored-by: Mike Prieto <[email protected]>

* chore(main): release 1.143.2-SNAPSHOT (#2614)

* chore(main): release 1.143.2-SNAPSHOT

* chore: generate libraries at Thu Dec 11 20:10:46 UTC 2025

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <[email protected]>

* chore(main): release 1.144.0 (#2635)

* chore(main): release 1.144.0

* chore: generate libraries at Thu Dec 11 22:30:31 UTC 2025

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <[email protected]>

* chore(main): release 1.144.1-SNAPSHOT (#2637)

:robot: I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).

* fix: Lower the Subscriber protocol version to disable the streaming pull keepalive feature (#2652)

* feat: Make v1 the default protocolVersion

* fix: Lower the Subscriber protocol version to disable the streaming pull keepalive feature

* fix: Downgrade streaming pull keepalive close stream log from WARNING to FINE

* fix: Change from FINE to INFO for ping monitor stream closure log

* chore(main): release 1.144.1 (#2654)

* chore(main): release 1.144.1

* chore: generate libraries at Mon Dec 22 21:34:41 UTC 2025

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <[email protected]>

* chore: cleanup release-please config (#2624)

* chore: cleanup release-please config

- Remove redundant options already declared at the top level.\n- Remove bumpMinorPreMajor for repositories after the first major release.

* chore: format release-please.yml

* deps: update googleapis/sdk-platform-java action to v2.65.1 (#2657)

* deps: update dependency com.google.cloud:sdk-platform-java-config to v3.55.1 (#2658)

* chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026 (#2660)

* chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026

* chore: remove usage of GOOD_LICENSE

This variable was removed in googleapis/sdk-platform-java#4036

* chore: generate libraries at Thu Jan 15 16:59:29 UTC 2026

---------

Co-authored-by: Diego Marquez <[email protected]>

* chore(main): release 1.144.2-SNAPSHOT (#2655)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* chore(main): release 1.145.0 (#2661)

* chore(main): release 1.145.0

* chore: generate libraries at Thu Jan 15 19:49:21 UTC 2026

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <[email protected]>

---------

Co-authored-by: cloud-java-bot <[email protected]>
Co-authored-by: Diego Marquez <[email protected]>
Co-authored-by: cloud-java-bot <[email protected]>
Co-authored-by: Mike Prieto <[email protected]>
Co-authored-by: Mend Renovate <[email protected]>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
lqiu96 pushed a commit that referenced this pull request Feb 12, 2026
@blakeli0 @cloud-java-bot @lqiu96
tests: Use fixed copyright year in tests. (#4036)
ba1b26e
The generator use the current year to generate copyright headers, so
there are multiple tests failing when a new year comes. The general fix
is to introduce an environment variable `TEST_CURRENT_YEAR` so that we
can override it in tests. See below for the exact fix for each scenario:

- Java generator golden unit tests
- [Override it with
Maven](https://github.com/googleapis/sdk-platform-java/blob/9ac79fc6c856a0b71111e28e2f69eeb0c01b4fc9/gapic-generator-java/pom.xml#L326-L328).
- Java generator golden integration tests
- Updated the golden files. These tests are generated from Bazel rules.
Bazel builds are pretty hermetic and I couldn't find a way to override
the environment variable. This is because the Bazel rule
`java_gapic_library` [calls the
generator](https://github.com/googleapis/sdk-platform-java/blob/b43f77c66d93d2423744d0f6d6a0a2a53a06e6d9/rules_java_gapic/java_gapic.bzl#L224-L235)
through `proto_custom_library` which does not pass any environment
variables.
- Python hermetic build scripts unit tests.
- Override it with
[mocks](https://github.com/googleapis/sdk-platform-java/blob/9ac79fc6c856a0b71111e28e2f69eeb0c01b4fc9/hermetic_build/library_generation/tests/owlbot/java_unit_tests.py#L176).
This requires a small refactoring in java.py.
- Hermetic build scripts integration tests.
- Changed these tests to non-required for now. These tests use a
[hardcoded generator
version](https://github.com/googleapis/sdk-platform-java/blob/b43f77c66d93d2423744d0f6d6a0a2a53a06e6d9/.cloudbuild/library_generation/cloudbuild-library-generation-integration-test.yaml#L69-L74)
that does not recognize the environment variable. Once the generator is
released, we can update the generator version and override the
environment variable in CloudBuild yamls.
- SpringCodeGen unit tests.
- Once the generator is released, we can override the same environment
variable with Maven in spring-cloud-gcp.

Separately, updated zlib version in Bazel build because there is a known
incompatibility between old zlib library and the latest macOS version.

fixes: #3547

---------

Co-authored-by: cloud-java-bot <[email protected]>
meltsufin pushed a commit to googleapis/google-cloud-java that referenced this pull request May 1, 2026
@cloud-java-bot @diegomarquezp
chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026 (
4d69a92
#2660)

* chore: Update generation configuration at Thu Jan 15 16:44:58 UTC 2026

* chore: remove usage of GOOD_LICENSE

This variable was removed in googleapis/sdk-platform-java#4036

* chore: generate libraries at Thu Jan 15 16:59:29 UTC 2026

---------

Co-authored-by: Diego Marquez <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@zhumin8 zhumin8 zhumin8 approved these changes
@lqiu96 lqiu96 lqiu96 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size: m Pull request size is medium.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Tests should not automatically start failing when new year comes

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@blakeli0 @zhumin8 @lqiu96 @cloud-java-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.