Skip to content

Commit a4f00c6

Browse files
committed
fix: update downstream client library checks for monorepo layout
1 parent 5bcf625 commit a4f00c6

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

.kokoro/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ case ${JOB_TYPE} in
212212

213213
MODULE_FILTER=""
214214

215-
if [ -n "${BASE_SHA}" ] && [ -n "${HEAD_SHA}" ]; then
215+
if [ -n "${BUILD_SUBDIR}" ] && ( [ -z "${BASE_SHA}" ] || [ -z "${HEAD_SHA}" ] ); then
216+
echo "BASE_SHA or HEAD_SHA is empty, but BUILD_SUBDIR is set. Running full lint check on ${BUILD_SUBDIR}."
217+
MODULE_FILTER=""
218+
elif [ -n "${BASE_SHA}" ] && [ -n "${HEAD_SHA}" ]; then
216219
# Optimize the build by identifying ONLY the Maven modules that contain changed Java source files.
217220
# Format those specific modules instead of the entire codebase, reducing format check time.
218221
# The --relative flag is when building in the submodule as only files modified in the module

.kokoro/client-library-check-doclet.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ EOF
6060

6161
function replace_sdk_platform_java_config_version() {
6262
version=$1
63-
# replace version
64-
xmllint --shell <(cat pom.xml) << EOF
63+
# replace version in the shared parent POM
64+
xmllint --shell <(cat ../google-cloud-pom-parent/pom.xml) << EOF
6565
setns x=http://maven.apache.org/POM/4.0.0
6666
cd .//x:artifactId[text()="sdk-platform-java-config"]
6767
cd ../x:version
6868
set ${version}
69-
save pom.xml
69+
save ../google-cloud-pom-parent/pom.xml
7070
EOF
7171
}
7272
REPO=$1

.kokoro/client-library-check.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ EOF
6060

6161
function replace_sdk_platform_java_config_version() {
6262
version=$1
63-
# replace version
64-
xmllint --shell <(cat pom.xml) << EOF
63+
# replace version in the shared parent POM
64+
xmllint --shell <(cat ../google-cloud-pom-parent/pom.xml) << EOF
6565
setns x=http://maven.apache.org/POM/4.0.0
6666
cd .//x:artifactId[text()="sdk-platform-java-config"]
6767
cd ../x:version
6868
set ${version}
69-
save pom.xml
69+
save ../google-cloud-pom-parent/pom.xml
7070
EOF
7171
}
7272

@@ -132,16 +132,18 @@ else
132132
replace_sdk_platform_java_config_version "${SDK_PLATFORM_JAVA_CONFIG_VERSION}"
133133
fi
134134

135+
export BUILD_SUBDIR=${REPO}
136+
135137
case ${JOB_TYPE} in
136138
dependencies)
137-
.kokoro/dependencies.sh
139+
../.kokoro/dependencies.sh
138140
RETURN_CODE=$?
139141
;;
140142
flatten-plugin)
141143
# This creates .flattened-pom.xml
142-
echo "Before running .kokoro/build.sh"
143-
.kokoro/build.sh
144-
echo "After running .kokoro/build.sh"
144+
echo "Before running ../.kokoro/build.sh"
145+
../.kokoro/build.sh
146+
echo "After running ../.kokoro/build.sh"
145147
pushd google-cloud-*
146148
mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true \
147149
| grep '\[INFO] .*:.*:.*:.*:.*' |awk '{print $2}' > .actual-flattened-dependencies-list.txt
@@ -156,12 +158,8 @@ flatten-plugin)
156158
popd
157159
;;
158160
*)
159-
# Here we replace the com.coveo fmt plugin with the spotify version.
160-
# This `sed` won't be needed once downstream repositories update
161-
# `.kokoro/build.sh` to use the `com.spotify.fmt` group ID.
162-
sed -i 's/com.coveo:fmt-maven-plugin/com.spotify.fmt:fmt-maven-plugin/' .kokoro/build.sh
163161
# This reads the JOB_TYPE environmental variable
164-
.kokoro/build.sh
162+
../.kokoro/build.sh
165163
RETURN_CODE=$?
166164
;;
167165
esac

0 commit comments

Comments
 (0)