Skip to content

Commit ad8544a

Browse files
committed
chore: Fix issue with gRPC modules to test
1 parent 3b79741 commit ad8544a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

.kokoro/nightly/downstream-protobuf-binary-compatibility.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ function build_artifact_list() {
6565

6666
# Only proceed if there are matching elements
6767
if [ -n "${grpc_repo_artifact_list}" ]; then
68-
# Exclude any matches to BOM artifacts or emulators. The repo artifact list will look like:
69-
# "com.google.cloud:google-cloud-accessapproval:2.60.0-SNAPSHOT,com.google.cloud:google-cloud-aiplatform:3.60.0-SNAPSHOT,"
70-
grpc_repo_artifact_list=$(echo "${grpc_repo_artifact_list}" | awk -F: "{\$1=\"${group_id}:\"\$1; \$2=\"\"; print}" OFS=: | sed 's/::/:/' | tr '\n' ',')
68+
grpc_repo_artifact_list=$(echo "${grpc_repo_artifact_list}" | awk -F: "{\$1=\"com.google.api.grpc:\"\$1; \$2=\"\"; print}" OFS=: | sed 's/::/:/' | tr '\n' ',')
7169
# Remove the trailing comma after the last entry
7270
grpc_repo_artifact_list=${grpc_repo_artifact_list%,}
7371

7472
# The first entry added is not separated with a comma. Avoids generating `,{ARTIFACT_LIST}`
75-
if [ -z "${artifact_list}" ]; then
73+
if [ -z "${grpc_artifact_list}" ]; then
7674
grpc_artifact_list="${grpc_repo_artifact_list}"
7775
else
7876
grpc_artifact_list="${grpc_artifact_list},${grpc_repo_artifact_list}"
@@ -107,24 +105,26 @@ for repo in ${REPOS_UNDER_TEST//,/ }; do # Split on comma
107105
popd
108106

109107
echo "Artifact List: ${artifact_list}"
110-
# Only run Linkage Checker if the repo has any relevant artifacts to test for
111-
if [ -n "${artifact_list}" ] || [ -n "${grpc_artifact_list}" ]; then
112-
# The `-s` argument filters the linkage check problems that stem from the artifact
113-
# There are two calls to Linkage Checker: 1. repo's handwritten modules 2. repo's gRPC modules
114-
# This is because mvn has a limit on the number of program arguments you can pass in
115-
108+
# The `-s` argument filters the linkage check problems that stem from the artifact
109+
# There are two calls to Linkage Checker: 1. repo's handwritten modules 2. repo's gRPC modules
110+
# This is because mvn has a limit on the number of program arguments you can pass in
111+
if [ -n "${artifact_list}" ]; then
116112
program_args="-r --artifacts ${artifact_list},com.google.protobuf:protobuf-java:${PROTOBUF_RUNTIME_VERSION},com.google.protobuf:protobuf-java-util:${PROTOBUF_RUNTIME_VERSION} -s ${artifact_list}"
117113
echo "Running Linkage Checker on the repo's handwritten modules"
118114
echo "Linkage Checker Program Arguments: ${program_args}"
119115
mvn -B -ntp exec:java -Dexec.args="${program_args}" -P exec-linkage-checker
116+
else
117+
echo "Unable to find any matching artifacts to test in ${repo}"
118+
exit 1
119+
fi
120120

121-
program_args="-r --artifacts ${artifact_list},com.google.protobuf:protobuf-java:${PROTOBUF_RUNTIME_VERSION},com.google.protobuf:protobuf-java-util:${PROTOBUF_RUNTIME_VERSION} -s ${grpc_artifact_list}"
121+
echo "gRPC Artifact List: ${grpc_artifact_list}"
122+
# Some downstream handwritten artifacts do not have gRPC support, do not fail if there are no artifacts
123+
if [ -n "${grpc_artifact_list}" ]; then
124+
program_args="-r --artifacts ${grpc_artifact_list},com.google.protobuf:protobuf-java:${PROTOBUF_RUNTIME_VERSION},com.google.protobuf:protobuf-java-util:${PROTOBUF_RUNTIME_VERSION} -s ${grpc_artifact_list}"
122125
echo "Running Linkage Checker on the repo's gRPC modules"
123126
echo "Linkage Checker Program Arguments for gRPC Modules: ${program_args}"
124127
mvn -B -ntp exec:java -Dexec.args="${program_args}" -P exec-linkage-checker
125-
else
126-
echo "Unable to find any matching artifacts to test in ${repo}"
127-
exit 1
128128
fi
129129
done
130130
popd

0 commit comments

Comments
 (0)