aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap/buildenv.sh
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-06-23 17:15:12 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-06-24 12:08:13 +0000
commit338dc56eae94efcaaf67850dcf9424314ea5b72e (patch)
treeac67f547946518562a4e867c2a90d899ffc7be77 /scripts/bootstrap/buildenv.sh
parent9290ac6c8dac3a36a73278cb3d179704f7663782 (diff)
Disable tests that requires JDK 8 when using compile.sh
Also fix the OS X travis build file. -- MOS_MIGRATED_REVID=96683399
Diffstat (limited to 'scripts/bootstrap/buildenv.sh')
-rwxr-xr-xscripts/bootstrap/buildenv.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 3be93df1c3..812e31909d 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -81,6 +81,7 @@ function clear_log() {
LEAVES="\xF0\x9F\x8D\x83"
INFO="\033[32mINFO\033[0m:"
+WARNING="\033[31mWARN\033[0m:"
first_step=1
function new_step() {
@@ -109,3 +110,20 @@ else
md5sum $1
}
fi
+
+# Gets the java version from JAVA_HOME
+# Sets JAVAC and JAVAC_VERSION with respectively the path to javac and
+# the version of javac.
+function get_java_version() {
+ test -z "$JAVA_HOME" && fail "JDK not found, please set \$JAVA_HOME."
+ JAVAC="${JAVA_HOME}/bin/javac"
+ [[ -x "${JAVAC}" ]] \
+ || fail "JAVA_HOME ($JAVA_HOME) is not a path to a working JDK."
+
+ JAVAC_VERSION=$("${JAVAC}" -version 2>&1)
+ if [[ "$JAVAC_VERSION" =~ ^"javac "(1\.([789]|[1-9][0-9])).*$ ]]; then
+ JAVAC_VERSION=${BASH_REMATCH[1]}
+ else
+ fail "Cannot determine JDK version, please set \$JAVA_HOME."
+ fi
+}