Skip to content

Commit

Permalink
Improve missing local_jdk error message
Browse files Browse the repository at this point in the history
This slightly improves #21391
  • Loading branch information
keith committed Feb 23, 2024
1 parent 6889d08 commit fc5038a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,23 @@ function try_with_timeout() {

function setup_localjdk_javabase() {
if [[ $PLATFORM =~ msys ]]; then
jdk_dir="$(cygpath -m $(cd $(rlocation local_jdk/bin/java.exe)/../..; pwd))"
jdk_binary=local_jdk/bin/java.exe
else
jdk_dir="$(dirname $(dirname $(rlocation local_jdk/bin/java)))"
jdk_binary=local_jdk/bin/java
fi

if ! jdk_rlocation=$(rlocation "$jdk_binary"); then
echo "error: failed to find $jdk_binary, make sure you have java \
installed or pass --java_runtime_verison=XX with the correct version" >&2
exit 1
fi

if [[ $PLATFORM =~ msys ]]; then
jdk_dir="$(cygpath -m $(cd "$jdk_rlocation/../.."; pwd))"
else
jdk_dir="$(dirname $(dirname "$jdk_rlocation"))"
fi

bazel_javabase="${jdk_dir}"
}

Expand Down Expand Up @@ -1011,4 +1024,4 @@ function override_java_tools() {
add_to_bazelrc "build --override_repository=${JAVA_TOOLS_REPO_PREFIX}remote_java_tools_darwin_x86_64=${JAVA_TOOLS_PREBUILT_DIR}"
add_to_bazelrc "build --override_repository=${JAVA_TOOLS_REPO_PREFIX}remote_java_tools_darwin_arm64=${JAVA_TOOLS_PREBUILT_DIR}"
fi
}
}

0 comments on commit fc5038a

Please sign in to comment.