Skip to content

fix: do not generate Version.java files by default#12955

Open
diegomarquezp wants to merge 32 commits intomainfrom
fix/no-version-java-self-service
Open

fix: do not generate Version.java files by default#12955
diegomarquezp wants to merge 32 commits intomainfrom
fix/no-version-java-self-service

Conversation

@diegomarquezp
Copy link
Copy Markdown
Contributor

This prevents self-service libraries from having these files.

Copy link
Copy Markdown
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 a generate_version_java flag to control the generation of Version.java files, updating Bazel rules, the Java generator, and hermetic build scripts. It also adds several well-known type proto files for testing. The review feedback correctly identifies that the flag's default value should be changed to False to align with the objective of disabling generation by default and suggests using Collections.emptyList() for more idiomatic and efficient code.

Comment thread rules_java_gapic/java_gapic.bzl Outdated
Comment thread rules_java_gapic/java_gapic.bzl Outdated
Comment thread rules_java_gapic/java_gapic.bzl Outdated
fi

if [ -z "${generate_version_java}" ]; then
generate_version_java="true"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The default value for generate_version_java is set to "true", which contradicts the pull request title. It should be set to "false" to ensure that Version.java files are not generated by default in the hermetic build process.

Suggested change
generate_version_java="true"
generate_version_java="false"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is for our open source library generation, which does require Version.java generation

- name: Integration Tests
run: |
bazelisk --batch test //sdk-platform-java/test/integration/...
bazelisk --batch test //sdk-platform-java/test/integration/... --test_output=errors
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that flag is a convenience to understand generation diffs when the generator ITs are failing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I enabled version.java generation only in some goldens, both in gapic-generator-java and in test/integration

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

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

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

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

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

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

See analysis details on SonarQube Cloud

@diegomarquezp diegomarquezp marked this pull request as ready for review May 1, 2026 20:37
@diegomarquezp diegomarquezp requested a review from a team as a code owner May 1, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant