1#!/bin/bash 2 3set -e -o pipefail 4 5echo "Running Linkage Monitor check" 6 7echo "Maven command: $(which mvn)" 8mvn --version 9 10# This script runs within the Bazel's sandbox directory and uses protoc 11# generated within the Bazel project. 12protoc_location=$(realpath "${RUNFILES_DIR}/com_google_protobuf/protoc") 13if [ ! -x "${protoc_location}" ]; then 14 echo "${protoc_location} is not found or not executable" 15 exit 1 16fi 17 18cd java 19 20# Install the test BOM for Linkage Monitor 21pushd test/linkage-monitor-check-bom 22mvn -e -B install 23popd 24 25# Linkage Monitor requires the artifacts to be available in local Maven 26# repository. 27mvn -e -B clean generate-sources install \ 28 -Dhttps.protocols=TLSv1.2 \ 29 -Dmaven.test.skip=true \ 30 -Dprotobuf.basedir="../.." \ 31 -Dprotoc="${protoc_location}" 32 33echo "Installed the artifacts to local Maven repository" 34 35curl -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/linkage-monitor-latest-all-deps.jar" 36 37echo "Running linkage-monitor-latest-all-deps.jar." 38 39# The libraries in the BOM would detect incompatible changes via Linkage Monitor 40java -Xmx2048m -jar linkage-monitor-latest-all-deps.jar \ 41 com.google.protobuf.test:linkage-monitor-check-bom 42 43echo "Finished running Linkage Monitor check" 44