-
Notifications
You must be signed in to change notification settings - Fork 94
chore: generate non-cloud client library #1770
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bf72394
chore: add proto group prefix
JoeWang1127 3c8de89
add test case for generating google maps
JoeWang1127 4aed4ff
run new tests in ci
JoeWang1127 a4710a5
parameterize group id for proto artifacts
JoeWang1127 fab9f6b
use helper to compute group id of proto artifacts
JoeWang1127 9afa8a5
verify non cloud library generation
JoeWang1127 75f24e4
change artifact name in golden
JoeWang1127 58366b1
restore new client test
JoeWang1127 2be08e6
change description
JoeWang1127 854fa31
change description
JoeWang1127 7cff2e7
add comments to _proto_group_id
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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ def load_versions(filename: str, default_group_id: str) -> Mapping[str, module.M | |
| group_id = ( | ||
| default_group_id | ||
| if artifact_id.startswith("google-") | ||
| else "com.google.api.grpc" | ||
| else _proto_group_id(default_group_id) | ||
| ) | ||
| modules[artifact_id] = module.Module( | ||
| group_id=group_id, | ||
|
|
@@ -274,6 +274,12 @@ def update_bom_pom(filename: str, modules: List[module.Module]): | |
|
|
||
| tree.write(filename, pretty_print=True, xml_declaration=True, encoding="utf-8") | ||
|
|
||
|
|
||
| def _proto_group_id(group_id: str) -> str: | ||
|
||
| prefix = "com.google" if group_id == "com.google.cloud" else group_id | ||
| return f"{prefix}.api.grpc" | ||
|
|
||
|
|
||
| def main(): | ||
| print(f"working directory: {os.getcwd()}") | ||
| with open(".repo-metadata.json", "r") as fp: | ||
|
|
@@ -353,15 +359,15 @@ def main(): | |
| for path in glob.glob("proto-google-*"): | ||
| if not path in existing_modules: | ||
| existing_modules[path] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=path, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
| ) | ||
| if path not in excluded_dependencies_list \ | ||
| and path not in main_module.artifact_id: | ||
| required_dependencies[path] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=path, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
|
|
@@ -378,7 +384,7 @@ def main(): | |
| if path not in excluded_dependencies_list \ | ||
| and path not in main_module.artifact_id: | ||
| required_dependencies[path] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=path, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
|
|
@@ -387,15 +393,15 @@ def main(): | |
| for path in glob.glob("grpc-google-*"): | ||
| if not path in existing_modules: | ||
| existing_modules[path] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=path, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
| ) | ||
| if path not in excluded_dependencies_list \ | ||
| and path not in main_module.artifact_id: | ||
| required_dependencies[path] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=path, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
|
|
@@ -415,7 +421,7 @@ def main(): | |
| if path not in excluded_dependencies_list \ | ||
| and path not in main_module.artifact_id: | ||
| required_dependencies[path] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=path, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
|
|
@@ -498,7 +504,7 @@ def main(): | |
| for dependency_module in extra_managed_modules: | ||
| if dependency_module not in existing_modules: | ||
| existing_modules[dependency_module] = module.Module( | ||
| group_id="com.google.api.grpc", | ||
| group_id=_proto_group_id(group_id), | ||
| artifact_id=dependency_module, | ||
| version=main_module.version, | ||
| release_version=main_module.release_version, | ||
|
|
||
This file contains hidden or 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
15 changes: 15 additions & 0 deletions
15
docker/owlbot/java/tests/new-client-maps/golden/.repo-metadata.json
This file contains hidden or 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,15 @@ | ||
| { | ||
| "name": "maps", | ||
| "name_pretty": "Example API", | ||
| "product_documentation": "https://maps.google.com/foo/", | ||
| "api_description": "is an example API", | ||
| "client_documentation": "https://googleapis.dev/java/google-maps-foo/latest/index.html", | ||
| "release_level": "beta", | ||
| "transport": "grpc", | ||
| "language": "java", | ||
| "repo": "googleapis/java-maps", | ||
| "repo_short": "java-maps", | ||
| "distribution_name": "com.google.maps:google-maps-foo", | ||
| "api_id": "maps.googleapis.com", | ||
| "requires_billing": true | ||
| } |
94 changes: 94 additions & 0 deletions
94
docker/owlbot/java/tests/new-client-maps/golden/google-maps-foo-bom/pom.xml
This file contains hidden or 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,94 @@ | ||
| <?xml version="1.0"?> | ||
| <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.maps</groupId> | ||
| <artifactId>google-maps-foo-bom</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-maps-foo:current} --> | ||
| <packaging>pom</packaging> | ||
| <parent> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>google-cloud-shared-config</artifactId> | ||
| <version>1.5.3</version> | ||
| </parent> | ||
|
|
||
| <name>Google Example API BOM</name> | ||
| <url>https://github.com/googleapis/java-maps</url> | ||
| <description> | ||
| BOM for Example API | ||
| </description> | ||
|
|
||
| <organization> | ||
| <name>Google LLC</name> | ||
| </organization> | ||
|
|
||
| <developers> | ||
| <developer> | ||
| <id>chingor13</id> | ||
| <name>Jeff Ching</name> | ||
| <email>[email protected]</email> | ||
| <organization>Google LLC</organization> | ||
| <roles> | ||
| <role>Developer</role> | ||
| </roles> | ||
| </developer> | ||
| <developer> | ||
| <id>neenushaji</id> | ||
| <name>Neenu Shaji</name> | ||
| <email>[email protected]</email> | ||
| <organization>Google LLC</organization> | ||
| <roles> | ||
| <role>Developer</role> | ||
| </roles> | ||
| </developer> | ||
| </developers> | ||
|
|
||
| <scm> | ||
| <connection>scm:git:https://github.com/googleapis/java-maps.git</connection> | ||
| <developerConnection>scm:git:[email protected]:googleapis/java-maps.git</developerConnection> | ||
| <url>https://github.com/googleapis/java-maps</url> | ||
| </scm> | ||
|
|
||
| <properties> | ||
| <maven.antrun.skip>true</maven.antrun.skip> | ||
| </properties> | ||
|
|
||
| <licenses> | ||
| <license> | ||
| <name>The Apache Software License, Version 2.0</name> | ||
| <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
| <distribution>repo</distribution> | ||
| </license> | ||
| </licenses> | ||
|
|
||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.google.maps</groupId> | ||
| <artifactId>google-maps-foo</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-maps-foo:current} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.maps.api.grpc</groupId> | ||
| <artifactId>grpc-google-maps-foo-v1</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-maps-foo-v1:current} --> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.maps.api.grpc</groupId> | ||
| <artifactId>proto-google-maps-foo-v1</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version><!-- {x-version-update:proto-google-maps-foo-v1:current} --> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-checkstyle-plugin</artifactId> | ||
| <configuration> | ||
| <skip>true</skip> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
139 changes: 139 additions & 0 deletions
139
docker/owlbot/java/tests/new-client-maps/golden/google-maps-foo/pom.xml
This file contains hidden or 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,139 @@ | ||
| <?xml version="1.0"?> | ||
| <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.maps</groupId> | ||
| <artifactId>google-maps-foo</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-maps-foo:current} --> | ||
| <packaging>jar</packaging> | ||
| <name>Google Example API</name> | ||
| <url>https://github.com/googleapis/java-maps</url> | ||
| <description>Example API is an example API</description> | ||
| <parent> | ||
| <groupId>com.google.maps</groupId> | ||
| <artifactId>google-maps-foo-parent</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version><!-- {x-version-update:google-maps-foo:current} --> | ||
| </parent> | ||
| <properties> | ||
| <site.installationModule>google-maps-foo</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.maps.api.grpc</groupId> | ||
| <artifactId>proto-google-maps-foo-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> | ||
| <version>4.13.2</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.maps.api.grpc</groupId> | ||
| <artifactId>grpc-google-maps-foo-v1</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> | ||
|
|
||
| <profiles> | ||
| <profile> | ||
| <id>java9</id> | ||
| <activation> | ||
| <jdk>[9,)</jdk> | ||
| </activation> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>javax.annotation</groupId> | ||
| <artifactId>javax.annotation-api</artifactId> | ||
| </dependency> | ||
| </dependencies> | ||
| </profile> | ||
| </profiles> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.codehaus.mojo</groupId> | ||
| <artifactId>flatten-maven-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
19 changes: 19 additions & 0 deletions
19
...ient-maps/golden/google-maps-foo/src/main/java/com/google/maps/foo/SomeServiceClient.java
This file contains hidden or 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,19 @@ | ||
| /* | ||
| * Copyright 2021 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. | ||
| */ | ||
|
|
||
| package com.google.maps.foo.v1; | ||
|
|
||
| class SomeServiceClient {} |
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.
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