diff options
author | Nathan Harmata <nharmata@google.com> | 2016-11-23 19:08:12 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-11-23 19:15:25 +0000 |
commit | 8a475906e0fbf949fa36dd02259183a9d3644621 (patch) | |
tree | f458f37f5b63f7f047596d980d312b788fcc5b91 /scripts/bootstrap | |
parent | 5a51077d061455503e0fdabf4d92603e402c97d1 (diff) |
Change the bootstrap script to swap
the order of the error_prone_core jar and the guava jar. The default
alphabetical-directory ordering is bad for the same reason that care is needed
in the order of those jars in the rules in third_party/BUILD (see the comments
there for more info).
--
MOS_MIGRATED_REVID=140051569
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-x | scripts/bootstrap/compile.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh index 1bf1e0ceb9..f5724aa23d 100755 --- a/scripts/bootstrap/compile.sh +++ b/scripts/bootstrap/compile.sh @@ -21,6 +21,27 @@ LIBRARY_JARS=$(find third_party -name '*.jar' | grep -Fv /javac.jar | grep -Fv / 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}" + +# 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 +# classpath. +# +# Please read the comment in third_party/BUILD for more details. +LIBRARY_JARS_ARRAY=($LIBRARY_JARS) +for i in $(seq 0 $((${#LIBRARY_JARS_ARRAY[@]} - 1))) +do + [ "${LIBRARY_JARS_ARRAY[$i]}" = "third_party/error_prone/error_prone_core-2.0.13.jar" ] && ERROR_PRONE_INDEX=$i + [ "${LIBRARY_JARS_ARRAY[$i]}" = "third_party/guava/guava-21.0-20161101.jar" ] && GUAVA_INDEX=$i +done +[ "${ERROR_PRONE_INDEX:+present}" = "present" ] || { echo "no error prone jar"; echo "${LIBRARY_JARS_ARRAY[@]}"; exit 1; } +[ "${GUAVA_INDEX:+present}" = "present" ] || { echo "no guava jar"; exit 1; } +if [ "$ERROR_PRONE_INDEX" -lt "$GUAVA_INDEX" ]; then + TEMP_FOR_SWAP="${LIBRARY_JARS_ARRAY[$ERROR_PRONE_INDEX]}" + LIBRARY_JARS_ARRAY[$ERROR_PRONE_INDEX]="${LIBRARY_JARS_ARRAY[$GUAVA_INDEX]}" + LIBRARY_JARS_ARRAY[$GUAVA_INDEX]="$TEMP_FOR_SWAP" + LIBRARY_JARS="${LIBRARY_JARS_ARRAY[@]}" +fi + DIRS=$(echo src/{java_tools/singlejar/java/com/google/devtools/build/zip,main/java,tools/xcode-common/java/com/google/devtools/build/xcode/{common,util}} third_party/java/dd_plist/java ${OUTPUT_DIR}/src) EXCLUDE_FILES=src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java |