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 — feat: populate `.repo-metadata.json` from highest version by JoeWang1127 · Pull Request #2890 · googleapis/sdk-platform-java

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

Conversation

@JoeWang1127

@JoeWang1127 JoeWang1127 commented Jun 13, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

In this PR:

  • populate .repo-metadata.json from highest stable version of proto paths.

The .repo-metadata.json is only generated once per library and the first item in proto paths is used, so the proto paths with the highest stable version should be the first item after sorting the proto paths in the library.

The method used to compare two proto paths, a and b:

  1. if both of a and b don't have a version, the one with lower depth is smaller.
  2. if either a or b has a version, the one with the version is smaller.
  3. if either a or b has a stable version, but not both, the one with the stable version is smaller, e.g., google/spanner/v2 is smaller than google/spanner/v3beta.
  4. if both a and b have a non-stable version, the one with higher version is smaller, e.g., google/spanner/v2beta1 is smaller than google/spanner/v2alpha2.
  5. if both a and b have a stable version, the one with lower depth is smaller, e.g., google/spanner/v1 is smaller than google/spanner/admin/v1, google/spanner/v1 is smaller than google/spanner/admin/v2
  6. if both a and b have a stable version and the depth is the same, the one with higher version is smaller, e.g., google/spanner/v2 is smaller than google/spanner/v1.

Test the change:

  1. build the image locally:
docker build -f .cloudbuild/library_generation/library_generation.Dockerfile -t local:latest .
  1. build the generator locally:
mvn -V -B -ntp clean install -DskipTests
  1. run the image:
docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workspace" -v "$HOME/.m2:/home/.m2" local:latest

Result:

  1. no change in common protos
  2. transport changed to both in java-iam/.repo-metadata.json. This is expected since the transport in google/iam/v2/BUILD.bazel is grpc+rest. Without this change, the transport is parsed from google/iam/v2/BUILD.bazel, which doesn't have a java_gapic_library target, thus the value is grpc by default.

Sorry, something went wrong.

Uh oh!

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

All reactions
JoeWang1127 added 4 commits June 13, 2024 16:29
@JoeWang1127
feat: populate `.repo-metadata.json using the highest version
57f1a13
@JoeWang1127
add unit tests
bd77781
@JoeWang1127
Merge branch 'main' into feat/populate-metadate-from-highest-version
aaf65a9
@JoeWang1127
Merge branch 'main' into feat/populate-metadate-from-highest-version
07f5172
@JoeWang1127
JoeWang1127 marked this pull request as ready for review June 17, 2024 16:19
@JoeWang1127
JoeWang1127 requested review from a team, blakeli0 and diegomarquezp June 17, 2024 16:19
diegomarquezp
diegomarquezp reviewed Jun 17, 2024
View reviewed changes

@diegomarquezp diegomarquezp 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.

QQ, Don't we have .repo-metadata golden files for our units? Maybe we can change one of these to test the proto_path sorting criteria

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread library_generation/model/gapic_config.py Outdated
if len(self_dirs) != len(other_dirs):
return len(self_dirs) < len(other_dirs)
# otherwise, the one with higher version is smaller.
return self_version > other_version

@diegomarquezp diegomarquezp Jun 17, 2024

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.

I'm a bit ignorant to string comparison in python. Is v2 greater than v1 because "2" has a higher ASCII value than "1"?

Sorry, something went wrong.

Uh oh!

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

All reactions

@JoeWang1127 JoeWang1127 Jun 17, 2024

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.

Is v2 greater than v1 because "2" has a higher ASCII value than "1"?

Yes.

I released that string comparison has a bug here: v10 is smaller than v2. I'll change the algorithm.

Sorry, something went wrong.

Uh oh!

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

All reactions

@JoeWang1127 JoeWang1127 Jun 18, 2024

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.

Done.

Sorry, something went wrong.

Uh oh!

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

All reactions
blakeli0
blakeli0 reviewed Jun 17, 2024
View reviewed changes
Comment thread library_generation/utils/proto_path_utils.py Resolved

Uh oh!

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

Comment thread library_generation/model/gapic_config.py Resolved

Uh oh!

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

blakeli0
blakeli0 reviewed Jun 18, 2024
View reviewed changes
Comment thread library_generation/test/model/library_config_unit_tests.py
)
self.assertEqual("secret", library.get_library_name())

def test_get_sorted_gapic_configs_returns_correct_order(self):

@blakeli0 blakeli0 Jun 18, 2024

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.

Can we create a test for each of the scenario? [v1alpha1, v1], [v1, v2] etc. Because

  1. It would be much more readable. For example, just by reading the tests, I don't know why v1alpha1, v1, v2, admin_v2, non_versioned, v1beta1 is sorted to v2, v1, admin_v2, v1beta1, v1alpha1, non_versioned.
  2. We can also easily test more scenarios. e.g. scenarios of two non versioned libraries.

Sorry, something went wrong.

Uh oh!

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

All reactions

@JoeWang1127 JoeWang1127 Jun 18, 2024 •
edited
Loading

Uh oh!

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

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.

I added unit tests to verify comparison result of two gapic_configs.

I kept this test case though.

Sorry, something went wrong.

Uh oh!

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

All reactions
JoeWang1127 added 2 commits June 18, 2024 14:57
@JoeWang1127
change comparsion alg
b9611ff
@JoeWang1127
add unit tests
c2e7b1c
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Jun 18, 2024
@sonarqubecloud

sonarqubecloud Bot commented Jun 18, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'gapic-generator-java-root'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

All reactions

Sorry, something went wrong.

Uh oh!

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

@sonarqubecloud

sonarqubecloud Bot commented Jun 18, 2024

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
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

All reactions

Sorry, something went wrong.

Uh oh!

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

@JoeWang1127
JoeWang1127 requested a review from blakeli0 June 18, 2024 19:35
@JoeWang1127

JoeWang1127 commented Jun 18, 2024

Copy link
Copy Markdown
Contributor Author

QQ, Don't we have .repo-metadata golden files for our units? Maybe we can change one of these to test the proto_path sorting criteria

The golden files are used in testing .repo-metadata.json generation, generate_prerequisite_files to be specific.

If we want to test generating this file with a library_config (from which contains multiple proto_path), we need test generate_composed_library, which is not easy to do since this function aggregates many "small" functions and is tested in integration test.

All reactions

Sorry, something went wrong.

Uh oh!

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

@JoeWang1127
JoeWang1127 requested a review from diegomarquezp June 18, 2024 20:27
blakeli0
blakeli0 approved these changes Jun 19, 2024
View reviewed changes
@JoeWang1127
JoeWang1127 merged commit f587541 into main Jun 19, 2024
@JoeWang1127
JoeWang1127 deleted the feat/populate-metadate-from-highest-version branch June 19, 2024 12:19
@release-please release-please Bot mentioned this pull request Jun 19, 2024
chore(main): release 2.42.0 #2847
Merged
@blakeli0 blakeli0 mentioned this pull request Jun 20, 2024
chore: add iam logging #2932
Merged
JoeWang1127 added a commit that referenced this pull request Jun 25, 2024
@release-please @JoeWang1127
chore(main): release 2.42.0 (#2847)
4f5c4d9
🤖 I have created a release *beep* *boop*
---


<details><summary>2.42.0</summary>

##
[2.42.0](v2.41.0...v2.42.0)
(2024-06-25)


### Features

* Allow Adding Client Level Attributes to MetricsTracerFactory
([#2614](#2614))
([f122c6f](f122c6f))
* gapic-generator-java to perform a no-op when no services are detected
([#2460](#2460))
([c0b5646](c0b5646))
* Make Layout Parser generally available in V1
([e508ae6](e508ae6))
* populate `.repo-metadata.json` from highest version
([#2890](#2890))
([f587541](f587541))
* push SNAPSHOT versions of the hermetic build docker image
([#2888](#2888))
([81df866](81df866))


### Bug Fixes

* **deps:** update the Java code generator (gapic-generator-java) to
1.2.3
([e508ae6](e508ae6))
* Expose Gax meter name
([#2865](#2865))
([6c5d6ce](6c5d6ce))
* Move the logic of getting systemProductName from static block to
static method
([#2874](#2874))
([536f1eb](536f1eb))
* Update default Otel Attribute from method_name to method
([#2833](#2833))
([af10a9e](af10a9e))


### Dependencies

* update dependency com.google.auto.value:auto-value to v1.11.0
([#2842](#2842))
([dd27fdf](dd27fdf))
* update dependency com.google.auto.value:auto-value-annotations to
v1.11.0
([#2843](#2843))
([bf8e67f](bf8e67f))
* update dependency com.google.cloud:grpc-gcp to v1.6.1
([#2943](#2943))
([9f16b40](9f16b40))
* update dependency org.checkerframework:checker-qual to v3.44.0
([#2848](#2848))
([7a99c50](7a99c50))
* update dependency org.easymock:easymock to v5.3.0
([#2871](#2871))
([c243f7d](c243f7d))
* update google api dependencies
([#2846](#2846))
([b5ef698](b5ef698))
* update googleapis/java-cloud-bom digest to 17cc5ec
([#2882](#2882))
([d6abd8e](d6abd8e))
* update netty dependencies to v4.1.111.final
([#2877](#2877))
([b5f10b9](b5f10b9))
* update opentelemetry-java monorepo to v1.39.0
([#2863](#2863))
([9d1f3a8](9d1f3a8))
</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>
Co-authored-by: Joe Wang <[email protected]>
chingor13 pushed a commit to googleapis/google-cloud-java that referenced this pull request Mar 24, 2026
@release-please @JoeWang1127
chore(main): release 2.42.0 (#2847)
c85602b
🤖 I have created a release *beep* *boop*
---


<details><summary>2.42.0</summary>

##
[2.42.0](googleapis/sdk-platform-java@v2.41.0...v2.42.0)
(2024-06-25)


### Features

* Allow Adding Client Level Attributes to MetricsTracerFactory
([#2614](googleapis/sdk-platform-java#2614))
([e254528](googleapis/sdk-platform-java@e254528))
* gapic-generator-java to perform a no-op when no services are detected
([#2460](googleapis/sdk-platform-java#2460))
([1612391](googleapis/sdk-platform-java@1612391))
* Make Layout Parser generally available in V1
([30acafa](googleapis/sdk-platform-java@30acafa))
* populate `.repo-metadata.json` from highest version
([#2890](googleapis/sdk-platform-java#2890))
([3bca9a4](googleapis/sdk-platform-java@3bca9a4))
* push SNAPSHOT versions of the hermetic build docker image
([#2888](googleapis/sdk-platform-java#2888))
([8bc060b](googleapis/sdk-platform-java@8bc060b))


### Bug Fixes

* **deps:** update the Java code generator (gapic-generator-java) to
1.2.3
([30acafa](googleapis/sdk-platform-java@30acafa))
* Expose Gax meter name
([#2865](googleapis/sdk-platform-java#2865))
([2095f4a](googleapis/sdk-platform-java@2095f4a))
* Move the logic of getting systemProductName from static block to
static method
([#2874](googleapis/sdk-platform-java#2874))
([cf67770](googleapis/sdk-platform-java@cf67770))
* Update default Otel Attribute from method_name to method
([#2833](googleapis/sdk-platform-java#2833))
([a88fdde](googleapis/sdk-platform-java@a88fdde))


### Dependencies

* update dependency com.google.auto.value:auto-value to v1.11.0
([#2842](googleapis/sdk-platform-java#2842))
([758bd17](googleapis/sdk-platform-java@758bd17))
* update dependency com.google.auto.value:auto-value-annotations to
v1.11.0
([#2843](googleapis/sdk-platform-java#2843))
([bce5720](googleapis/sdk-platform-java@bce5720))
* update dependency com.google.cloud:grpc-gcp to v1.6.1
([#2943](googleapis/sdk-platform-java#2943))
([cfc6632](googleapis/sdk-platform-java@cfc6632))
* update dependency org.checkerframework:checker-qual to v3.44.0
([#2848](googleapis/sdk-platform-java#2848))
([7069aae](googleapis/sdk-platform-java@7069aae))
* update dependency org.easymock:easymock to v5.3.0
([#2871](googleapis/sdk-platform-java#2871))
([423167f](googleapis/sdk-platform-java@423167f))
* update google api dependencies
([#2846](googleapis/sdk-platform-java#2846))
([a3d852e](googleapis/sdk-platform-java@a3d852e))
* update googleapis/java-cloud-bom digest to 17cc5ec
([#2882](googleapis/sdk-platform-java#2882))
([09e4ea6](googleapis/sdk-platform-java@09e4ea6))
* update netty dependencies to v4.1.111.final
([#2877](googleapis/sdk-platform-java#2877))
([6430ac2](googleapis/sdk-platform-java@6430ac2))
* update opentelemetry-java monorepo to v1.39.0
([#2863](googleapis/sdk-platform-java#2863))
([b0f2946](googleapis/sdk-platform-java@b0f2946))
</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>
Co-authored-by: Joe Wang <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@diegomarquezp diegomarquezp Awaiting requested review from diegomarquezp
1 more reviewer
@blakeli0 blakeli0 blakeli0 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.

Uh oh!

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

3 participants

@JoeWang1127 @blakeli0 @diegomarquezp
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.