Select the good guava jars for JDK7 build
Manually tested with ./compile.sh and JAVA_VERSION=1.7
Fixes
MOS_MIGRATED_REVID=149422627
# Script for building bazel from scratch without bazel
PROTO_FILES=$(ls src/main/protobuf/*.proto src/main/java/com/google/devtools/build/lib/buildeventstream/proto/*.proto)
-LIBRARY_JARS=$(find third_party -name '*.jar' | grep -Fv /javac-9-dev-r3297-4.jar | grep -Fv /javac7.jar | grep -Fv JavaBuilder | grep -ve third_party/grpc/grpc.*jar | tr "\n" " ")
+LIBRARY_JARS=$(find third_party -name '*.jar' | grep -Fv /javac-9-dev-r3297-4.jar | grep -Fv /javac7.jar | grep -Fv JavaBuilder | grep -Fv third_party/guava | grep -Fv third_party/guava | grep -ve third_party/grpc/grpc.*jar | tr "\n" " ")
GRPC_JAVA_VERSION=0.15.0
GRPC_LIBRARY_JARS=$(find third_party/grpc -name '*.jar' | grep -e .*${GRPC_JAVA_VERSION}.*jar | tr "\n" " ")
-LIBRARY_JARS="${LIBRARY_JARS} ${GRPC_LIBRARY_JARS}"
+# Guava jars are different for JDK 7 build and JDK 8 build, we select the good
+# one based on the name (21.0-{date} for JDK7).
+if [ "${JAVA_VERSION}" = "1.7" ]; then
+ GUAVA_JARS=third_party/guava/guava-*21.0-*.jar
+else
+ GUAVA_JARS=third_party/guava/guava-*21.0.jar
+fi
+LIBRARY_JARS="${LIBRARY_JARS} ${GRPC_LIBRARY_JARS} ${GUAVA_JARS}"
# tl;dr - error_prone_core contains a copy of an older version of guava, so we
# need to make sure the newer version of guava always appears first on the
