Skip to content

Commit 1e5ceae

Browse files
Add GraalVM Native Image artifact support (#162)
This PR adds support for `jxbrowser-native-image`. Issue: TeamDev-IP/JxBrowser#4899 --------- Co-authored-by: Vladyslav Lubenskyi <vladyslav.lubenskyi@teamdev.com>
1 parent d1342f1 commit 1e5ceae

4 files changed

Lines changed: 25 additions & 9 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2323
object BuildSettings {
2424
const val GROUP = "com.teamdev.jxbrowser"
2525
const val VERSION = "2.0.0"
26-
const val JXBROWSER_VERSION = "8.18.3"
26+
const val JXBROWSER_VERSION = "9.0.0"
2727
val javaVersion = JavaVersion.VERSION_1_8
2828
}
2929

src/main/kotlin/com/teamdev/jxbrowser/gradle/JxBrowserExtension.kt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ public open class JxBrowserExtension(
8787
* Returns a dependency notation for the `jxbrowser-kotlin`,
8888
* an artifact with the Kotlin API of the library.
8989
*
90-
* Kotlin API is only supported in JxBrowser 8.x.x.
90+
* Kotlin API is only supported in JxBrowser 8.x.x and newer.
9191
*/
9292
public val kotlin: Provider<String> = artifact("kotlin")
9393

9494
/**
9595
* Returns a dependency notation for the `jxbrowser-compose`,
9696
* an artifact with Compose integration.
9797
*
98-
* Compose is only supported in JxBrowser 8.x.x.
98+
* Compose is only supported in JxBrowser 8.x.x and newer.
9999
*/
100100
public val compose: Provider<String> = artifact("compose")
101101

@@ -117,6 +117,14 @@ public open class JxBrowserExtension(
117117
*/
118118
public val swt: Provider<String> = artifact("swt")
119119

120+
/**
121+
* Returns a dependency notation for the `jxbrowser-native-image`,
122+
* an artifact containing GraalVM Native Image reachability metadata.
123+
*
124+
* Native images are only supported in JxBrowser 9.x.x and newer.
125+
*/
126+
public val nativeImage: Provider<String> = artifact("native-image")
127+
120128
/**
121129
* Returns a dependency notation for the `jxbrowser-win64`,
122130
* an artifact with Chromium Windows 64-bit binaries.
@@ -210,12 +218,6 @@ public open class JxBrowserExtension(
210218
shortName: String,
211219
version: String,
212220
) {
213-
val artifactNameToReleaseVersion =
214-
mapOf(
215-
"compose" to "8.0.0",
216-
"kotlin" to "8.0.0",
217-
"win64-arm" to "8.0.0",
218-
)
219221
val artifactReleaseVersion = artifactNameToReleaseVersion[shortName]
220222
if (artifactReleaseVersion != null) {
221223
val releaseVersion = Semver(artifactReleaseVersion)
@@ -228,5 +230,16 @@ public open class JxBrowserExtension(
228230

229231
private companion object {
230232
private const val GROUP = "com.teamdev.jxbrowser"
233+
234+
/**
235+
* Maps an artifact short name to the first JxBrowser version that supports it.
236+
*/
237+
private val artifactNameToReleaseVersion =
238+
mapOf(
239+
"compose" to "9.0.0",
240+
"kotlin" to "9.0.0",
241+
"win64-arm" to "9.0.0",
242+
"native-image" to "9.0.0",
243+
)
231244
}
232245
}

src/test/kotlin/com/teamdev/jxbrowser/gradle/JxBrowserPluginFunctionalTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ internal class JxBrowserPluginFunctionalTest {
9999
"jxbrowser-kotlin-$jxBrowserVersion.jar",
100100
"jxbrowser-compose-$jxBrowserVersion.jar",
101101
"jxbrowser-win64-arm-$jxBrowserVersion.jar",
102+
"jxbrowser-native-image-$jxBrowserVersion.jar",
102103
)
103104
buildFile.writeText(
104105
"""
@@ -129,6 +130,7 @@ internal class JxBrowserPluginFunctionalTest {
129130
"toCopy"(jxbrowser.kotlin)
130131
"toCopy"(jxbrowser.compose)
131132
"toCopy"(jxbrowser.winArm)
133+
"toCopy"(jxbrowser.nativeImage)
132134
}
133135
134136
tasks.register<Copy>("$taskName") {

src/test/kotlin/com/teamdev/jxbrowser/gradle/JxBrowserPluginTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ internal class JxBrowserPluginTest {
7070
compose.get() shouldBe "$group:jxbrowser-compose:$jxBrowserVersion"
7171
linux64.get() shouldBe "$group:jxbrowser-linux64:$jxBrowserVersion"
7272
linuxArm.get() shouldBe "$group:jxbrowser-linux64-arm:$jxBrowserVersion"
73+
nativeImage.get() shouldBe "$group:jxbrowser-native-image:$jxBrowserVersion"
7374
crossPlatform.get() shouldBe "$group:jxbrowser-cross-platform:$jxBrowserVersion"
7475
}
7576
}

0 commit comments

Comments
 (0)