Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve missing local_jdk error message #21392

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading