-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: only append .api.grpc
suffix to group id if the artifact id starts with proto-
or grpc-
#2731
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
49a7641
fix: do not change group id if the artifact id starts with ad-
JoeWang1127 5bbf73c
add comment
JoeWang1127 fe6e77a
add comment
JoeWang1127 cf92835
Merge branch 'main' into fix/fix-artifact-id
JoeWang1127 6a463d8
add unit test
JoeWang1127 6faf2db
code refactor
JoeWang1127 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import os | ||
import shutil | ||
import unittest | ||
from library_generation.owlbot.src.fix_poms import main | ||
from library_generation.test.compare_poms import compare_xml | ||
from library_generation.test.test_utils import FileComparator | ||
|
||
script_dir = os.path.dirname(os.path.realpath(__file__)) | ||
resources_dir = os.path.join(script_dir, "..", "resources", "test-owlbot") | ||
file_comparator = FileComparator() | ||
|
||
|
||
class FixPomsTest(unittest.TestCase): | ||
def test_fix_poms_update_poms_for_ad_manager_correctly(self): | ||
ad_manager_resource = os.path.join(resources_dir, "java-admanager") | ||
versions_file = os.path.join(ad_manager_resource, "versions.txt") | ||
os.chdir(ad_manager_resource) | ||
sub_dirs = ["ad-manager", "ad-manager-bom", "proto-ad-manager-v1", "."] | ||
for sub_dir in sub_dirs: | ||
self.__copy__golden(ad_manager_resource, sub_dir) | ||
main(versions_file, "true") | ||
for sub_dir in sub_dirs: | ||
self.assertFalse(self.__compare_pom_in_subdir(ad_manager_resource, sub_dir)) | ||
for sub_dir in sub_dirs: | ||
self.__remove_file_in_subdir(ad_manager_resource, sub_dir) | ||
|
||
@classmethod | ||
def __copy__golden(cls, base_dir: str, subdir: str): | ||
golden = os.path.join(base_dir, subdir, "pom-golden.xml") | ||
pom = os.path.join(base_dir, subdir, "pom.xml") | ||
shutil.copyfile(golden, pom) | ||
|
||
@classmethod | ||
def __compare_pom_in_subdir(cls, base_dir: str, subdir: str): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this can be moved to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
golden = os.path.join(base_dir, subdir, "pom-golden.xml") | ||
pom = os.path.join(base_dir, subdir, "pom.xml") | ||
return compare_xml( | ||
golden, | ||
pom, | ||
False, | ||
) | ||
|
||
@classmethod | ||
def __remove_file_in_subdir(cls, base_dir: str, subdir: str): | ||
pom = os.path.join(base_dir, subdir, "pom.xml") | ||
os.unlink(pom) |
16 changes: 16 additions & 0 deletions
16
library_generation/test/resources/test-owlbot/java-admanager/.repo-metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"api_shortname": "admanager", | ||
"name_pretty": "Google Ad Manager API", | ||
"product_documentation": "https://developers.google.com/ad-manager/api/beta", | ||
"api_description": "The Ad Manager API enables an app to integrate with Google Ad Manager. You can read Ad Manager data and run reports using the API.", | ||
"client_documentation": "https://cloud.google.com/java/docs/reference/ad-manager/latest/overview", | ||
"release_level": "preview", | ||
"transport": "http", | ||
"language": "java", | ||
"repo": "googleapis/google-cloud-java", | ||
"repo_short": "java-admanager", | ||
"distribution_name": "com.google.api-ads:ad-manager", | ||
"api_id": "admanager.googleapis.com", | ||
"library_type": "GAPIC_AUTO", | ||
"requires_billing": true | ||
} |
38 changes: 38 additions & 0 deletions
38
library_generation/test/resources/test-owlbot/java-admanager/ad-manager-bom/pom-golden.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager-bom</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
<packaging>pom</packaging> | ||
<parent> | ||
<groupId>com.google.cloud</groupId> | ||
<artifactId>google-cloud-pom-parent</artifactId> | ||
<version>1.37.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-java:current} --> | ||
<relativePath>../../google-cloud-pom-parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<name>Google Google Ad Manager API BOM</name> | ||
<description> | ||
BOM for Google Ad Manager API | ||
</description> | ||
|
||
<properties> | ||
<maven.antrun.skip>true</maven.antrun.skip> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api-ads.api.grpc</groupId> | ||
<artifactId>proto-ad-manager-v1</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:proto-ad-manager-v1:current} --> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
108 changes: 108 additions & 0 deletions
108
library_generation/test/resources/test-owlbot/java-admanager/ad-manager/pom-golden.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
<packaging>jar</packaging> | ||
<name>Google Google Ad Manager API</name> | ||
<description>Google Ad Manager API The Ad Manager API enables an app to integrate with Google Ad Manager. You can read Ad Manager data and run reports using the API.</description> | ||
<parent> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager-parent</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
</parent> | ||
<properties> | ||
<site.installationModule>ad-manager</site.installationModule> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-stub</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-protobuf</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>api-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api.grpc</groupId> | ||
<artifactId>proto-google-common-protos</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.api-ads.api.grpc</groupId> | ||
<artifactId>proto-ad-manager-v1</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>gax</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>gax-grpc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>gax-httpjson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api.grpc</groupId> | ||
<artifactId>grpc-google-common-protos</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api.grpc</groupId> | ||
<artifactId>proto-google-iam-v1</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api.grpc</groupId> | ||
<artifactId>grpc-google-iam-v1</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.threeten</groupId> | ||
<artifactId>threetenbp</artifactId> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Need testing utility classes for generated gRPC clients tests --> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>gax</artifactId> | ||
<classifier>testlib</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>gax-grpc</artifactId> | ||
<classifier>testlib</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>gax-httpjson</artifactId> | ||
<classifier>testlib</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
49 changes: 49 additions & 0 deletions
49
library_generation/test/resources/test-owlbot/java-admanager/pom-golden.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager-parent</artifactId> | ||
<packaging>pom</packaging> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
<name>Google Google Ad Manager API Parent</name> | ||
<description> | ||
Java idiomatic client for Google Cloud Platform services. | ||
</description> | ||
|
||
<parent> | ||
<groupId>com.google.cloud</groupId> | ||
<artifactId>google-cloud-jar-parent</artifactId> | ||
<version>1.37.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-java:current} --> | ||
<relativePath>../google-cloud-jar-parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<github.global.server>github</github.global.server> | ||
<site.installationModule>ad-manager-parent</site.installationModule> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api-ads.api.grpc</groupId> | ||
<artifactId>proto-ad-manager-v1</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:proto-ad-manager-v1:current} --> | ||
</dependency> | ||
|
||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<modules> | ||
<module>ad-manager</module> | ||
<module>proto-ad-manager-v1</module> | ||
<module>ad-manager-bom</module> | ||
</modules> | ||
|
||
</project> |
37 changes: 37 additions & 0 deletions
37
...y_generation/test/resources/test-owlbot/java-admanager/proto-ad-manager-v1/pom-golden.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.google.api-ads.api.grpc</groupId> | ||
<artifactId>proto-ad-manager-v1</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:proto-ad-manager-v1:current} --> | ||
<name>proto-ad-manager-v1</name> | ||
<description>Proto library for ad-manager</description> | ||
<parent> | ||
<groupId>com.google.api-ads</groupId> | ||
<artifactId>ad-manager-parent</artifactId> | ||
<version>0.2.0-SNAPSHOT</version><!-- {x-version-update:ad-manager:current} --> | ||
</parent> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api.grpc</groupId> | ||
<artifactId>proto-google-common-protos</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api.grpc</groupId> | ||
<artifactId>proto-google-iam-v1</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api</groupId> | ||
<artifactId>api-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
6 changes: 6 additions & 0 deletions
6
library_generation/test/resources/test-owlbot/java-admanager/versions.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Format: | ||
# module:released-version:current-version | ||
|
||
google-cloud-java:1.36.0:1.37.0-SNAPSHOT | ||
ad-manager:0.1.0:0.2.0-SNAPSHOT | ||
proto-ad-manager-v1:0.1.0:0.2.0-SNAPSHOT |
Oops, something went wrong.
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.
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.
The test case is not specific to
ad_manager
, more likenon-cloud
, orgroup_id_does_not_start_with_google
to be more specific.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.