Skip to content

Commit

Permalink
Also support Java 21 (#743)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Madore <ben.madore@glassdoor.com>
  • Loading branch information
madorb and benmadore-glassdoor authored Sep 12, 2024
1 parent 35435b9 commit ca095a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions bin/scip-java-docker-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca095a4

Please sign in to comment.