-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only append
.api.grpc
suffix to group id if the artifact id st…
…arts with `proto-` or `grpc-` (#2731) In this PR: - Only append `.api.grpc` suffix to group id if the corresponding artifact id starts with `proto-` or `grpc-`. We need to support `ad-manager`, which is the first artifact id doesn't start with `proto-`, `grpc-` and `google-`.
- Loading branch information
1 parent
dbdcc91
commit 8e87b2e
Showing
13 changed files
with
327 additions
and
9 deletions.
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
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,47 @@ | ||
# 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_pom_in_subdir | ||
|
||
script_dir = os.path.dirname(os.path.realpath(__file__)) | ||
resources_dir = os.path.join(script_dir, "..", "resources", "test-owlbot") | ||
|
||
|
||
class FixPomsTest(unittest.TestCase): | ||
def test_update_poms_group_id_does_not_start_with_google_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(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 __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 |