Skip to content

Commit c0cff95

Browse files
authored
Merge pull request #97 from beehive-lab/feat/jdk25-n-tornadovm-upd
Add JDK 25 support with TornadoVM JDK25 and dual-JDK build profiles
2 parents 27b16a0 + 5b24ec4 commit c0cff95

File tree

6 files changed

+143
-18
lines changed

6 files changed

+143
-18
lines changed

.github/workflows/build-and-run.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
# Export for current shell session
7979
export TORNADOVM_HOME="$FULL_SDK"
8080
export PATH="$FULL_SDK/bin:$JAVA_HOME/bin:$PATH"
81-
81+
8282
# Save for subsequent steps
8383
echo "TORNADOVM_HOME=$FULL_SDK" >> $GITHUB_ENV
8484
echo "PATH=$PATH" >> $GITHUB_ENV

.github/workflows/deploy-maven-central.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ on:
2222

2323
jobs:
2424
deploy:
25-
name: Deploy to Maven Central
25+
name: Deploy to Maven Central (${{ matrix.jdk.name }})
2626
if: github.repository == 'beehive-lab/GPULlama3.java'
2727
runs-on: [self-hosted, Linux, x64]
2828
timeout-minutes: 15
29+
strategy:
30+
fail-fast: false # if one JDK fails, still attempt the other
31+
matrix:
32+
jdk:
33+
- name: jdk21
34+
java_home: /opt/jenkins/jdks/graal-23.1.0/jdk-21.0.3
35+
- name: jdk25
36+
java_home: /opt/jenkins/jdks/jdk-25.0.2
2937
env:
30-
JAVA_HOME: /opt/jenkins/jdks/graal-23.1.0/jdk-21.0.3
38+
JAVA_HOME: ${{ matrix.jdk.java_home }}
3139

3240
steps:
3341
- name: Checkout code
@@ -98,13 +106,15 @@ jobs:
98106
- name: Deployment Summary
99107
if: ${{ !inputs.dry_run }}
100108
run: |
101-
echo "## 🚀 Maven Central Deployment" >> $GITHUB_STEP_SUMMARY
109+
DEPLOYED_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null)
110+
echo "## 🚀 Maven Central Deployment (${{ matrix.jdk.name }})" >> $GITHUB_STEP_SUMMARY
102111
echo "" >> $GITHUB_STEP_SUMMARY
103112
echo "| Detail | Value |" >> $GITHUB_STEP_SUMMARY
104113
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
105-
echo "| Version | ${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
114+
echo "| JDK | ${{ matrix.jdk.name }} |" >> $GITHUB_STEP_SUMMARY
115+
echo "| Version | ${DEPLOYED_VERSION} |" >> $GITHUB_STEP_SUMMARY
106116
echo "| GroupId | io.github.beehive-lab |" >> $GITHUB_STEP_SUMMARY
107117
echo "| ArtifactId | gpu-llama3 |" >> $GITHUB_STEP_SUMMARY
108118
echo "| Status | ✅ Deployed |" >> $GITHUB_STEP_SUMMARY
109119
echo "" >> $GITHUB_STEP_SUMMARY
110-
echo "📍 [View on Maven Central](https://central.sonatype.com/artifact/io.github.beehive-lab/gpu-llama3/${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY
120+
echo "📍 [View on Maven Central](https://central.sonatype.com/artifact/io.github.beehive-lab/gpu-llama3/${DEPLOYED_VERSION})" >> $GITHUB_STEP_SUMMARY

.github/workflows/prepare-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ jobs:
6868

6969
- name: Update Maven version
7070
run: |
71-
./mvnw versions:set -DnewVersion=${{ env.VERSION }} -DgenerateBackupPoms=false
71+
# Update <revision> property directly; versions:set would overwrite
72+
# the CI-friendly ${revision}${jdk.version.suffix} expression.
73+
sed -i 's|<revision>.*</revision>|<revision>${{ env.VERSION }}</revision>|' pom.xml
7274
echo "✅ Maven version updated to ${{ env.VERSION }}"
7375
7476
- name: Update README.md
7577
run: |
7678
if [ -f "README.md" ]; then
77-
# Update version in Maven dependency example
79+
# Update version in Maven dependency examples (handles plain X.Y.Z and X.Y.Z-jdkNN suffixes)
7880
sed -i 's|<version>[0-9]\+\.[0-9]\+\.[0-9]\+</version>|<version>${{ env.VERSION }}</version>|g' README.md
81+
sed -i 's|<version>[0-9]\+\.[0-9]\+\.[0-9]\+-jdk[0-9]\+</version>|<version>${{ env.VERSION }}-jdk25</version>|g' README.md
7982
echo "✅ Updated README.md"
8083
fi
8184

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pom.xml.versionsBackup
66
pom.xml.next
77
release.properties
88
dependency-reduced-pom.xml
9+
.flattened-pom.xml
910
buildNumber.properties
1011
.mvn/timing.properties
1112
.mvn/wrapper/maven-wrapper.jar

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Despite being deprecated, OpenCL can still run on Apple Silicon; albeit, with ol
129129

130130
You can add **GPULlama3.java** directly to your Maven project by including the following dependency in your `pom.xml`:
131131

132+
**JDK 21:**
132133
```xml
133134
<dependency>
134135
<groupId>io.github.beehive-lab</groupId>
@@ -137,6 +138,15 @@ You can add **GPULlama3.java** directly to your Maven project by including the f
137138
</dependency>
138139
```
139140

141+
**JDK 25:**
142+
```xml
143+
<dependency>
144+
<groupId>io.github.beehive-lab</groupId>
145+
<artifactId>gpu-llama3</artifactId>
146+
<version>0.3.1-jdk25</version>
147+
</dependency>
148+
```
149+
140150
## ☕ Integration with Your Java Codebase or Tools
141151

142152
To integrate it into your codebase or IDE (e.g., IntelliJ) or custom build system (like IntelliJ, Maven, or Gradle), use the `--show-command` flag.

pom.xml

Lines changed: 111 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- Use your verified namespace -->
88
<groupId>io.github.beehive-lab</groupId>
99
<artifactId>gpu-llama3</artifactId>
10-
<version>0.3.3</version> <!-- release version (no -SNAPSHOT) -->
10+
<version>${revision}${jdk.version.suffix}</version>
1111

1212
<name>GPU Llama3</name>
1313
<description>GPU-accelerated LLaMA3 inference using TornadoVM</description>
@@ -37,6 +37,12 @@
3737
</scm>
3838

3939
<properties>
40+
<!-- CI-friendly version: resolved by flatten-maven-plugin at build time -->
41+
<revision>0.3.1</revision>
42+
<jdk.version.suffix></jdk.version.suffix> <!-- empty=JDK21, -jdk25=JDK25 -->
43+
<!-- TornadoVM version: overridden per JDK profile -->
44+
<tornadovm.version>3.0.0</tornadovm.version> <!-- JDK21 default -->
45+
<!-- Compiler defaults (overridden by JDK profiles below) -->
4046
<maven.compiler.source>21</maven.compiler.source>
4147
<maven.compiler.target>21</maven.compiler.target>
4248
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -54,31 +60,55 @@
5460
<dependency>
5561
<groupId>io.github.beehive-lab</groupId>
5662
<artifactId>tornado-api</artifactId>
57-
<version>2.2.0</version>
63+
<version>${tornadovm.version}</version>
5864
</dependency>
5965
<dependency>
6066
<groupId>io.github.beehive-lab</groupId>
6167
<artifactId>tornado-runtime</artifactId>
62-
<version>2.2.0</version>
68+
<version>${tornadovm.version}</version>
6369
</dependency>
6470
</dependencies>
6571

6672
<build>
6773
<plugins>
68-
<!-- Compiler -->
74+
<!-- Compiler: enable-preview for both JDKs.
75+
--add-modules jdk.incubator.vector is added per JDK profile (see below).
76+
The Vector API remains in jdk.incubator.vector on both JDK 21 and JDK 25
77+
(JEP 508 — 10th Incubator in JDK 25); the flag is required for all JDKs. -->
6978
<plugin>
7079
<groupId>org.apache.maven.plugins</groupId>
7180
<artifactId>maven-compiler-plugin</artifactId>
7281
<version>3.11.0</version>
7382
<configuration>
7483
<compilerArgs>
7584
<arg>--enable-preview</arg>
76-
<arg>--add-modules</arg>
77-
<arg>jdk.incubator.vector</arg>
7885
</compilerArgs>
7986
</configuration>
8087
</plugin>
8188

89+
<!-- Flatten: resolves ${revision}${jdk.version.suffix} in the published POM -->
90+
<plugin>
91+
<groupId>org.codehaus.mojo</groupId>
92+
<artifactId>flatten-maven-plugin</artifactId>
93+
<version>1.6.0</version>
94+
<configuration>
95+
<updatePomFile>true</updatePomFile>
96+
<flattenMode>resolveCiFriendliesOnly</flattenMode>
97+
</configuration>
98+
<executions>
99+
<execution>
100+
<id>flatten</id>
101+
<phase>process-resources</phase>
102+
<goals><goal>flatten</goal></goals>
103+
</execution>
104+
<execution>
105+
<id>flatten.clean</id>
106+
<phase>clean</phase>
107+
<goals><goal>clean</goal></goals>
108+
</execution>
109+
</executions>
110+
</plugin>
111+
82112
<!-- Shade (fat jar) -->
83113
<plugin>
84114
<groupId>org.apache.maven.plugins</groupId>
@@ -103,6 +133,72 @@
103133

104134
<!-- Profiles for optional/conditional builds -->
105135
<profiles>
136+
137+
<!-- ─── JDK 21 ───────────────────────────────────────────────────────────
138+
Auto-activates for JDK 21.x builds.
139+
Publishes: gpu-llama3:${revision} (no suffix)
140+
TornadoVM: 3.0.0
141+
Adds add-modules jdk.incubator.vector (still incubating in JDK21)
142+
─────────────────────────────────────────────────────────────────────── -->
143+
<profile>
144+
<id>jdk21</id>
145+
<activation><jdk>[21,25)</jdk></activation>
146+
<properties>
147+
<maven.compiler.source>21</maven.compiler.source>
148+
<maven.compiler.target>21</maven.compiler.target>
149+
<tornadovm.version>3.0.0</tornadovm.version>
150+
<jdk.version.suffix></jdk.version.suffix>
151+
</properties>
152+
<build>
153+
<plugins>
154+
<plugin>
155+
<groupId>org.apache.maven.plugins</groupId>
156+
<artifactId>maven-compiler-plugin</artifactId>
157+
<configuration>
158+
<!-- Appended to enable-preview already in main build -->
159+
<compilerArgs combine.children="append">
160+
<arg>--add-modules</arg>
161+
<arg>jdk.incubator.vector</arg>
162+
</compilerArgs>
163+
</configuration>
164+
</plugin>
165+
</plugins>
166+
</build>
167+
</profile>
168+
169+
<!-- ─── JDK 25 ───────────────────────────────────────────────────────────
170+
Auto-activates for JDK 25.0.2+ builds (minimum required version).
171+
Publishes: gpu-llama3:${revision}-jdk25
172+
TornadoVM: 3.0.0-jdk25
173+
Vector API is still incubating in JDK 25 (JEP 508 — 10th Incubator);
174+
--add-modules jdk.incubator.vector is required for compilation.
175+
─────────────────────────────────────────────────────────────────────── -->
176+
<profile>
177+
<id>jdk25</id>
178+
<activation><jdk>[25.0.2,)</jdk></activation>
179+
<properties>
180+
<maven.compiler.source>25</maven.compiler.source>
181+
<maven.compiler.target>25</maven.compiler.target>
182+
<tornadovm.version>3.0.0-jdk25</tornadovm.version>
183+
<jdk.version.suffix>-jdk25</jdk.version.suffix>
184+
</properties>
185+
<build>
186+
<plugins>
187+
<plugin>
188+
<groupId>org.apache.maven.plugins</groupId>
189+
<artifactId>maven-compiler-plugin</artifactId>
190+
<configuration>
191+
<!-- Appended to enable-preview already in main build -->
192+
<compilerArgs combine.children="append">
193+
<arg>--add-modules</arg>
194+
<arg>jdk.incubator.vector</arg>
195+
</compilerArgs>
196+
</configuration>
197+
</plugin>
198+
</plugins>
199+
</build>
200+
</profile>
201+
106202
<profile>
107203
<id>release</id>
108204
<properties>
@@ -126,20 +222,25 @@
126222
</executions>
127223
</plugin>
128224

129-
<!-- Javadocs with preview feature support -->
225+
<!-- Javadocs with preview feature support.
226+
--add-modules jdk.incubator.vector is required on all currently
227+
supported JDKs (21 and 25) because the Vector API remains in the
228+
incubator module (JEP 508 — 10th Incubator in JDK 25). -->
130229
<plugin>
131230
<groupId>org.apache.maven.plugins</groupId>
132231
<artifactId>maven-javadoc-plugin</artifactId>
133232
<version>3.6.3</version>
134233
<configuration>
135-
<source>21</source>
136-
<release>21</release>
234+
<source>${maven.compiler.source}</source>
235+
<release>${maven.compiler.source}</release>
137236
<additionalJOptions>
138237
<additionalJOption>--enable-preview</additionalJOption>
139-
<additionalJOption>--add-modules=jdk.incubator.vector</additionalJOption>
238+
<additionalJOption>--add-modules</additionalJOption>
239+
<additionalJOption>jdk.incubator.vector</additionalJOption>
140240
</additionalJOptions>
141241
<additionalOptions>
142242
<additionalOption>--enable-preview</additionalOption>
243+
<additionalOption>--add-modules jdk.incubator.vector</additionalOption>
143244
</additionalOptions>
144245
<failOnError>false</failOnError>
145246
<failOnWarnings>false</failOnWarnings>

0 commit comments

Comments
 (0)