@@ -27,83 +27,83 @@ source ${scriptDir}/common.sh
2727mvn -version
2828echo ${JOB_TYPE}
2929
30- # Store the current Java version since the version may change when installing sdk-platform-java
31- current_java_home=$JAVA_HOME
32-
33- # testing-infra-docker has Java 11 installed in java8 docker container. Use this as sdk-platform-java
34- # needs Java 11+ to run with GraalVM. For GH actions, JAVA11_HOME does not exist and would skip this.
35- if [ ! -z " ${JAVA11_HOME} " ]; then
36- export JAVA_HOME=" ${JAVA11_HOME} "
37- export PATH=${JAVA_HOME} /bin:$PATH
38- fi
39-
40- # Get the current proto runtime version used in this repo
41- CURRENT_PROTO_VERSION=$( mvn -ntp help:effective-pom |
42- sed -n " /<artifactId>protobuf-java<\/artifactId>/,/<\/dependency>/ {
43- /<version>/{
44- s/<version>\(.*\)<\/version>/\1/p
45- q
46- }
47- }" | sed -e ' s/^[[:space:]]*//' -e ' s/[[:space:]]*$//' )
48- echo " The current proto version is: ${CURRENT_PROTO_VERSION} "
49-
50- # Find the latest proto runtime version available
51- LATEST_PROTO_VERSION=$( curl -s https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/maven-metadata.xml | sed -n ' /<release>/s/.*<release>\(.*\)<\/release>.*/\1/p' )
52- echo " The latest proto version is: ${LATEST_PROTO_VERSION} "
53-
54- # Only reinstall shared-deps again to test for a newer proto version
55- if [[ " ${CURRENT_PROTO_VERSION} " != " ${LATEST_PROTO_VERSION} " ]]; then
56- pushd /tmp
57- git clone https://github.com/googleapis/sdk-platform-java.git
58- pushd sdk-platform-java
59- pushd gapic-generator-java-pom-parent
60- sed -i " /<protobuf.version>.*<\/protobuf.version>/s/\(.*<protobuf.version>\).*\(<\/protobuf.version>\)/\1${LATEST_PROTO_VERSION} \2/" pom.xml
61- # sdk-platform-java
62- popd
63-
64- pushd sdk-platform-java-config
65- # Get current Shared-Deps version in sdk-platform-java
66- SHARED_DEPS_VERSION=$( mvn -ntp help:effective-pom |
67- sed -n " /<artifactId>sdk-platform-java-config<\/artifactId>/,/<\/dependency>/ {
68- /<version>/{
69- s/<version>\(.*\)<\/version>/\1/p
70- q
71- }
72- }" | sed -e ' s/^[[:space:]]*//' -e ' s/[[:space:]]*$//' )
73- echo " Shared-Deps Version: ${SHARED_DEPS_VERSION} "
74- # sdk-platform-java
75- popd
76- mvn clean install -q -ntp \
77- -DskipTests=true \
78- -Dclirr.skip=true \
79- -Denforcer.skip=true \
80- -T 1C
81- # /tmp
82- popd
83-
84- # Back to the original directory of the repo
85- popd
86- # Find all the poms with a reference to shared-deps and update to the new local version
87- poms=($( find . -name pom.xml) )
88- for pom in " ${poms[@]} " ; do
89- if grep -q " sdk-platform-java-config" " ${pom} " ; then
90- echo " Updating the pom: ${pom} to use shared-deps version: ${SHARED_DEPS_VERSION} "
91- sed -i " /<artifactId>sdk-platform-java-config<\/artifactId>/,/<\/parent>/ s/<version>.*<\/version>/<version>$SHARED_DEPS_VERSION <\/version>/" " ${pom} "
92- cat " ${pom} "
93- # xmlstarlet ed --inplace -N x="http://maven.apache.org/POM/4.0.0" \
94- # -u "//x:project/x:parent[x:artifactId='sdk-platform-java-config']/x:version" \
95- # -v "${SHARED_DEPS_VERSION}" \
96- # "${pom}"
97- fi
98- done
99-
100- # Print out the dependency tree for all module to ensure latest protobuf was installed
101- mvn dependency:tree
102- fi
103-
104- # Reset back to the original Java version if changed
105- export JAVA_HOME=" ${current_java_home} "
106- export PATH=${JAVA_HOME} /bin:$PATH
30+ # # Store the current Java version since the version may change when installing sdk-platform-java
31+ # current_java_home=$JAVA_HOME
32+ #
33+ # # testing-infra-docker has Java 11 installed in java8 docker container. Use this as sdk-platform-java
34+ # # needs Java 11+ to run with GraalVM. For GH actions, JAVA11_HOME does not exist and would skip this.
35+ # if [ ! -z "${JAVA11_HOME}" ]; then
36+ # export JAVA_HOME="${JAVA11_HOME}"
37+ # export PATH=${JAVA_HOME}/bin:$PATH
38+ # fi
39+ #
40+ # # Get the current proto runtime version used in this repo
41+ # CURRENT_PROTO_VERSION=$(mvn -ntp help:effective-pom |
42+ # sed -n "/<artifactId>protobuf-java<\/artifactId>/,/<\/dependency>/ {
43+ # /<version>/{
44+ # s/<version>\(.*\)<\/version>/\1/p
45+ # q
46+ # }
47+ # }" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
48+ # echo "The current proto version is: ${CURRENT_PROTO_VERSION}"
49+ #
50+ # # Find the latest proto runtime version available
51+ # LATEST_PROTO_VERSION=$(curl -s https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/maven-metadata.xml | sed -n '/<release>/s/.*<release>\(.*\)<\/release>.*/\1/p')
52+ # echo "The latest proto version is: ${LATEST_PROTO_VERSION}"
53+ #
54+ # # Only reinstall shared-deps again to test for a newer proto version
55+ # if [[ "${CURRENT_PROTO_VERSION}" != "${LATEST_PROTO_VERSION}" ]]; then
56+ # pushd /tmp
57+ # git clone https://github.com/googleapis/sdk-platform-java.git
58+ # pushd sdk-platform-java
59+ # pushd gapic-generator-java-pom-parent
60+ # sed -i "/<protobuf.version>.*<\/protobuf.version>/s/\(.*<protobuf.version>\).*\(<\/protobuf.version>\)/\1${LATEST_PROTO_VERSION}\2/" pom.xml
61+ # # sdk-platform-java
62+ # popd
63+ #
64+ # pushd sdk-platform-java-config
65+ # # Get current Shared-Deps version in sdk-platform-java
66+ # SHARED_DEPS_VERSION=$(mvn -ntp help:effective-pom |
67+ # sed -n "/<artifactId>sdk-platform-java-config<\/artifactId>/,/<\/dependency>/ {
68+ # /<version>/{
69+ # s/<version>\(.*\)<\/version>/\1/p
70+ # q
71+ # }
72+ # }" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
73+ # echo "Shared-Deps Version: ${SHARED_DEPS_VERSION}"
74+ # # sdk-platform-java
75+ # popd
76+ # mvn clean install -q -ntp \
77+ # -DskipTests=true \
78+ # -Dclirr.skip=true \
79+ # -Denforcer.skip=true \
80+ # -T 1C
81+ # # /tmp
82+ # popd
83+ #
84+ # # Back to the original directory of the repo
85+ # popd
86+ # # Find all the poms with a reference to shared-deps and update to the new local version
87+ # poms=($(find . -name pom.xml))
88+ # for pom in "${poms[@]}"; do
89+ # if grep -q "sdk-platform-java-config" "${pom}"; then
90+ # echo "Updating the pom: ${pom} to use shared-deps version: ${SHARED_DEPS_VERSION}"
91+ # sed -i "/<artifactId>sdk-platform-java-config<\/artifactId>/,/<\/parent>/ s/<version>.*<\/version>/<version>$SHARED_DEPS_VERSION<\/version>/" "${pom}"
92+ # cat "${pom}"
93+ # # xmlstarlet ed --inplace -N x="http://maven.apache.org/POM/4.0.0" \
94+ # # -u "//x:project/x:parent[x:artifactId='sdk-platform-java-config']/x:version" \
95+ # # -v "${SHARED_DEPS_VERSION}" \
96+ # # "${pom}"
97+ # fi
98+ # done
99+ #
100+ # # Print out the dependency tree for all module to ensure latest protobuf was installed
101+ # mvn dependency:tree
102+ # fi
103+ #
104+ # # Reset back to the original Java version if changed
105+ # export JAVA_HOME="${current_java_home}"
106+ # export PATH=${JAVA_HOME}/bin:$PATH
107107
108108# attempt to install 3 times with exponential backoff (starting with 10 seconds)
109109retry_with_backoff 3 10 \
0 commit comments