diff --git a/docker/owlbot/java/cloudbuild_test.yaml b/docker/owlbot/java/cloudbuild_test.yaml index f1b4a7905..36ce6236f 100644 --- a/docker/owlbot/java/cloudbuild_test.yaml +++ b/docker/owlbot/java/cloudbuild_test.yaml @@ -47,3 +47,11 @@ steps: args: ["diff", "-rw", "input", "golden"] dir: docker/owlbot/java/tests/new-version waitFor: ["new-version-run"] + - name: "gcr.io/$PROJECT_ID/owlbot-java:$SHORT_SHA" + dir: docker/owlbot/java/tests/fix-poms/input + id: "fix-poms-run" + waitFor: ["build"] + - name: "bash" + args: ["diff", "-rw", "input", "golden"] + dir: docker/owlbot/java/tests/fix-poms + waitFor: ["fix-poms-run"] diff --git a/docker/owlbot/java/src/fix-poms.py b/docker/owlbot/java/src/fix-poms.py index c7738db94..a9829240b 100644 --- a/docker/owlbot/java/src/fix-poms.py +++ b/docker/owlbot/java/src/fix-poms.py @@ -47,7 +47,6 @@ def load_versions(filename: str, default_group_id: str) -> Mapping[str, module.M release_version=parts[1], version=parts[2], ) - return modules @@ -74,8 +73,15 @@ def _dependency_matches(node, group_id, artifact_id) -> bool: ) -def _is_cloud_client(proto_modules: List[module.Module], grpc_modules: List[module.Module]) -> bool: - return len(proto_modules) > 0 or len(grpc_modules) > 0 +def _is_cloud_client(existing_modules: List[module.Module]) -> bool: + proto_modules_len = 0 + grpc_modules_len = 0 + for artifact in existing_modules: + if artifact.startswith("proto-"): + proto_modules_len += 1 + if artifact.startswith("grpc-"): + grpc_modules_len += 1 + return proto_modules_len > 0 or grpc_modules_len > 0 def update_cloud_pom( @@ -268,16 +274,32 @@ def update_bom_pom(filename: str, modules: List[module.Module]): tree.write(filename, pretty_print=True, xml_declaration=True, encoding="utf-8") - def main(): with open(".repo-metadata.json", "r") as fp: repo_metadata = json.load(fp) group_id, artifact_id = repo_metadata["distribution_name"].split(":") name = repo_metadata["name_pretty"] - existing_modules = load_versions("versions.txt", group_id) + # extra modules that need to be manages in versions.txt + if "extra_versioned_modules" in repo_metadata: + extra_managed_modules = repo_metadata["extra_versioned_modules"].split(",") + else: + extra_managed_modules = "" + + # list of modules to be excluded from added to poms + if "excluded_dependencies" in repo_metadata: + excluded_dependencies_list = repo_metadata["excluded_dependencies"].split(",") + else: + excluded_dependencies_list = "" + + # list of poms that have to be excluded from post processing + if "excluded_poms" in repo_metadata: + excluded_poms_list = repo_metadata["excluded_poms"].split(",") + else: + excluded_poms_list = "" + if artifact_id not in existing_modules: existing_modules[artifact_id] = module.Module( group_id=group_id, @@ -288,6 +310,7 @@ def main(): main_module = existing_modules[artifact_id] parent_artifact_id = f"{artifact_id}-parent" + if parent_artifact_id not in existing_modules: existing_modules[parent_artifact_id] = module.Module( group_id=group_id, @@ -297,6 +320,16 @@ def main(): ) parent_module = existing_modules[parent_artifact_id] + required_dependencies = {} + for dependency_module in existing_modules: + if dependency_module not in excluded_dependencies_list: + required_dependencies[dependency_module] = module.Module( + group_id="com.google.api.grpc", + artifact_id=dependency_module, + version=main_module.version, + release_version=main_module.release_version, + ) + for path in glob.glob("proto-google-*"): if not path in existing_modules: existing_modules[path] = module.Module( @@ -305,17 +338,32 @@ def main(): 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", + artifact_id=path, + version=main_module.version, + release_version=main_module.release_version, + ) if not os.path.isfile(f"{path}/pom.xml"): print(f"creating missing proto pom: {path}") templates.render( template_name="proto_pom.xml.j2", output_name=f"{path}/pom.xml", - module=existing_modules[path], + module=required_dependencies[path], parent_module=parent_module, main_module=main_module, ) - + 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", + artifact_id=path, + version=main_module.version, + release_version=main_module.release_version, + ) + for path in glob.glob("grpc-google-*"): if not path in existing_modules: existing_modules[path] = module.Module( @@ -324,38 +372,60 @@ def main(): 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", + artifact_id=path, + version=main_module.version, + release_version=main_module.release_version, + ) + if not os.path.isfile(f"{path}/pom.xml"): proto_artifact_id = path.replace("grpc-", "proto-") print(f"creating missing grpc pom: {path}") templates.render( template_name="grpc_pom.xml.j2", output_name=f"{path}/pom.xml", - module=existing_modules[path], + module=required_dependencies[path], parent_module=parent_module, main_module=main_module, proto_module=existing_modules[proto_artifact_id], ) + 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", + artifact_id=path, + version=main_module.version, + release_version=main_module.release_version, + ) proto_modules = [ module - for module in existing_modules.values() + for module in required_dependencies.values() if module.artifact_id.startswith("proto-") + and module.artifact_id not in parent_artifact_id ] grpc_modules = [ module - for module in existing_modules.values() - if module.artifact_id.startswith("grpc-") + for module in required_dependencies.values() + if module.artifact_id.startswith("grpc-") \ + and module.artifact_id not in parent_artifact_id ] - modules = [main_module] + grpc_modules + proto_modules + if main_module in grpc_modules or main_module in proto_modules: + modules = grpc_modules + proto_modules + else: + modules = [main_module] + grpc_modules + proto_modules - if not _is_cloud_client(proto_modules, grpc_modules): + if not _is_cloud_client(existing_modules): print("no proto or grpc modules - probably not a cloud client") return if os.path.isfile(f"{artifact_id}/pom.xml"): print("updating modules in cloud pom.xml") - update_cloud_pom(f"{artifact_id}/pom.xml", proto_modules, grpc_modules) - else: + if artifact_id not in excluded_poms_list: + update_cloud_pom(f"{artifact_id}/pom.xml", proto_modules, grpc_modules) + elif artifact_id not in excluded_poms_list: print("creating missing cloud pom.xml") templates.render( template_name="cloud_pom.xml.j2", @@ -371,8 +441,9 @@ def main(): if os.path.isfile(f"{artifact_id}-bom/pom.xml"): print("updating modules in bom pom.xml") - update_bom_pom(f"{artifact_id}-bom/pom.xml", modules) - else: + if artifact_id+"-bom" not in excluded_poms_list: + update_bom_pom(f"{artifact_id}-bom/pom.xml", modules) + elif artifact_id+"-bom" not in excluded_poms_list: print("creating missing bom pom.xml") templates.render( template_name="bom_pom.xml.j2", @@ -401,10 +472,20 @@ def main(): print("updating modules in versions.txt") else: print("creating missing versions.txt") + existing_modules.pop(parent_artifact_id) + + # add extra modules to versions.txt + 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", + artifact_id=dependency_module, + version=main_module.version, + release_version=main_module.release_version, + ) templates.render( - template_name="versions.txt.j2", output_name="./versions.txt", modules=modules, + template_name="versions.txt.j2", output_name="./versions.txt", modules=existing_modules.values(), ) - if __name__ == "__main__": main() diff --git a/docker/owlbot/java/tests/fix-poms/golden/.gitignore b/docker/owlbot/java/tests/fix-poms/golden/.gitignore new file mode 100644 index 000000000..069d08fc7 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml diff --git a/docker/owlbot/java/tests/fix-poms/golden/.repo-metadata.json b/docker/owlbot/java/tests/fix-poms/golden/.repo-metadata.json new file mode 100644 index 000000000..ed1a65181 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/.repo-metadata.json @@ -0,0 +1,18 @@ +{ + "name": "foo", + "name_pretty": "Example API", + "product_documentation": "https://cloud.google.com/foo/", + "api_description": "is an example API", + "client_documentation": "https://googleapis.dev/java/google-cloud-foo/latest/index.html", + "release_level": "beta", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-foo", + "repo_short": "java-foo", + "distribution_name": "com.google.cloud:google-cloud-foo", + "api_id": "foo.googleapis.com", + "requires_billing": true, + "extra_versioned_modules": "google-cloud-foo-emulator", + "excluded_poms": "google-cloud-foo-bom", + "excluded_dependencies": "grpc-google-cloud-foo-v2,google-cloud-foo-bom" +} \ No newline at end of file diff --git a/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo-emulator/pom.xml b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo-emulator/pom.xml new file mode 100644 index 000000000..9c4f8ff68 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo-emulator/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + google-cloud-foo-emulator + 0.1.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 1.2.1 + + + Google Example API BOM + https://github.com/googleapis/java-foo + + BOM for Example API + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + neenushaji + Neenu Shaji + neenushaji@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-foo.git + scm:git:git@github.com:googleapis/java-foo.git + https://github.com/googleapis/java-foo + + + + true + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + com.google.cloud + google-cloud-foo + 0.1.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/pom.xml b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/pom.xml new file mode 100644 index 000000000..215a9475f --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + com.google.cloud + google-cloud-foo + 0.1.1-SNAPSHOT + jar + Google Example API + https://github.com/googleapis/java-foo + Example API is an example API + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + google-cloud-foo + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-foo-v2 + + + com.google.api.grpc + proto-google-cloud-foo-v1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13.2 + + + + com.google.api.grpc + grpc-google-cloud-foo-v1 + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceClient.java b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceClient.java new file mode 100644 index 000000000..3fdb2faa4 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceClient.java @@ -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.cloud.foo.v1; + +class SomeServiceClient {} diff --git a/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceSettings.java b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceSettings.java new file mode 100644 index 000000000..8097018ad --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceSettings.java @@ -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.cloud.foo.v1; + +class SomeServiceSettings {} diff --git a/docker/owlbot/java/tests/fix-poms/golden/grpc-google-cloud-foo-v1/pom.xml b/docker/owlbot/java/tests/fix-poms/golden/grpc-google-cloud-foo-v1/pom.xml new file mode 100644 index 000000000..65ea16f63 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/grpc-google-cloud-foo-v1/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + grpc-google-cloud-foo-v1 + GRPC library for google-cloud-foo + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-foo-v1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/docker/owlbot/java/tests/fix-poms/golden/grpc-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeService.java b/docker/owlbot/java/tests/fix-poms/golden/grpc-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeService.java new file mode 100644 index 000000000..4a3c4b7b1 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/grpc-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeService.java @@ -0,0 +1,28 @@ +/* + * Copyright 2020 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.cloud.foo.v1; + +/** + * + * + *
+ * Foo Service.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/foo/v1/bar.proto") +public final class SomeService {} diff --git a/docker/owlbot/java/tests/fix-poms/golden/pom.xml b/docker/owlbot/java/tests/fix-poms/golden/pom.xml new file mode 100644 index 000000000..885c7ea7c --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/pom.xml @@ -0,0 +1,193 @@ + + + 4.0.0 + com.google.cloud + google-cloud-foo-parent + pom + 0.1.1-SNAPSHOT + Google Example API Parent + https://github.com/googleapis/java-foo + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 1.2.1 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + neenushaji + Neenu Shaji + neenushaji@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-foo.git + scm:git:git@github.com:googleapis/java-foo.git + https://github.com/googleapis/java-foo + HEAD + + + https://github.com/googleapis/java-foo/issues + GitHub Issues + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-foo-parent + + + + + + com.google.cloud + google-cloud-foo + 0.1.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-foo-v2 + 0.1.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + + + + com.google.cloud + google-cloud-shared-dependencies + 2.4.0 + pom + import + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.objenesis:objenesis + javax.annotation:javax.annotation-api + + + + + + + + + google-cloud-foo + grpc-google-cloud-foo-v1 + proto-google-cloud-foo-v1 + proto-google-cloud-foo-v2 + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.1.1 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/clirr-ignored-differences.xml b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/clirr-ignored-differences.xml new file mode 100644 index 000000000..70e35c153 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/clirr-ignored-differences.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/pom.xml b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/pom.xml new file mode 100644 index 000000000..8ba19c75f --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + proto-google-cloud-foo-v1 + Proto library for google-cloud-foo + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeMessage.java b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeMessage.java new file mode 100644 index 000000000..a0ac9d758 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeMessage.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/foo/v1/bar.proto + +package com.google.cloud.foo.v1; + +/** + * + * + *
+ * Some sample class
+ * 
+ * + * Protobuf type {@code google.cloud.foo.v1.SomeMessage} + */ +public final class SomeMessage {} diff --git a/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/clirr-ignored-differences.xml b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/clirr-ignored-differences.xml new file mode 100644 index 000000000..70e35c153 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/clirr-ignored-differences.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/pom.xml b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/pom.xml new file mode 100644 index 000000000..57429eee6 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-foo-v2 + 0.1.1-SNAPSHOT + proto-google-cloud-foo-v2 + Proto library for google-cloud-foo + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/src/main/java/com/google/cloud/foo/v2/SomeMessage.java b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/src/main/java/com/google/cloud/foo/v2/SomeMessage.java new file mode 100644 index 000000000..b69d8daed --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/proto-google-cloud-foo-v2/src/main/java/com/google/cloud/foo/v2/SomeMessage.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/foo/v1/bar.proto + +package com.google.cloud.foo.v1; + +/** + * + * + *
+ * Some sample class
+ * 
+ * + * Protobuf type {@code google.cloud.foo.v2.SomeMessage} + */ +public final class SomeMessage {} diff --git a/docker/owlbot/java/tests/fix-poms/golden/versions.txt b/docker/owlbot/java/tests/fix-poms/golden/versions.txt new file mode 100644 index 000000000..4931ad357 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/golden/versions.txt @@ -0,0 +1,8 @@ +# Format: +# module:released-version:current-version + +google-cloud-foo:0.0.0:0.1.1-SNAPSHOT +grpc-google-cloud-foo-v1:0.0.0:0.1.1-SNAPSHOT +proto-google-cloud-foo-v1:0.0.0:0.1.1-SNAPSHOT +proto-google-cloud-foo-v2:0.0.0:0.1.1-SNAPSHOT +google-cloud-foo-emulator:0.0.0:0.1.1-SNAPSHOT diff --git a/docker/owlbot/java/tests/fix-poms/input/.gitignore b/docker/owlbot/java/tests/fix-poms/input/.gitignore new file mode 100644 index 000000000..069d08fc7 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml diff --git a/docker/owlbot/java/tests/fix-poms/input/.repo-metadata.json b/docker/owlbot/java/tests/fix-poms/input/.repo-metadata.json new file mode 100644 index 000000000..ed1a65181 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/.repo-metadata.json @@ -0,0 +1,18 @@ +{ + "name": "foo", + "name_pretty": "Example API", + "product_documentation": "https://cloud.google.com/foo/", + "api_description": "is an example API", + "client_documentation": "https://googleapis.dev/java/google-cloud-foo/latest/index.html", + "release_level": "beta", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-foo", + "repo_short": "java-foo", + "distribution_name": "com.google.cloud:google-cloud-foo", + "api_id": "foo.googleapis.com", + "requires_billing": true, + "extra_versioned_modules": "google-cloud-foo-emulator", + "excluded_poms": "google-cloud-foo-bom", + "excluded_dependencies": "grpc-google-cloud-foo-v2,google-cloud-foo-bom" +} \ No newline at end of file diff --git a/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo-emulator/pom.xml b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo-emulator/pom.xml new file mode 100644 index 000000000..9c4f8ff68 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo-emulator/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + google-cloud-foo-emulator + 0.1.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 1.2.1 + + + Google Example API BOM + https://github.com/googleapis/java-foo + + BOM for Example API + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + neenushaji + Neenu Shaji + neenushaji@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-foo.git + scm:git:git@github.com:googleapis/java-foo.git + https://github.com/googleapis/java-foo + + + + true + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + com.google.cloud + google-cloud-foo + 0.1.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/pom.xml b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/pom.xml new file mode 100644 index 000000000..215a9475f --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + com.google.cloud + google-cloud-foo + 0.1.1-SNAPSHOT + jar + Google Example API + https://github.com/googleapis/java-foo + Example API is an example API + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + google-cloud-foo + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-foo-v2 + + + com.google.api.grpc + proto-google-cloud-foo-v1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13.2 + + + + com.google.api.grpc + grpc-google-cloud-foo-v1 + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceClient.java b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceClient.java new file mode 100644 index 000000000..3fdb2faa4 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceClient.java @@ -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.cloud.foo.v1; + +class SomeServiceClient {} diff --git a/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceSettings.java b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceSettings.java new file mode 100644 index 000000000..8097018ad --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/google-cloud-foo/src/main/java/com/google/cloud/foo/SomeServiceSettings.java @@ -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.cloud.foo.v1; + +class SomeServiceSettings {} diff --git a/docker/owlbot/java/tests/fix-poms/input/grpc-google-cloud-foo-v1/pom.xml b/docker/owlbot/java/tests/fix-poms/input/grpc-google-cloud-foo-v1/pom.xml new file mode 100644 index 000000000..65ea16f63 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/grpc-google-cloud-foo-v1/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + grpc-google-cloud-foo-v1 + GRPC library for google-cloud-foo + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-foo-v1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/docker/owlbot/java/tests/fix-poms/input/grpc-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeService.java b/docker/owlbot/java/tests/fix-poms/input/grpc-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeService.java new file mode 100644 index 000000000..4a3c4b7b1 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/grpc-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeService.java @@ -0,0 +1,28 @@ +/* + * Copyright 2020 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.cloud.foo.v1; + +/** + * + * + *
+ * Foo Service.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/foo/v1/bar.proto") +public final class SomeService {} diff --git a/docker/owlbot/java/tests/fix-poms/input/pom.xml b/docker/owlbot/java/tests/fix-poms/input/pom.xml new file mode 100644 index 000000000..885c7ea7c --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/pom.xml @@ -0,0 +1,193 @@ + + + 4.0.0 + com.google.cloud + google-cloud-foo-parent + pom + 0.1.1-SNAPSHOT + Google Example API Parent + https://github.com/googleapis/java-foo + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 1.2.1 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + neenushaji + Neenu Shaji + neenushaji@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-foo.git + scm:git:git@github.com:googleapis/java-foo.git + https://github.com/googleapis/java-foo + HEAD + + + https://github.com/googleapis/java-foo/issues + GitHub Issues + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-foo-parent + + + + + + com.google.cloud + google-cloud-foo + 0.1.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-foo-v2 + 0.1.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + + + + com.google.cloud + google-cloud-shared-dependencies + 2.4.0 + pom + import + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.objenesis:objenesis + javax.annotation:javax.annotation-api + + + + + + + + + google-cloud-foo + grpc-google-cloud-foo-v1 + proto-google-cloud-foo-v1 + proto-google-cloud-foo-v2 + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.1.1 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/clirr-ignored-differences.xml b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/clirr-ignored-differences.xml new file mode 100644 index 000000000..70e35c153 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/clirr-ignored-differences.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/pom.xml b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/pom.xml new file mode 100644 index 000000000..8ba19c75f --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-foo-v1 + 0.1.1-SNAPSHOT + proto-google-cloud-foo-v1 + Proto library for google-cloud-foo + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeMessage.java b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeMessage.java new file mode 100644 index 000000000..a0ac9d758 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v1/src/main/java/com/google/cloud/foo/SomeMessage.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/foo/v1/bar.proto + +package com.google.cloud.foo.v1; + +/** + * + * + *
+ * Some sample class
+ * 
+ * + * Protobuf type {@code google.cloud.foo.v1.SomeMessage} + */ +public final class SomeMessage {} diff --git a/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/clirr-ignored-differences.xml b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/clirr-ignored-differences.xml new file mode 100644 index 000000000..70e35c153 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/clirr-ignored-differences.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/pom.xml b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/pom.xml new file mode 100644 index 000000000..57429eee6 --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-foo-v2 + 0.1.1-SNAPSHOT + proto-google-cloud-foo-v2 + Proto library for google-cloud-foo + + com.google.cloud + google-cloud-foo-parent + 0.1.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/src/main/java/com/google/cloud/foo/v2/SomeMessage.java b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/src/main/java/com/google/cloud/foo/v2/SomeMessage.java new file mode 100644 index 000000000..b69d8daed --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/proto-google-cloud-foo-v2/src/main/java/com/google/cloud/foo/v2/SomeMessage.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/foo/v1/bar.proto + +package com.google.cloud.foo.v1; + +/** + * + * + *
+ * Some sample class
+ * 
+ * + * Protobuf type {@code google.cloud.foo.v2.SomeMessage} + */ +public final class SomeMessage {} diff --git a/docker/owlbot/java/tests/fix-poms/input/versions.txt b/docker/owlbot/java/tests/fix-poms/input/versions.txt new file mode 100644 index 000000000..b0dbde2ec --- /dev/null +++ b/docker/owlbot/java/tests/fix-poms/input/versions.txt @@ -0,0 +1,7 @@ +# Format: +# module:released-version:current-version + +google-cloud-foo:0.0.0:0.1.1-SNAPSHOT +grpc-google-cloud-foo-v1:0.0.0:0.1.1-SNAPSHOT +proto-google-cloud-foo-v1:0.0.0:0.1.1-SNAPSHOT +proto-google-cloud-foo-v2:0.0.0:0.1.1-SNAPSHOT diff --git a/docker/owlbot/java/tests/new-client/golden/versions.txt b/docker/owlbot/java/tests/new-client/golden/versions.txt index 6bbf488e0..0f5d3f176 100644 --- a/docker/owlbot/java/tests/new-client/golden/versions.txt +++ b/docker/owlbot/java/tests/new-client/golden/versions.txt @@ -2,5 +2,5 @@ # module:released-version:current-version google-cloud-foo:0.0.0:0.0.1-SNAPSHOT -grpc-google-cloud-foo-v1:0.0.0:0.0.1-SNAPSHOT proto-google-cloud-foo-v1:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-foo-v1:0.0.0:0.0.1-SNAPSHOT diff --git a/docker/owlbot/java/tests/new-version/golden/versions.txt b/docker/owlbot/java/tests/new-version/golden/versions.txt index 3b87a4c4a..2f3088743 100644 --- a/docker/owlbot/java/tests/new-version/golden/versions.txt +++ b/docker/owlbot/java/tests/new-version/golden/versions.txt @@ -3,6 +3,6 @@ google-cloud-foo:0.0.0:0.1.1-SNAPSHOT grpc-google-cloud-foo-v1:0.0.0:0.1.1-SNAPSHOT -grpc-google-cloud-foo-v2:0.0.0:0.1.1-SNAPSHOT proto-google-cloud-foo-v1:0.0.0:0.1.1-SNAPSHOT proto-google-cloud-foo-v2:0.0.0:0.1.1-SNAPSHOT +grpc-google-cloud-foo-v2:0.0.0:0.1.1-SNAPSHOT