aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap
diff options
context:
space:
mode:
authorGravatar Harsh Vardhan <harshvd95@gmail.com>2017-03-21 15:27:12 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-22 10:53:43 +0000
commitfe04cfd849bad7a0e534ebe8fef7e39905db8443 (patch)
tree471720af10009d6595975893f0bce69fea19537a /scripts/bootstrap
parentefa0dd662a702c3757e3c85abdd563be11930a82 (diff)
Fix compilation error because of vague JDK version check in compile.sh
Fixes: https://github.com/bazelbuild/bazel/issues/2677 -- Change-Id: Ie8518530dfd9a7eed41c44230e59afbd5724544b Reviewed-on: https://cr.bazel.build/9455 PiperOrigin-RevId: 150754975 MOS_MIGRATED_REVID=150754975
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-xscripts/bootstrap/compile.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 294b154b83..becd458387 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -65,9 +65,15 @@ LDFLAGS=${LDFLAGS:-""}
MSYS_DLLS=""
+function get_minor_java_version() {
+ get_java_version
+ java_minor_version=$(echo $JAVA_VERSION | sed -E 's/.+\.(.+)(\..*)?/\1/')
+ javac_minor_version=$(echo $JAVAC_VERSION | sed -E 's/.+\.(.+)(\..*)?/\1/')
+}
+
# Check that javac -version returns a upper version than $JAVA_VERSION.
-get_java_version
-[ ${JAVA_VERSION#*.} -le ${JAVAC_VERSION#*.} ] || \
+get_minor_java_version
+[ ${java_minor_version} -le ${javac_minor_version} ] || \
fail "JDK version (${JAVAC_VERSION}) is lower than ${JAVA_VERSION}, please set \$JAVA_HOME."
JAR="${JAVA_HOME}/bin/jar"