From ca095a43708e031de8f2b62bd7289b728eb6e807 Mon Sep 17 00:00:00 2001 From: Ben Madore <823868+madorb@users.noreply.github.com> Date: Thu, 12 Sep 2024 04:52:20 -0500 Subject: [PATCH] Also support Java 21 (#743) Co-authored-by: Ben Madore --- bin/docker-setup.sh | 2 +- bin/scip-java-docker-script.sh | 5 ++--- docs/getting-started.md | 4 ++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/docker-setup.sh b/bin/docker-setup.sh index b249d6118..fbd686dac 100755 --- a/bin/docker-setup.sh +++ b/bin/docker-setup.sh @@ -15,7 +15,7 @@ rm gradle.zip mv /opt/gradle/*/* /opt/gradle # pre-install JDK for all major versions -for JVM_VERSION in 17 11 8 +for JVM_VERSION in 21 17 11 8 do coursier java --jvm $JVM_VERSION --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json -- -version done diff --git a/bin/scip-java-docker-script.sh b/bin/scip-java-docker-script.sh index 0112ce41a..1b7806159 100755 --- a/bin/scip-java-docker-script.sh +++ b/bin/scip-java-docker-script.sh @@ -3,7 +3,7 @@ # version. It assumes that `coursier` is available on the `$PATH` and that the # `scip-java` binary is already installed at `/app/scip-java/bin/scip-java`. set -eu -JVM_VERSION="${JVM_VERSION:-17,11,8}" +JVM_VERSION="${JVM_VERSION:-21,17,11,8}" FILE="$PWD/lsif-java.json" if test -f "$FILE"; then FROM_CONFIG=$(jq -r '.jvm' "$FILE") @@ -23,12 +23,11 @@ do if [ "$LAST_CODE" != "0" ]; then echo "Using JVM version '$JVM_VERSION'" - if [ "$JVM_VERSION" = "17" ]; then + if [ "$JVM_VERSION" = "17" ] || [ "$JVM_VERSION" = "21" ]; then export JAVA_OPTS="--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" else export JAVA_OPTS="" fi - eval "$(coursier java --jvm "$JVM_VERSION" --env --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json)" java -version diff --git a/docs/getting-started.md b/docs/getting-started.md index 5d9ae9cde..80c86c804 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -54,6 +54,10 @@ docker run -v $(pwd):/sources --env JVM_VERSION=11 sourcegraph/scip-java:latest # Java 17 (default) docker run -v $(pwd):/sources --env JVM_VERSION=17 sourcegraph/scip-java:latest scip-java index + +# Java 21 +docker run -v $(pwd):/sources --env JVM_VERSION=21 sourcegraph/scip-java:latest scip-java index + ``` ### Java launcher