Closed JoeWang1127 closed 2 weeks ago
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
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.
In this PR:
.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
andb
:a
andb
don't have a version, the one with lower depth is smaller.a
orb
has a version, the one with the version is smaller.a
orb
has a stable version, but not both, the one with the stable version is smaller, e.g.,google/spanner/v2
is smaller thangoogle/spanner/v3beta
.a
andb
have a non-stable version, the one with higher version is smaller, e.g.,google/spanner/v2beta1
is smaller thangoogle/spanner/v2alpha2
.a
andb
have a stable version, the one with lower depth is smaller, e.g.,google/spanner/v1
is smaller thangoogle/spanner/admin/v1
,google/spanner/v1
is smaller thangoogle/spanner/admin/v2
a
andb
have a stable version and the depth is the same, the one with higher version is smaller, e.g.,google/spanner/v2
is smaller thangoogle/spanner/v1
.Test the change:
Result:
transport
changed toboth
injava-iam/.repo-metadata.json
. This is expected since thetransport
ingoogle/iam/v2/BUILD.bazel
isgrpc+rest
. Without this change, thetransport
is parsed fromgoogle/iam/v2/BUILD.bazel
, which doesn't have ajava_gapic_library
target, thus the value isgrpc
by default.