1+ #! /bin/bash
2+ # Copyright 2023 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+ exit 1
22+ fi
23+
24+ # Version of Protobuf-Java runtime to compile with
25+ if [ -z " ${PROTOBUF_RUNTIME_VERSION} " ]; then
26+ echo " PROTOBUF_RUNTIME_VERSION must be set to run downstream-protobuf-source-compatibility.sh"
27+ exit 1
28+ fi
29+
30+ # Get the directory of the build script
31+ scriptDir=$( realpath " $( dirname " ${BASH_SOURCE[0]} " ) " )
32+ cd " ${scriptDir} /../.." # cd to the root of this repo
33+ source " $scriptDir /common.sh"
34+ setup_maven_mirror
35+
36+ for repo in ${REPOS_UNDER_TEST// ,/ } ; do # Split on comma
37+ # Perform source-compatibility testing on main (latest changes)
38+ git clone " https://github.com/googleapis/$repo .git" --depth=1
39+ pushd " $repo "
40+
41+ # Compile the Handwritten Library with the Protobuf-Java version to test source compatibility
42+ # Run unit tests to help check for any behavior differences (dependant on coverage)
43+ mvn clean test -B -V -ntp \
44+ -Dclirr.skip=true \
45+ -Denforcer.skip=true \
46+ -Dmaven.javadoc.skip=true \
47+ -Dprotobuf.version=${PROTOBUF_RUNTIME_VERSION} \
48+ -T 1C
49+ popd
50+ done
0 commit comments