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

Also support Java 21 #743

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
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
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
Loading