Skip to content

Commit

Permalink
chore: use sdk-platform-java-config in downstream checks for spanner …
Browse files Browse the repository at this point in the history
…and pubsub; update junit-vintage to 5.10.2 (#746)

* chore: use sdk-platform-java-config in downstream checks for spanner and pubsub
  • Loading branch information
mpeddada1 committed Feb 13, 2024
1 parent 28b2c77 commit 2b6e931
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 13 deletions.
83 changes: 72 additions & 11 deletions .kokoro/client-library-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,55 @@ set -eo pipefail
# Display commands being run.
set -x
function get_current_version_from_versions_txt() {
versions=$1
key=$2
version=$(grep "$key:" "${versions}" | cut -d: -f3) # 3rd field is current
echo "${version}"
}
function get_released_version_from_versions_txt() {
versions=$1
key=$2
version=$(grep "$key:" "${versions}" | cut -d: -f2) # 2nd field is release
echo "${version}"
}
function replace_java_shared_config_version() {
version=$1
# replace version
xmllint --shell <(cat pom.xml) << EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:artifactId[text()="google-cloud-shared-config"]
cd ../x:version
set ${version}
save pom.xml
EOF
}
function replace_java_shared_dependencies_version() {
version=$1
# replace version
xmllint --shell <(cat pom.xml) << EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:properties/x:google-cloud-shared-dependencies.version
set ${version}
save pom.xml
EOF
}
function replace_sdk_platform_java_config_version() {
version=$1
# replace version
xmllint --shell <(cat pom.xml) << EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:artifactId[text()="sdk-platform-java-config"]
cd ../x:version
set ${version}
save pom.xml
EOF
}
if [[ $# -ne 2 ]];
then
echo "Usage: $0 <repo-name> <job-type>"
Expand All @@ -42,13 +91,26 @@ mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=tr
# Read the current version of this BOM in the POM. Example version: '0.116.1-alpha-SNAPSHOT'
VERSION_POM=java-shared-config/pom.xml
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
VERSION=`sed -e 's/xmlns=".*"//' ${VERSION_POM} | xmllint --xpath '/project/version/text()' -`
JAVA_SHARED_CONFIG_VERSION=`sed -e 's/xmlns=".*"//' ${VERSION_POM} | xmllint --xpath '/project/version/text()' -`
if [ -z "${VERSION}" ]; then
if [ -z "${JAVA_SHARED_CONFIG_VERSION}" ]; then
echo "Version is not found in ${VERSION_POM}"
exit 1
fi
echo "Version: ${VERSION}"
echo "Version: ${JAVA_SHARED_CONFIG_VERSION}"
# Update java-shared-config in sdk-platform-java-config
git clone "https://github.com/googleapis/sdk-platform-java.git" --depth=1
pushd sdk-platform-java
SDK_PLATFORM_JAVA_CONFIG_VERSION=$(get_current_version_from_versions_txt versions.txt "google-cloud-shared-dependencies")
RELEASED_SHARED_DEPENDENCIES_VERSION=$(get_released_version_from_versions_txt versions.txt "google-cloud-shared-dependencies")
pushd sdk-platform-java-config

# Use released version of google-cloud-shared-dependencies to avoid verifying SNAPSHOT changes.
replace_java_shared_config_version "${JAVA_SHARED_CONFIG_VERSION}"
replace_java_shared_dependencies_version "${RELEASED_SHARED_DEPENDENCIES_VERSION}"
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V -q
popd

# Check this BOM against a few java client libraries
# java-bigquery
Expand All @@ -60,14 +122,13 @@ fi

pushd ${REPO}

# replace version
xmllint --shell <(cat pom.xml) << EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:artifactId[text()="google-cloud-shared-config"]
cd ../x:version
set ${VERSION}
save pom.xml
EOF
# TODO(#748): Replace the version of sdk-platform-java-config for all libraries. This logic will no longer
# be needed after the rest of the handwritten libraries are migrated to use this artifact.
if [ "$REPO" == "java-spanner" ] || [ "$REPO" == "java-pubsub" ]; then
replace_sdk_platform_java_config_version "${SDK_PLATFORM_JAVA_CONFIG_VERSION}"
else
replace_java_shared_config_version "${JAVA_SHARED_CONFIG_VERSION}"
fi

case ${JOB_TYPE} in
dependencies)
Expand Down
4 changes: 2 additions & 2 deletions native-image-shared-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.9.3</version>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -185,7 +185,7 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.9.3</version>
<version>5.10.2</version>
</dependency>
</dependencies>
<configuration>
Expand Down

0 comments on commit 2b6e931

Please sign in to comment.