Skip to content

Commit

Permalink
ci: use java-shared-dependencies in google-cloud-java repository for …
Browse files Browse the repository at this point in the history
…downstream test (#1291)

* ci: use java-shared-dependencies in google-cloud-java

* No need to modify google-cloud-jar-parent
  • Loading branch information
suztomo authored Feb 1, 2023
1 parent 734381d commit dc3233f
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions .kokoro/presubmit/downstream-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ GAPIC_BOM_VERSION=$(sed -e 's/xmlns=".*"//' gapic-generator-java-bom/pom.xml | x

### Round 2
# Run the updated GAPIC BOM against HEAD of java-shared-dependencies
git clone "https://github.com/googleapis/java-shared-dependencies.git" --depth=1
pushd java-shared-dependencies/first-party-dependencies
git clone "https://github.com/googleapis/google-cloud-java.git" --depth=1
pushd google-cloud-java/java-shared-dependencies/first-party-dependencies

# Replace GAPIC BOM version
xmllint --shell pom.xml <<EOF
Expand All @@ -55,41 +55,36 @@ echo "Modifications to java-shared-dependencies:"
git diff
echo

cd ..
mvn verify install -B -V -ntp -fae \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dgcloud.download.skip=true \
-Denforcer.skip=true

# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
SHARED_DEPS_VERSION=$(sed -e 's/xmlns=".*"//' pom.xml | xmllint --xpath '/project/version/text()' -)

if [ -z "${SHARED_DEPS_VERSION}" ]; then
echo "Shared dependencies version is not found in pom.xml"
exit 1
fi

popd
pushd google-cloud-java
mvn -B -V -ntp install --also-make --projects \
java-shared-dependencies,java-shared-dependencies/first-party-dependencies,java-shared-dependencies/third-party-dependencies \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dgcloud.download.skip=true \
-Denforcer.skip=true

### Round 3
# Run the updated java-shared-dependencies BOM against google-cloud-java
git clone "https://github.com/googleapis/google-cloud-java.git" --depth=1
pushd google-cloud-java/google-cloud-jar-parent

# Replace java-shared-dependencies version
xmllint --shell pom.xml <<EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:artifactId[text()="google-cloud-shared-dependencies"]
cd ../x:version
set ${SHARED_DEPS_VERSION}
save pom.xml
EOF
# Install google-cloud-core-bom (part of java-shared-dependencies)
echo "Installing java-core"
mvn -B -V -ntp install -DskipTests --also-make -f java-core \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dgcloud.download.skip=true \
-Denforcer.skip=true
popd

echo "Modifications to google-cloud-java:"
git diff
echo
### Round 4
# Run the updated java-shared-dependencies BOM against google-cloud-java
pushd google-cloud-java

cd ..
source ./.kokoro/common.sh
RETURN_CODE=0
setup_application_credentials
Expand Down

0 comments on commit dc3233f

Please sign in to comment.