Skip to content

Commit d7e1959

Browse files
authored
Update JDK from 24 to 25 (#409)
1 parent e072b2e commit d7e1959

File tree

13 files changed

+64
-58
lines changed

13 files changed

+64
-58
lines changed

.github/actions/prepare_env/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runs:
1212
with:
1313
distribution: ${{ matrix.jdk_vendor }}
1414
java-version: |
15-
24
15+
25
1616
17
1717
cache: 'gradle'
1818
- name: Set JAVA_HOME_{N}
@@ -23,10 +23,10 @@ runs:
2323
elif [[ -n "$JAVA_HOME_21_ARM64" ]]; then
2424
echo "JAVA_HOME_21=$JAVA_HOME_21_ARM64" >> $GITHUB_ENV
2525
fi
26-
if [[ -n "$JAVA_HOME_24_X64" ]]; then
27-
echo "JAVA_HOME_24=$JAVA_HOME_24_X64" >> $GITHUB_ENV
28-
elif [[ -n "$JAVA_HOME_24_ARM64" ]]; then
29-
echo "JAVA_HOME_24=$JAVA_HOME_24_ARM64" >> $GITHUB_ENV
26+
if [[ -n "$JAVA_HOME_25_X64" ]]; then
27+
echo "JAVA_HOME_25=$JAVA_HOME_25_X64" >> $GITHUB_ENV
28+
elif [[ -n "$JAVA_HOME_25_ARM64" ]]; then
29+
echo "JAVA_HOME_25=$JAVA_HOME_25_ARM64" >> $GITHUB_ENV
3030
fi
3131
# - name: Check Java environment
3232
# shell: bash

BuildLogic/src/main/kotlin/build-logic.java-common-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ plugins {
2323

2424
java {
2525
toolchain {
26-
languageVersion = JavaLanguageVersion.of(24)
26+
languageVersion = JavaLanguageVersion.of(25)
2727
}
2828
}
2929

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ This does require the use of the relatively recent [JEP-454: Foreign Function &
8080
This is the primary way we envision calling Swift code from server-side Java libraries and applications.
8181

8282
Required language/runtime versions:
83-
- **Swift 6.1**, because of dependence on rich swift interface files
84-
- **JDK 25+**, the most recent LTS release which includes the stable Foreign Function and Memory APIs.
83+
- **Swift 6.1**, because of dependence on rich swift interface files
84+
- **JDK 25+**
85+
- We are validating the implementation using the currently supported non-LTE release, which at present means JDK-25.
8586

8687
## swift-java jextract --mode=jni
8788

@@ -101,7 +102,7 @@ This project contains multiple builds, living side by side together.
101102

102103
You will need to have:
103104
- Swift (6.1.x+)
104-
- Java (24+ for FFM, even though we support lower JDK targets)
105+
- Java (25+ for FFM, even though we support lower JDK targets)
105106
- Gradle (installed by "Gradle wrapper" automatically when you run gradle through `./gradlew`)
106107

107108
### Preparing your environment
@@ -120,12 +121,12 @@ however any recent enough Java distribution should work correctly. You can use s
120121
# Install sdkman from: https://sdkman.io
121122
curl -s "https://get.sdkman.io" | bash
122123
sdk install java 17.0.15-amzn
123-
sdk install java 24.0.1-amzn
124+
sdk install java 25.0.1-amzn
124125

125-
sdk use java 24.0.1-amzn
126+
sdk use java 25.0.1-amzn
126127
```
127128

128-
The use of JDK 24 is required to build the project, even though the libraries being published may target lower Java versions.
129+
The use of JDK 25 is required to build the project, even though the libraries being published may target lower Java versions.
129130

130131
❗️ Please make sure to `export JAVA_HOME` such that swift-java can find the necessary java libraries!
131132
When using sdkman the easiest way to export JAVA_HOME is to export the "current" used JDK's home, like this:

Samples/SwiftAndJavaJarSampleLib/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ repositories {
3838

3939
java {
4040
toolchain {
41-
languageVersion.set(JavaLanguageVersion.of(24))
41+
languageVersion.set(JavaLanguageVersion.of(25))
4242
}
4343
}
4444

4545
dependencies {
4646
implementation(project(':SwiftKitCore'))
4747
implementation(project(':SwiftKitFFM'))
4848

49+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // TODO: workaround for not finding junit: https://github.com/gradle/gradle/issues/34512
4950
testImplementation(platform("org.junit:junit-bom:5.10.0"))
5051
testImplementation("org.junit.jupiter:junit-jupiter")
5152
}
@@ -54,16 +55,16 @@ def swiftProductsWithJExtractPlugin() {
5455
def stdout = new ByteArrayOutputStream()
5556
def stderr = new ByteArrayOutputStream()
5657

57-
def result = exec {
58-
commandLine 'swift', 'package', 'describe', '--type', 'json'
59-
standardOutput = stdout
60-
errorOutput = stderr
61-
ignoreExitValue = true
62-
}
58+
def processBuilder = new ProcessBuilder('swift', 'package', 'describe', '--type', 'json')
59+
def process = processBuilder.start()
60+
61+
process.consumeProcessOutput(stdout, stderr)
62+
process.waitFor()
6363

64+
def exitValue = process.exitValue()
6465
def jsonOutput = stdout.toString()
6566

66-
if (result.exitValue == 0) {
67+
if (exitValue == 0) {
6768
def json = new JsonSlurper().parseText(jsonOutput)
6869
def products = json.targets
6970
.findAll { target ->

Samples/SwiftAndJavaJarSampleLib/ci-validate.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ SWIFT_VERSION="$(swift -version | awk '/Swift version/ { print $3 }')"
1010
# This is how env variables are set by setup-java
1111
if [ "$(uname -m)" = 'arm64' ]; then
1212
ARCH=ARM64
13-
JAVAC="${JAVA_HOME_24_ARM64}/bin/javac"
14-
JAVA="${JAVA_HOME_24_ARM64}/bin/java"
13+
JAVAC="${JAVA_HOME_25_ARM64}/bin/javac"
14+
JAVA="${JAVA_HOME_25_ARM64}/bin/java"
1515
else
1616
ARCH=X64
17-
JAVAC="${JAVA_HOME_24_X64}/bin/javac"
18-
JAVA="${JAVA_HOME_24_X64}/bin/java"
17+
JAVAC="${JAVA_HOME_25_X64}/bin/javac"
18+
JAVA="${JAVA_HOME_25_X64}/bin/java"
1919
fi
2020

21-
if [ -n "$JAVA_HOME_24_$ARCH" ]; then
22-
export JAVA_HOME="$JAVA_HOME_24_$ARCH"
21+
if [ -n "$JAVA_HOME_25_$ARCH" ]; then
22+
export JAVA_HOME="$JAVA_HOME_25_$ARCH"
2323
elif [ "$(uname -s)" = 'Linux' ]
2424
then
25-
export PATH="${PATH}:/usr/lib/jvm/jdk-24/bin" # we need to make sure to use the latest JDK to actually compile/run the executable
25+
export PATH="${PATH}:/usr/lib/jvm/jdk-25/bin" # we need to make sure to use the latest JDK to actually compile/run the executable
2626
fi
2727

2828
# check if we can compile a plain Example file that uses the generated Java bindings that should be in the generated jar

Samples/SwiftJavaExtractFFMSampleApp/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ repositories {
3131

3232
java {
3333
toolchain {
34-
languageVersion.set(JavaLanguageVersion.of(24))
34+
languageVersion.set(JavaLanguageVersion.of(25))
3535
}
3636
}
3737

3838
def swiftProductsWithJExtractPlugin() {
3939
def stdout = new ByteArrayOutputStream()
4040
def stderr = new ByteArrayOutputStream()
4141

42-
def result = exec {
43-
commandLine 'swift', 'package', 'describe', '--type', 'json'
44-
standardOutput = stdout
45-
errorOutput = stderr
46-
ignoreExitValue = true
47-
}
42+
def processBuilder = new ProcessBuilder('swift', 'package', 'describe', '--type', 'json')
43+
def process = processBuilder.start()
44+
45+
process.consumeProcessOutput(stdout, stderr)
46+
process.waitFor()
4847

48+
def exitValue = process.exitValue()
4949
def jsonOutput = stdout.toString()
5050

51-
if (result.exitValue == 0) {
51+
if (exitValue == 0) {
5252
def json = new JsonSlurper().parseText(jsonOutput)
5353
def products = json.targets
5454
.findAll { target ->
@@ -150,6 +150,7 @@ dependencies {
150150
implementation(project(':SwiftKitCore'))
151151
implementation(project(':SwiftKitFFM'))
152152

153+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // TODO: workaround for not finding junit: https://github.com/gradle/gradle/issues/34512 // TODO: workaround for not finding junit: https://github.com/gradle/gradle/issues/34512
153154
testImplementation(platform("org.junit:junit-bom:5.10.0"))
154155
testImplementation("org.junit.jupiter:junit-jupiter")
155156
}

Samples/SwiftJavaExtractJNISampleApp/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ repositories {
3232

3333
java {
3434
toolchain {
35-
languageVersion.set(JavaLanguageVersion.of(24))
35+
languageVersion.set(JavaLanguageVersion.of(25))
3636
}
3737
}
3838

3939
def swiftProductsWithJExtractPlugin() {
4040
def stdout = new ByteArrayOutputStream()
4141
def stderr = new ByteArrayOutputStream()
4242

43-
def result = exec {
44-
commandLine 'swift', 'package', 'describe', '--type', 'json'
45-
standardOutput = stdout
46-
errorOutput = stderr
47-
ignoreExitValue = true
48-
}
43+
def processBuilder = new ProcessBuilder('swift', 'package', 'describe', '--type', 'json')
44+
def process = processBuilder.start()
45+
46+
process.consumeProcessOutput(stdout, stderr)
47+
process.waitFor()
4948

49+
def exitValue = process.exitValue()
5050
def jsonOutput = stdout.toString()
5151

52-
if (result.exitValue == 0) {
52+
if (exitValue == 0) {
5353
def json = new JsonSlurper().parseText(jsonOutput)
5454
def products = json.targets
5555
.findAll { target ->
@@ -150,6 +150,7 @@ tasks.clean {
150150
dependencies {
151151
implementation(project(':SwiftKitCore'))
152152

153+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // TODO: workaround for not finding junit: https://github.com/gradle/gradle/issues/34512
153154
testImplementation(platform("org.junit:junit-bom:5.10.0"))
154155
testImplementation("org.junit.jupiter:junit-jupiter")
155156
}

SwiftKitCore/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ publishing {
4343

4444
java {
4545
toolchain {
46-
languageVersion.set(JavaLanguageVersion.of(24))
46+
languageVersion.set(JavaLanguageVersion.of(25))
4747
}
4848
}
4949

@@ -53,6 +53,7 @@ tasks.withType(JavaCompile).configureEach {
5353
}
5454

5555
dependencies {
56+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // TODO: workaround for not finding junit: https://github.com/gradle/gradle/issues/34512
5657
testImplementation(platform("org.junit:junit-bom:5.10.0"))
5758
testImplementation("org.junit.jupiter:junit-jupiter")
5859
}

SwiftKitFFM/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ publishing {
4242

4343
java {
4444
toolchain {
45-
languageVersion.set(JavaLanguageVersion.of(24))
45+
languageVersion.set(JavaLanguageVersion.of(25))
4646
}
4747
}
4848

4949
dependencies {
5050
implementation(project(':SwiftKitCore'))
5151

52+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") // TODO: workaround for not finding junit: https://github.com/gradle/gradle/issues/34512
5253
testImplementation(platform("org.junit:junit-bom:5.10.0"))
5354
testImplementation("org.junit.jupiter:junit-jupiter")
5455
}

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ENV LANGUAGE=en_US.UTF-8
2020

2121
# JDK dependency
2222
RUN curl -s "https://get.sdkman.io" | bash
23-
RUN bash -c "source /root/.sdkman/bin/sdkman-init.sh && sdk install java 24.0.1-amzn"
23+
RUN bash -c "source /root/.sdkman/bin/sdkman-init.sh && sdk install java 25.0.1-amzn"
2424

2525
RUN curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
2626
tar zxf swiftly-$(uname -m).tar.gz && \

0 commit comments

Comments
 (0)