Skip to content

Add Java 25 support #19

Add Java 25 support

Add Java 25 support #19

Workflow file for this run

name: Nix
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
NIX_DEVELOP: ${{ github.workspace }}
defaults:
run:
shell: bash --noprofile --norc -eo pipefail -c "nix develop $NIX_DEVELOP --command bash --noprofile --norc -eo pipefail $1" -- {0}
jobs:
flake-check:
runs-on: ubuntu-latest
name: nix flake check
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: nix flake check -L
test:
runs-on: ubuntu-latest
name: Tests (JDK ${{ matrix.java }})
env:
NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }}
strategy:
fail-fast: false
matrix:
java: [11, 17, 21]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- name: Main project tests
run: gradle test --no-daemon
bazel:
runs-on: ubuntu-latest
name: Bazel (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: scip-java
directory: .
javac_option: "--//scip-javac:enabled=true"
aggregator_target: "scip-aggregator:bazel"
- name: bazel-example
directory: examples/bazel-example
javac_option: "--@scip_java//scip-javac:enabled=true"
aggregator_target: "@scip_java//scip-aggregator:bazel"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: bazelisk build //... ${{ matrix.javac_option }}
working-directory: ${{ matrix.directory }}
- run: bazelisk run ${{ matrix.aggregator_target }} -- --sourceroot "$PWD"
working-directory: ${{ matrix.directory }}
- run: du -h index.scip
working-directory: ${{ matrix.directory }}
bazel_aspect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: gradle :scip-java:installDist --no-daemon
- run: printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV"
- name: Auto-index scip-java codebase
run: |
"$SCIP_JAVA_CLI" index --build-tool=bazel --bazel-scip-java-binary="$SCIP_JAVA_CLI"
- run: du -h index.scip
- name: Auto-index example/bazel-workspace
run: |
"$SCIP_JAVA_CLI" index --build-tool=bazel --bazel-scip-java-binary="$SCIP_JAVA_CLI"
working-directory: examples/bazel-example
- run: du -h index.scip
working-directory: examples/bazel-example
kotlin_plugin:
runs-on: ubuntu-latest
name: scip-kotlinc
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- name: scip-kotlinc tests
run: gradle :scip-kotlinc:test --no-daemon
jdk25-plugin:
runs-on: ubuntu-latest
name: scip-javac plugin (JDK 25)
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
# The plugin jar targets `--release 11`, so it is built with the default
# toolchain (Gradle 8.14 cannot run on JDK 25) and then exercised against a
# JDK 25 `javac` below.
- name: Build scip-javac plugin jar
run: gradle :scip-javac:shadowJar --no-daemon
- name: Index a fixture with JDK 25 javac
env:
NIX_DEVELOP: ${{ github.workspace }}#jdk25
run: |
java -version
javac -version
shopt -s nullglob
jars=(scip-javac/target/gradle/libs/scip-javac-*-all.jar)
if [ "${#jars[@]}" -eq 0 ]; then
echo "scip-javac shadow jar not found" >&2
exit 1
fi
jar="${jars[0]}"
work="$(mktemp -d)"
mkdir -p "$work/src" "$work/out" "$work/classes"
printf '%s\n' \
'public class Hello {' \
' public static void main(String[] args) {' \
' System.out.println("hello from JDK 25");' \
' }' \
'}' > "$work/src/Hello.java"
javac \
-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-cp "$jar" \
-processorpath "$jar" \
-d "$work/classes" \
"-Xplugin:scip -sourceroot:$work/src -targetroot:$work/out" \
"$work/src/Hello.java"
shards=("$work"/out/META-INF/scip/*.scip)
if [ "${#shards[@]}" -eq 0 ]; then
echo "no SCIP shard produced under $work/out" >&2
find "$work/out" -type f >&2 || true
exit 1
fi
echo "SCIP shard generated: ${shards[0]}"
snapshots:
runs-on: ubuntu-latest
name: Snapshots
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- name: Regenerate snapshots
run: gradle :scip-snapshots:saveSnapshots --no-daemon
- name: Check snapshot drift
run: |
git diff --exit-code \
scip-snapshots/expected
maven:
runs-on: ubuntu-latest
name: Maven tests (JDK ${{ matrix.java }})
env:
NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }}
strategy:
fail-fast: false
matrix:
java: [11, 17, 21]
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: |
gradle --no-daemon :scip-java:installDist publishToMavenLocal
SCIP_JAVA_VERSION="$(
sed -n 's/^version:=//p' scip-java/build/install/scip-java/VERSION
)"
test -n "$SCIP_JAVA_VERSION"
printf 'SCIP_JAVA_VERSION=%s\n' "$SCIP_JAVA_VERSION" >> "$GITHUB_ENV"
printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV"
- run: mvn clean verify -DskipTests "-Dscip-java.version=$SCIP_JAVA_VERSION" sourcegraph:sourcegraphDependencies
working-directory: examples/maven-example
- run: |
"$SCIP_JAVA_CLI" aggregate target/scip-targetroot
working-directory: examples/maven-example
- run: |
grep org.hamcrest target/scip-targetroot/*dependencies.txt
grep "$PWD/src/main/java" target/scip-targetroot/*dependencies.txt
working-directory: examples/maven-example
- run: du -h index.scip
working-directory: examples/maven-example