1+ #! /bin/bash
2+ # Copyright 2024 Google LLC
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
16+ set -eo pipefail
17+
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-source-compatibility.sh"
21+ echo " Expects a comma-delimited list: i.e REPOS_UNDER_TEST=\" java-bigtable,java-bigquery\" "
22+ exit 1
23+ fi
24+
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-source-compatibility.sh"
28+ echo " Expects a single Protobuf-Java runtime version i.e. PROTOBUF_RUNTIME_VERSION=\" 4.28.3\" "
29+ exit 1
30+ fi
31+
32+ git clone https://github.com/lqiu96/cloud-opensource-java.git
33+ pushd cloud-opensource-java
34+ mvn -B -ntp clean compile
35+ pushd dependencies
36+
37+ for repo in ${REPOS_UNDER_TEST// ,/ } ; do # Split on comma
38+ repo_name=$( echo " $repo " | cut -d ' -' -f 2-)
39+ # Perform source-compatibility testing on main (latest changes)
40+ git clone " https://github.com/googleapis/$repo .git" --depth=1
41+ pushd " $repo "
42+
43+ mvn clean install -T 1C -DskipTests
44+
45+ # For google-cloud-java monorepo, use the parent google-cloud-java version.
46+ # Otherwise, use the first google-cloud-* artifact's version.
47+ if [[ " $repo " == " google-cloud-java" ]]; then
48+ primary_artifact=$( grep -E " ^${repo} " " versions.txt" | head -n 1)
49+ else
50+ primary_artifact=$( grep -E " ^google-cloud-${repo_name} " " versions.txt" | head -n 1)
51+ fi
52+ echo " ${primary_artifact} "
53+ version=$( echo " ${primary_artifact} " | tr ' :' ' \n' | tail -n 1)
54+ echo " ${version} "
55+
56+ mvn -B -ntp exec:java -Dexec.mainClass=" com.google.cloud.tools.opensource.classpath.LinkageCheckerMain" -Dexec.args=" -r --artifacts com.google.cloud:google-cloud-${repo_name} :${version} "
57+ popd
58+ done
59+ popd
0 commit comments