1515
1616set -eo pipefail
1717
18- # Comma-delimited list of repos to test with the local java-shared-dependencies
19- if [ -z " ${REPOS_UNDER_TEST} " ]; then
20- echo " REPOS_UNDER_TEST must be set to run downstream-protobuf-binary-compatibility.sh"
21- echo " Expects a comma-delimited list: i.e REPOS_UNDER_TEST=\" java-bigtable,java-bigquery\" "
22- exit 1
23- fi
18+ scriptDir=$( realpath " $( dirname " ${BASH_SOURCE[0]} " ) " )
19+ source " ${scriptDir} /common.sh"
2420
25- # Version of Protobuf-Java runtime to compile with
26- if [ -z " ${PROTOBUF_RUNTIME_VERSION} " ]; then
27- echo " PROTOBUF_RUNTIME_VERSION must be set to run downstream-protobuf-binary-compatibility.sh"
28- echo " Expects a single Protobuf-Java runtime version i.e. PROTOBUF_RUNTIME_VERSION=\" 4.28.3\" "
29- exit 1
30- fi
21+ validate_protobuf_compatibility_script_inputs
3122
3223# Create two mappings of possible API names (Key: Maven Artifact ID Prefix, Value: Maven Group ID)
3324# for the libraries that should be tested.
@@ -36,6 +27,7 @@ declare -A monorepo_handwritten_libraries
3627monorepo_handwritten_libraries[" grafeas" ]=" io.grafeas"
3728monorepo_handwritten_libraries[" google-cloud-vertexai" ]=" com.google.cloud"
3829monorepo_handwritten_libraries[" google-cloud-resourcemanager" ]=" com.google.cloud"
30+ monorepo_handwritten_libraries[" google-cloud-translate" ]=" com.google.cloud"
3931
4032# 2. These are the mappings of all the downstream handwritten libraries' artifacts
4133declare -A downstream_handwritten_libraries
@@ -48,8 +40,10 @@ function build_artifact_list() {
4840 for artifact_id_prefix in " ${! api_maven_mapping[@]} " ; do
4941 group_id=" ${api_maven_mapping[${artifact_id_prefix}]} "
5042
51- # Match all artifacts that start with the artifact_id_prefix to exclude any proto and grpc modules.
52- repo_artifact_list=$( cat " versions.txt" | grep " ^${artifact_id_prefix} " || true)
43+ # Match all artifacts that start with the $artifact_id_prefix or grpc to exclude any proto modules.
44+ # grpc-* module are included as gRPC-Java controls their Protobuf version and may generate code
45+ # using a different version of Protobuf
46+ repo_artifact_list=$( cat " versions.txt" | grep -E " ^(${artifact_id_prefix} |grpc)" || true)
5347
5448 # Only proceed if there are matching elements
5549 if [ -n " ${repo_artifact_list} " ]; then
@@ -100,8 +94,10 @@ for repo in ${REPOS_UNDER_TEST//,/ }; do # Split on comma
10094 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} "
10195 echo " Linkage Checker Program Arguments: ${program_args} "
10296 mvn -B -ntp exec:java -Dexec.args=" ${program_args} " -P exec-linkage-checker
97+ else
98+ echo " Unable to find any matching artifacts to test in ${repo} "
99+ exit 1
103100 fi
104- echo " done"
105101done
106102popd
107103popd
0 commit comments