diff options
author | John Cater <jcater@google.com> | 2016-08-23 18:49:56 +0000 |
---|---|---|
committer | John Cater <jcater@google.com> | 2016-08-23 22:59:03 +0000 |
commit | 6a87a7ed6eedd797838f8eba86a4e8ec6309dd36 (patch) | |
tree | b22587c9f9fa48d8b14fae9d33e20a3034d645d2 /scripts/bootstrap | |
parent | 731c27155a459033028714ec1264e631f7820726 (diff) |
Update the JAVAC_VERSION regex to handle the case where javac adds extra text around the version string. Fixes #1678.
--
Change-Id: I765699c43119e28d5f0ef8245b91e263d6af6dc0
Reviewed-on: https://bazel-review.googlesource.com/c/5570
MOS_MIGRATED_REVID=131080854
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-x | scripts/bootstrap/buildenv.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh index f97040f580..610a218ec9 100755 --- a/scripts/bootstrap/buildenv.sh +++ b/scripts/bootstrap/buildenv.sh @@ -157,7 +157,7 @@ function fail() { exitCode=1 fi echo >&2 - echo "$1" >&2 + echo "$@" >&2 exit $exitCode } @@ -245,10 +245,12 @@ function get_java_version() { || 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 + 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." + fail \ + "Cannot determine JDK version, please set \$JAVA_HOME.\n" \ + "\$JAVAC_VERSION is \"${JAVAC_VERSION}\"" fi } |