From baca6e4cb023649920871b74810927d304729e59 Mon Sep 17 00:00:00 2001 From: philwo Date: Mon, 15 May 2017 22:00:47 +0200 Subject: [PATCH] Fix #2982: Bazel installer should not check for installed JDK if using a bundled JDK. PiperOrigin-RevId: 156092071 --- scripts/packages/template_bin.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh index 906a3871d3bcea..ae332af6f6fbf5 100755 --- a/scripts/packages/template_bin.sh +++ b/scripts/packages/template_bin.sh @@ -115,13 +115,20 @@ if [ -z "${JAVA_HOME-}" ]; then ;; esac fi -if [ ! -x "${JAVA_HOME}/bin/javac" ]; then - echo >&2 - echo "Java not found, please install the corresponding package" >&2 - echo "See http://bazel.build/docs/install.html for more information on" >&2 - echo "dependencies of Bazel." >&2 - exit 1 -fi + +# Only check for an installed JDK if this version of Bazel does not contain a +# bundled JDK. +case "$0" in + *without-jdk*) + if [ ! -x "${JAVA_HOME}/bin/javac" ]; then + echo >&2 + echo "Java not found, please install the corresponding package." >&2 + echo "See http://bazel.build/docs/install.html for more information on" >&2 + echo "dependencies of Bazel." >&2 + exit 1 + fi + ;; +esac # Test for write access test_write "${bin}"