From b1f0e05df2e463944e116a133ec8bff699cddde5 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 18 Nov 2022 17:13:07 -0500 Subject: [PATCH 1/5] chore: Release with maven --- .kokoro/release/common.sh | 11 --- .kokoro/release/drop.cfg | 5 -- .kokoro/release/drop.sh | 19 ----- .kokoro/release/promote.cfg | 5 -- .kokoro/release/promote.sh | 31 --------- .kokoro/release/publish_javadoc.cfg | 19 ----- .kokoro/release/publish_javadoc.sh | 52 -------------- .kokoro/release/publish_javadoc11.cfg | 3 +- .kokoro/release/publish_javadoc11.sh | 32 +++++++-- .kokoro/release/publish_javadoc11_maven.cfg | 31 --------- .kokoro/release/publish_javadoc11_maven.sh | 77 --------------------- .kokoro/release/stage.cfg | 7 ++ .kokoro/release/stage.sh | 63 ++++++++++------- .kokoro/release/stage_gradle.cfg | 17 ----- .kokoro/release/stage_gradle.sh | 39 ----------- .kokoro/release/stage_maven.cfg | 17 ----- .kokoro/release/stage_maven.sh | 53 -------------- pom.xml | 23 ++++++ 18 files changed, 94 insertions(+), 410 deletions(-) delete mode 100644 .kokoro/release/drop.cfg delete mode 100755 .kokoro/release/drop.sh delete mode 100644 .kokoro/release/promote.cfg delete mode 100755 .kokoro/release/promote.sh delete mode 100644 .kokoro/release/publish_javadoc.cfg delete mode 100755 .kokoro/release/publish_javadoc.sh delete mode 100644 .kokoro/release/publish_javadoc11_maven.cfg delete mode 100755 .kokoro/release/publish_javadoc11_maven.sh delete mode 100644 .kokoro/release/stage_gradle.cfg delete mode 100755 .kokoro/release/stage_gradle.sh delete mode 100644 .kokoro/release/stage_maven.cfg delete mode 100755 .kokoro/release/stage_maven.sh diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh index a594cfb28..f3e5f166c 100755 --- a/.kokoro/release/common.sh +++ b/.kokoro/release/common.sh @@ -28,17 +28,6 @@ setup_environment_secrets() { export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') } -create_gradle_properties_file() { - echo " -signing.gnupg.executable=gpg -signing.gnupg.homeDir=${GPG_HOMEDIR} -signing.gnupg.keyName=${GPG_KEY_ID} -signing.gnupg.passphrase=${GPG_PASSPHRASE} - -ossrhUsername=${SONATYPE_USERNAME} -ossrhPassword=${SONATYPE_PASSWORD}" > $1 -} - create_settings_xml_file() { echo " diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg deleted file mode 100644 index 32f2ec33a..000000000 --- a/.kokoro/release/drop.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/drop.sh" -} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh deleted file mode 100755 index ce6ae7543..000000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 - -echo "This dropping a staged repo does not appear supported by the gradle-nexus-staging-plugin" -exit 1 diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg deleted file mode 100644 index e644fd395..000000000 --- a/.kokoro/release/promote.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/promote.sh" -} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh deleted file mode 100755 index 2dcfd256d..000000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 - -# STAGING_REPOSITORY_ID must be set -#if [ -z "${STAGING_REPOSITORY_ID}" ]; then -# echo "Missing STAGING_REPOSITORY_ID environment variable" -# exit 1 -#fi - -source $(dirname "$0")/common.sh -pushd $(dirname "$0")/../../ - -setup_environment_secrets -mkdir -p ${HOME}/.gradle -create_gradle_properties_file "${HOME}/.gradle/gradle.properties" - -./gradlew closeAndReleaseRepository diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg deleted file mode 100644 index 403ca6ad6..000000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "STAGING_BUCKET" - value: "docs-staging" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/publish_javadoc.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh deleted file mode 100755 index 08f6add6b..000000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -NAME=gax -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# build the docs -./gradlew javadocCombined - -pushd tmp_docs - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload docs -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET} - -popd diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg index 43a768b22..a37d777db 100644 --- a/.kokoro/release/publish_javadoc11.cfg +++ b/.kokoro/release/publish_javadoc11.cfg @@ -1,6 +1,7 @@ # Format: //devtools/kokoro/config/proto/build.proto -# cloud-rad production +# cloud-rad dev +# TODO: Update this or publish_javadoc11.sh to the prod bucket env_vars: { key: "STAGING_BUCKET_V2" value: "docs-staging-v2" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index 2a65a432f..52f152693 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. +# Copyright 2022 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,16 +33,34 @@ python3 -m pip install --require-hashes -r .kokoro/requirements.txt NAME=gax VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) +mvn -B -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -DskipTests=true \ + -Djacoco.skip=true \ + install + # build the docs -./gradlew javadocCombinedV3 +mvn -B -ntp \ + -P docFX \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + javadoc:aggregate # copy README to docfx-yml dir and rename index.md -cp README.md tmp_docs/docfx-yml/index.md +cp README.md target/docfx-yml/index.md # copy CHANGELOG to docfx-yml dir and rename history.md -cp CHANGELOG.md tmp_docs/docfx-yml/history.md +cp CHANGELOG.md target/docfx-yml/history.md -pushd tmp_docs/docfx-yml/ +pushd target/docfx-yml/ # create metadata python3 -m docuploader create-metadata \ @@ -50,10 +68,10 @@ python3 -m docuploader create-metadata \ --version ${VERSION} \ --language java -# upload docs +## upload docs python3 -m docuploader upload . \ --credentials ${CREDENTIALS} \ --staging-bucket ${STAGING_BUCKET_V2} \ --destination-prefix docfx -popd +popd \ No newline at end of file diff --git a/.kokoro/release/publish_javadoc11_maven.cfg b/.kokoro/release/publish_javadoc11_maven.cfg deleted file mode 100644 index a47de9772..000000000 --- a/.kokoro/release/publish_javadoc11_maven.cfg +++ /dev/null @@ -1,31 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# cloud-rad dev -# TODO: Update this or publish_javadoc11.sh to the prod bucket -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2-dev" -} - -# Configure the docker image for kokoro-trampoline -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/publish_javadoc11_maven.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11_maven.sh b/.kokoro/release/publish_javadoc11_maven.sh deleted file mode 100755 index 52f152693..000000000 --- a/.kokoro/release/publish_javadoc11_maven.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# Copyright 2022 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 - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -NAME=gax -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -mvn -B -ntp \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dcheckstyle.skip=true \ - -Dflatten.skip=true \ - -Danimal.sniffer.skip=true \ - -DskipTests=true \ - -Djacoco.skip=true \ - install - -# build the docs -mvn -B -ntp \ - -P docFX \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dcheckstyle.skip=true \ - -Dflatten.skip=true \ - -Danimal.sniffer.skip=true \ - javadoc:aggregate - -# copy README to docfx-yml dir and rename index.md -cp README.md target/docfx-yml/index.md - -# copy CHANGELOG to docfx-yml dir and rename history.md -cp CHANGELOG.md target/docfx-yml/history.md - -pushd target/docfx-yml/ - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -## upload docs -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx - -popd \ No newline at end of file diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg index ea8114821..b08c75908 100644 --- a/.kokoro/release/stage.cfg +++ b/.kokoro/release/stage.cfg @@ -4,6 +4,13 @@ env_vars: { value: "github/gax-java/.kokoro/release/stage.sh" } +action { + define_artifacts { + regex: "github/gax-java/target/nexus-staging/staging/*.properties" + strip_prefix: "github/gax-java" + } +} + env_vars: { key: "SECRET_MANAGER_KEYS" value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 2a93d85cd..93b5bb756 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. +# Copyright 2022 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,29 +13,40 @@ # See the License for the specific language governing permissions and # limitations under the License. -echo "Running `stage.sh`. Invoking stage_gradle and stage_maven" +set -eo pipefail -#set -eo pipefail -# -#if [[ -n "${AUTORELEASE_PR}" ]] -#then -# # Start the releasetool reporter -# requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) -# python3 -m pip install --require-hashes -r $requirementsFile -# python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -#fi -# -#source $(dirname "$0")/common.sh -#MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -#pushd $(dirname "$0")/../../ -# -#setup_environment_secrets -#mkdir -p ${HOME}/.gradle -#create_gradle_properties_file "${HOME}/.gradle/gradle.properties" -# -#if [[ -z "${AUTORELEASE_PR}" ]] -#then -# ./gradlew publishToSonatype -#else -# ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -#fi +if [[ -n "${AUTORELEASE_PR}" ]] +then + # Start the releasetool reporter + requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) + python3 -m pip install --require-hashes -r $requirementsFile + python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script +fi + +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" + +mvn clean deploy -B \ + -DskipTests=true \ + -Dclirr.skip=true \ + --settings ${MAVEN_SETTINGS_FILE} \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} \ + -P release + +# 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 + mvn nexus-staging:release -B \ + -P release-staging-repository \ + -DperformRelease=true \ + --settings=${MAVEN_SETTINGS_FILE} +else + echo "AUTORELEASE_PR is not set. Not releasing." +fi diff --git a/.kokoro/release/stage_gradle.cfg b/.kokoro/release/stage_gradle.cfg deleted file mode 100644 index b08c75908..000000000 --- a/.kokoro/release/stage_gradle.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/stage.sh" -} - -action { - define_artifacts { - regex: "github/gax-java/target/nexus-staging/staging/*.properties" - strip_prefix: "github/gax-java" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage_gradle.sh b/.kokoro/release/stage_gradle.sh deleted file mode 100755 index 221d8f346..000000000 --- a/.kokoro/release/stage_gradle.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# Copyright 2022 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 - -if [[ -n "${AUTORELEASE_PR}" ]] -then - # Start the releasetool reporter - requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) - python3 -m pip install --require-hashes -r $requirementsFile - python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -fi - -source $(dirname "$0")/common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -setup_environment_secrets -mkdir -p ${HOME}/.gradle -create_gradle_properties_file "${HOME}/.gradle/gradle.properties" - -if [[ -z "${AUTORELEASE_PR}" ]] -then - ./gradlew publishToSonatype -else - ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -fi diff --git a/.kokoro/release/stage_maven.cfg b/.kokoro/release/stage_maven.cfg deleted file mode 100644 index e7a8e8a0d..000000000 --- a/.kokoro/release/stage_maven.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gax-java/.kokoro/release/stage_maven.sh" -} - -action { - define_artifacts { - regex: "github/gax-java/target/nexus-staging/staging/*.properties" - strip_prefix: "github/gax-java" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage_maven.sh b/.kokoro/release/stage_maven.sh deleted file mode 100755 index 9bef3cd1a..000000000 --- a/.kokoro/release/stage_maven.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Copyright 2022 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 - -if [[ -n "${AUTORELEASE_PR}" ]] -then - # Start the releasetool reporter - requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) - python3 -m pip install --require-hashes -r $requirementsFile - python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script -fi - -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" - -mvn clean deploy -B \ - -DskipTests=true \ - -Dclirr.skip=true \ - --settings ${MAVEN_SETTINGS_FILE} \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} \ - -P release - -# TODO: The step below will release the artifact to maven central. Uncomment when ready - -## 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 -# mvn nexus-staging:release -B \ -# -DperformRelease=true \ -# --settings=${MAVEN_SETTINGS_FILE} -#else -# echo "AUTORELEASE_PR is not set. Not releasing." -#fi diff --git a/pom.xml b/pom.xml index f512ddd3d..fe40cde6e 100644 --- a/pom.xml +++ b/pom.xml @@ -248,4 +248,27 @@ + + + + + release-staging-repository + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + sonatype-nexus-staging + https://google.oss.sonatype.org/ + false + + + + + + \ No newline at end of file From c97af1b585ca9329b8cf87f15146e5d8c8857236 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 18 Nov 2022 17:15:44 -0500 Subject: [PATCH 2/5] chore: Update configs --- .kokoro/release/publish_javadoc11.cfg | 2 -- .kokoro/release/publish_javadoc11.sh | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg index a37d777db..4bfabf6d0 100644 --- a/.kokoro/release/publish_javadoc11.cfg +++ b/.kokoro/release/publish_javadoc11.cfg @@ -1,7 +1,5 @@ # Format: //devtools/kokoro/config/proto/build.proto -# cloud-rad dev -# TODO: Update this or publish_javadoc11.sh to the prod bucket env_vars: { key: "STAGING_BUCKET_V2" value: "docs-staging-v2" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index 52f152693..4776d3a6c 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -68,7 +68,7 @@ python3 -m docuploader create-metadata \ --version ${VERSION} \ --language java -## upload docs +# upload docs python3 -m docuploader upload . \ --credentials ${CREDENTIALS} \ --staging-bucket ${STAGING_BUCKET_V2} \ From fe47a669d72e0dd2718300d72940982fdc52a9f4 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 22 Nov 2022 14:03:15 -0500 Subject: [PATCH 3/5] chore: Remove maven_build.sh file --- .github/workflows/ci.yaml | 19 ----------- .kokoro/build.sh | 28 ++++++++++----- .kokoro/maven-build.sh | 72 --------------------------------------- 3 files changed, 19 insertions(+), 100 deletions(-) delete mode 100755 .kokoro/maven-build.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3a1465909..ac57c9933 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,25 +22,6 @@ jobs: - run: .kokoro/maven-build.sh env: JOB_TYPE: clirr - maven-units: - name: "maven unit tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: zulu - - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - uses: actions/setup-java@v3 - with: - java-version: 11 - distribution: zulu - - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - run: printenv - - run: .kokoro/maven-build.sh - env: - JOB_TYPE: test units-java11: name: "units (11)" runs-on: ubuntu-latest diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 9c25171ab..2c673e5f8 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2022 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,16 +37,13 @@ fi echo "Compiling using Java:" java -version echo -./gradlew compileJava compileTestJava javadoc +mvn -V -B -ntp clean install -DskipTests -Dclirr.skip=true -Denforcer.skip=true # We ensure the generated class files are compatible with Java 8 if [ ! -z "${JAVA8_HOME}" ]; then setJava "${JAVA8_HOME}" fi -echo "Running tests using Java:" -java -version - if [ "${GITHUB_JOB}" == "units-java8" ]; then java -version 2>&1 | grep -q 'openjdk version "1.8.' MATCH=$? # 0 if the output has the match @@ -56,7 +53,20 @@ if [ "${GITHUB_JOB}" == "units-java8" ]; then fi fi -echo -./gradlew build publishToMavenLocal \ - --exclude-task compileJava --exclude-task compileTestJava \ - --exclude-task javadoc +RETURN_CODE=0 + +case "${JOB_TYPE}" in +test) + # run tests in Java 8 with the source compiled in Java 11 + mvn -V -B -ntp surefire:test -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +clirr) + mvn -B -ntp -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) ;; +esac + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} \ No newline at end of file diff --git a/.kokoro/maven-build.sh b/.kokoro/maven-build.sh deleted file mode 100755 index f8a1511ef..000000000 --- a/.kokoro/maven-build.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/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 - -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -# cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -echo $JOB_TYPE - -function setJava() { - export JAVA_HOME=$1 - export PATH=${JAVA_HOME}/bin:$PATH -} - -# This project requires compiling the classes in JDK 11 or higher for GraalVM -# classes. Compiling this project with Java 8 or earlier would fail with "class -# file has wrong version 55.0, should be 53.0" and "unrecognized --release 8 -# option" (set in build.gradle). -if [ ! -z "${JAVA11_HOME}" ]; then - setJava "${JAVA11_HOME}" -fi - -echo "Compiling using Java:" -java -version -echo -mvn -V -B -ntp clean install -DskipTests -Dclirr.skip=true -Denforcer.skip=true - -# We ensure the generated class files are compatible with Java 8 -if [ ! -z "${JAVA8_HOME}" ]; then - setJava "${JAVA8_HOME}" -fi - -if [ "${GITHUB_JOB}" == "units-java8" ]; then - java -version 2>&1 | grep -q 'openjdk version "1.8.' - MATCH=$? # 0 if the output has the match - if [ "$MATCH" != "0" ]; then - echo "Please specify JDK 8 for Java 8 tests" - exit 1 - fi -fi - -RETURN_CODE=0 - -case "${JOB_TYPE}" in -test) - # run tests in Java 8 with the source compiled in Java 11 - mvn -V -B -ntp surefire:test -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; -clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check - RETURN_CODE=$? - ;; -*) ;; -esac - -echo "exiting with ${RETURN_CODE}" -exit ${RETURN_CODE} \ No newline at end of file From 7910ec786ea1da4bfd825c6193a6cd86d94c0640 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Tue, 29 Nov 2022 13:05:28 -0500 Subject: [PATCH 4/5] chore: Prepare maven release --- .github/workflows/ci.yaml | 2 +- .kokoro/build.sh | 16 ++-------------- .kokoro/release/common.sh | 2 +- .kokoro/release/publish_javadoc11.sh | 3 +-- .kokoro/release/stage.sh | 2 +- license-checks.xml | 2 +- 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac57c9933..b05c1da3d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: distribution: temurin java-version: 11 - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV - - run: .kokoro/maven-build.sh + - run: .kokoro/build.sh env: JOB_TYPE: clirr units-java11: diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 2c673e5f8..d38a61c5e 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2022 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,25 +34,13 @@ if [ ! -z "${JAVA11_HOME}" ]; then setJava "${JAVA11_HOME}" fi -echo "Compiling using Java:" -java -version -echo -mvn -V -B -ntp clean install -DskipTests -Dclirr.skip=true -Denforcer.skip=true +mvn -V -B -ntp clean install -DskipTests # We ensure the generated class files are compatible with Java 8 if [ ! -z "${JAVA8_HOME}" ]; then setJava "${JAVA8_HOME}" fi -if [ "${GITHUB_JOB}" == "units-java8" ]; then - java -version 2>&1 | grep -q 'openjdk version "1.8.' - MATCH=$? # 0 if the output has the match - if [ "$MATCH" != "0" ]; then - echo "Please specify JDK 8 for Java 8 tests" - exit 1 - fi -fi - RETURN_CODE=0 case "${JOB_TYPE}" in diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh index f3e5f166c..693bae8bf 100755 --- a/.kokoro/release/common.sh +++ b/.kokoro/release/common.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index 4776d3a6c..2a6fb8291 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Copyright 2022 Google Inc. -# +# Copyright 2019 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 diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 93b5bb756..5ff691d31 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2022 Google Inc. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/license-checks.xml b/license-checks.xml index 574f1d42f..362833222 100644 --- a/license-checks.xml +++ b/license-checks.xml @@ -5,6 +5,6 @@ - + \ No newline at end of file From 6e5dd1830e15842f9fbee84ce97050bd375e67b6 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Wed, 30 Nov 2022 15:15:09 -0500 Subject: [PATCH 5/5] chore: Clean up build file --- .kokoro/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index d38a61c5e..a9e909f0d 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -46,11 +46,11 @@ RETURN_CODE=0 case "${JOB_TYPE}" in test) # run tests in Java 8 with the source compiled in Java 11 - mvn -V -B -ntp surefire:test -Dclirr.skip=true -Denforcer.skip=true + mvn -V -B -ntp surefire:test RETURN_CODE=$? ;; clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check + mvn -B -ntp clirr:check RETURN_CODE=$? ;; *) ;;