diff --git a/.github/workflows/generated_files_sync.yaml b/.github/workflows/generated_files_sync.yaml index 729702b5dc34..189e76e02841 100644 --- a/.github/workflows/generated_files_sync.yaml +++ b/.github/workflows/generated_files_sync.yaml @@ -116,3 +116,31 @@ jobs: architecture: 'x64' - run: python3 -m pip install --require-hashes -r .github/requirements.txt - run: python3 generate-readme.py + + group_id_check_for_maps_libraries: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Maps modules + run: | + IncludedNonCloudModules=$(find java-maps-* -name 'pom.xml' \ + |sed -e 's|/pom.xml$||' |xargs |sed -e 's/ /,/g') + echo "Included modules: ${IncludedNonCloudModules}" + mvn -B -V -ntp install --also-make --projects "${IncludedNonCloudModules}" \ + -DskipTests + + - name: Ensure Maps libraries have com.google.maps group IDs + run: | + for POM in $(find java-maps-* -name 'pom.xml'); do + group_id=$(mvn -q exec:exec -Dexec.executable=echo -Dexec.args='${project.groupId}' \ + --projects $POM 2>/dev/null ) + echo "${group_id}" |grep -q com.google.maps + # 0 if match; otherwise 1 + match=$? + if [ "${match}" == "1" ]; then + echo "Unexpected group ID '${group_id}' found in ${POM}" + exit 1 + fi + echo "Passed ${POM}" + done + echo "All group IDs start with com.google.maps. Good." \ No newline at end of file diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg index 568208675cec..8018146a0d0a 100644 --- a/.kokoro/release/stage.cfg +++ b/.kokoro/release/stage.cfg @@ -5,7 +5,7 @@ timeout_mins: 300 env_vars: { key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-cloud-java/.kokoro/release/stage.sh" + value: "github/google-cloud-java/.kokoro/release/stage_google_oss_sonatype_org.sh" } # Need to save the properties file diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage_google_oss_sonatype_org.sh similarity index 81% rename from .kokoro/release/stage.sh rename to .kokoro/release/stage_google_oss_sonatype_org.sh index 217f53df2899..efcd03681374 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage_google_oss_sonatype_org.sh @@ -27,11 +27,14 @@ pushd $(dirname "$0")/../../ setup_environment_secrets create_settings_xml_file "settings.xml" -echo "Deploying artifacts to staging repositories" +echo "Deploying artifacts to staging repositories in google.oss.sonatype.org" -excludedMapsModule=$(find java-maps-* -name 'pom.xml' \ +# Excluding modules that cannot be published to the google.oss.sonatype.org +# publishing host. +# https://github.com/googleapis/google-cloud-java/issues/9045 +excludedNonCloudModules=$(find java-maps-* -name 'pom.xml' \ |sed -e 's/^/!/' -e 's|/pom.xml$||' |xargs |sed -e 's/ /,/g') -echo "Excluded modules: ${excludedMapsModule}" +echo "Excluded modules: ${excludedNonCloudModules}" mvn clean deploy -B \ -DskipTests=true \ @@ -40,7 +43,7 @@ mvn clean deploy -B \ -Dgpg.executable=gpg \ -Dgpg.passphrase=${GPG_PASSPHRASE} \ -Dgpg.homedir=${GPG_HOMEDIR} \ - --projects "${excludedMapsModule}" \ + --projects "${excludedNonCloudModules}" \ -P release # The job triggered by Release Please (release-trigger) has this AUTORELEASE_PR diff --git a/.kokoro/release/stage_oss_sonatype_org.cfg b/.kokoro/release/stage_oss_sonatype_org.cfg new file mode 100644 index 000000000000..22997e0f4723 --- /dev/null +++ b/.kokoro/release/stage_oss_sonatype_org.cfg @@ -0,0 +1,22 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Set a longer timeout for releases instead of the default (180) +timeout_mins: 300 + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/release/stage_oss_sonatype_org.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/google-cloud-java/target/nexus-staging/staging/*.properties" + strip_prefix: "github/google-cloud-java" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} \ No newline at end of file diff --git a/.kokoro/release/stage_oss_sonatype_org.sh b/.kokoro/release/stage_oss_sonatype_org.sh new file mode 100755 index 000000000000..1c3251c3bb08 --- /dev/null +++ b/.kokoro/release/stage_oss_sonatype_org.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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 +# +# http://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. + +set -eo pipefail + +# This stage_oss_sonatype_org.sh publishes the artifacts to oss.sonatype.org publishing +# host, not google.oss.sonatype.org. A group ID of Maven artifact can belong to +# one publishing host. As of February 2023, com.google.maps group +# ID is not part of the google.oss.sonatype.org publishing host. In future when +# we move com.google.maps (and others) to the +# google.oss.sonatype.org publishing host, we can stop this job separated. + +# Start the releasetool reporter +requirementsFile=$(realpath $(dirname "$0")/../../)/.kokoro/requirements.txt +python3 -m pip install --require-hashes -r $requirementsFile +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +echo "Deploying non-Cloud artifacts to staging repositories in oss.sonatype.org" + +# Lists modules for Google Maps artifacts, including their submodules. +IncludedNonCloudModules=$(find java-maps-* -name 'pom.xml' \ + |sed -e 's|/pom.xml$||' |xargs |sed -e 's/ /,/g') +echo "Included modules: ${IncludedNonCloudModules}" + +mvn clean deploy -B \ + -DskipTests=true \ + -Dclirr.skip=true \ + --settings ${MAVEN_SETTINGS_FILE} \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} \ + --projects "${IncludedNonCloudModules}" \ + -P release \ + -DserverId=nexus \ + -DnexusUrl=https://oss.sonatype.org/ + + +# The job triggered by Release Please (release-trigger) has this AUTORELEASE_PR +# environment variable. Fusion also lets us to specify this variable. +if [[ -n "${AUTORELEASE_PR}" ]] +then + echo "Releasing the staging repositories" + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=${MAVEN_SETTINGS_FILE} \ + -DserverId=nexus \ + -DnexusUrl=https://oss.sonatype.org/ +else + echo "AUTORELEASE_PR is not set. Not releasing." +fi + + diff --git a/java-maps-addressvalidation/google-maps-addressvalidation-bom/pom.xml b/java-maps-addressvalidation/google-maps-addressvalidation-bom/pom.xml index e8138947bfb7..759693437dbb 100644 --- a/java-maps-addressvalidation/google-maps-addressvalidation-bom/pom.xml +++ b/java-maps-addressvalidation/google-maps-addressvalidation-bom/pom.xml @@ -30,12 +30,12 @@ 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-addressvalidation-v1 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-addressvalidation-v1 0.6.0-SNAPSHOT diff --git a/java-maps-addressvalidation/google-maps-addressvalidation/pom.xml b/java-maps-addressvalidation/google-maps-addressvalidation/pom.xml index fa806106eae5..22d627f04a39 100644 --- a/java-maps-addressvalidation/google-maps-addressvalidation/pom.xml +++ b/java-maps-addressvalidation/google-maps-addressvalidation/pom.xml @@ -42,7 +42,7 @@ - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-addressvalidation-v1 @@ -86,7 +86,7 @@ - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-addressvalidation-v1 test diff --git a/java-maps-addressvalidation/grpc-google-maps-addressvalidation-v1/pom.xml b/java-maps-addressvalidation/grpc-google-maps-addressvalidation-v1/pom.xml index 6745f4b6fa63..73f9cdf81ab4 100644 --- a/java-maps-addressvalidation/grpc-google-maps-addressvalidation-v1/pom.xml +++ b/java-maps-addressvalidation/grpc-google-maps-addressvalidation-v1/pom.xml @@ -2,7 +2,7 @@ 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"> 4.0.0 - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-addressvalidation-v1 0.6.0-SNAPSHOT grpc-google-maps-addressvalidation-v1 @@ -34,7 +34,7 @@ proto-google-common-protos - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-addressvalidation-v1 @@ -42,4 +42,4 @@ guava - \ No newline at end of file + diff --git a/java-maps-addressvalidation/pom.xml b/java-maps-addressvalidation/pom.xml index b9f009ee3337..bab5820bc40a 100644 --- a/java-maps-addressvalidation/pom.xml +++ b/java-maps-addressvalidation/pom.xml @@ -32,12 +32,12 @@ 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-addressvalidation-v1 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-addressvalidation-v1 0.6.0-SNAPSHOT diff --git a/java-maps-addressvalidation/proto-google-maps-addressvalidation-v1/pom.xml b/java-maps-addressvalidation/proto-google-maps-addressvalidation-v1/pom.xml index 8fc8799a15b2..16ebb1c6d156 100644 --- a/java-maps-addressvalidation/proto-google-maps-addressvalidation-v1/pom.xml +++ b/java-maps-addressvalidation/proto-google-maps-addressvalidation-v1/pom.xml @@ -2,7 +2,7 @@ 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"> 4.0.0 - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-addressvalidation-v1 0.6.0-SNAPSHOT proto-google-maps-addressvalidation-v1 diff --git a/java-maps-routing/google-maps-routing-bom/pom.xml b/java-maps-routing/google-maps-routing-bom/pom.xml index 93678c817662..0e9008a1a62b 100644 --- a/java-maps-routing/google-maps-routing-bom/pom.xml +++ b/java-maps-routing/google-maps-routing-bom/pom.xml @@ -30,12 +30,12 @@ 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-routing-v2 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-routing-v2 0.6.0-SNAPSHOT diff --git a/java-maps-routing/google-maps-routing/pom.xml b/java-maps-routing/google-maps-routing/pom.xml index 024a385a7c54..2379682f5e7c 100644 --- a/java-maps-routing/google-maps-routing/pom.xml +++ b/java-maps-routing/google-maps-routing/pom.xml @@ -42,7 +42,7 @@ - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-routing-v2 @@ -86,7 +86,7 @@ - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-routing-v2 test diff --git a/java-maps-routing/grpc-google-maps-routing-v2/pom.xml b/java-maps-routing/grpc-google-maps-routing-v2/pom.xml index ed42fa7a3b4d..4bc896ec0ac8 100644 --- a/java-maps-routing/grpc-google-maps-routing-v2/pom.xml +++ b/java-maps-routing/grpc-google-maps-routing-v2/pom.xml @@ -2,7 +2,7 @@ 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"> 4.0.0 - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-routing-v2 0.6.0-SNAPSHOT grpc-google-maps-routing-v2 @@ -34,7 +34,7 @@ proto-google-common-protos - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-routing-v2 @@ -42,4 +42,4 @@ guava - \ No newline at end of file + diff --git a/java-maps-routing/pom.xml b/java-maps-routing/pom.xml index cd177aab7bce..841aac083c5f 100644 --- a/java-maps-routing/pom.xml +++ b/java-maps-routing/pom.xml @@ -32,12 +32,12 @@ 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc grpc-google-maps-routing-v2 0.6.0-SNAPSHOT - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-routing-v2 0.6.0-SNAPSHOT diff --git a/java-maps-routing/proto-google-maps-routing-v2/pom.xml b/java-maps-routing/proto-google-maps-routing-v2/pom.xml index e13a6d8a2607..deba389216c3 100644 --- a/java-maps-routing/proto-google-maps-routing-v2/pom.xml +++ b/java-maps-routing/proto-google-maps-routing-v2/pom.xml @@ -2,7 +2,7 @@ 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"> 4.0.0 - com.google.api.grpc + com.google.maps.api.grpc proto-google-maps-routing-v2 0.6.0-SNAPSHOT proto-google-maps-routing-v2