Skip to content

Commit

Permalink
GitHub gradle.yml workflow: use JDK 23
Browse files Browse the repository at this point in the history
Our Gradle wrapper is already using Gradle 8.10, so JDK 23 is supported. 

Use `-PjavaToolchainVersion=23` on the Gradle command line in gradle.yml
and leave the default value of javaToolchainVersion=22 (gradle.properties)
for people using Nix or other environments that don't have JDK 23 available
yet.

Update secp-examples-*/build.gradle to use javaToolchainVersion when
configuring toolchains.
  • Loading branch information
msgilligan committed Sep 18, 2024
1 parent bb5e014 commit 1c23576
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ jobs:
os: [ubuntu-latest, macOS-latest]
distribution: ['temurin']
fail-fast: false
name: ${{ matrix.os }} JDK 22
name: ${{ matrix.os }} JDK 23
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.distribution }}
# Setup JDK 21 & JDK 22 to make JDK 22 available to the Gradle Java Toolchains feature
# When installing multiple JDKs, the last JDK installed is the default and will be used to run Gradle itself
java-version: |
22
21
23
- name: Cache Gradle packages
uses: actions/cache@v4
with:
Expand All @@ -36,6 +34,6 @@ jobs:
- name: Install secp256k1 with Nix
run: nix profile install nixpkgs#secp256k1
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew -PjavaToolchainVersion=23 build
- name: Run Java & Kotlin Examples
run: ./gradlew run runEcdsa
run: ./gradlew -PjavaToolchainVersion=23 run runEcdsa
2 changes: 1 addition & 1 deletion secp-examples-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ run {

tasks.register('runEcdsa', JavaExec) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(22)
languageVersion = JavaLanguageVersion.of(javaToolchainVersion)
}
systemProperty "java.library.path", javaLibraryPath
classpath = sourceSets.main.runtimeClasspath
Expand Down
4 changes: 2 additions & 2 deletions secp-examples-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tasks.withType(JavaCompile).configureEach {
}

kotlin {
jvmToolchain(22)
jvmToolchain(javaToolchainVersion as int)
}

application {
Expand All @@ -31,7 +31,7 @@ run {

tasks.register('runEcdsa', JavaExec) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(22)
languageVersion = JavaLanguageVersion.of(javaToolchainVersion)
}
systemProperty "java.library.path", javaLibraryPath
classpath = sourceSets.main.runtimeClasspath
Expand Down

0 comments on commit 1c23576

Please sign in to comment.