Skip to content

Commit fd66f9f

Browse files
Add support for Kotlin and Compose Maven artifacts (#34)
This changeset extends the plugin API to allow configuring dependencies to the Kotlin and Compose Maven artifacts.
1 parent 31373d6 commit fd66f9f

4 files changed

Lines changed: 70 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ A Gradle plug-in that provides convenience methods for adding JxBrowser dependen
66

77
```kotlin
88
plugins {
9-
id("com.teamdev.jxbrowser") version "1.0.1"
9+
id("com.teamdev.jxbrowser") version "1.0.2"
1010
}
1111

1212
jxbrowser {
1313
// The JxBrowser version. A mandatory field.
1414
// Obtain the latest release version number at https://teamdev.com/jxbrowser/.
15-
version = "7.36"
15+
version = "7.38.0"
1616

1717
// The location of JxBrowser repository to use. It's either North America or Europe.
1818
// If not specified, the location is set to North America.

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2222

2323
object BuildSettings {
2424
const val GROUP = "com.teamdev.jxbrowser"
25-
const val VERSION = "1.0.1"
26-
const val JXBROWSER_VERSION = "7.36"
25+
const val VERSION = "1.0.2"
26+
const val JXBROWSER_VERSION = "7.38.0"
2727
val javaVersion = JavaVersion.VERSION_1_8
2828
}
2929

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ public open class JxBrowserExtension(private val project: Project) {
7070
*/
7171
public val core: Provider<String> = artifact("core")
7272

73+
/**
74+
* Returns a dependency notation for the `jxbrowser-kotlin`,
75+
* an artifact with the Kotlin API of the library.
76+
*/
77+
public val kotlin: Provider<String> = artifact("kotlin")
78+
79+
/**
80+
* Returns a dependency notation for the `jxbrowser-compose`,
81+
* an artifact with Compose integration.
82+
*/
83+
public val compose: Provider<String> = artifact("compose")
84+
7385
/**
7486
* Returns a dependency notation for the `jxbrowser-javafx`,
7587
* an artifact with JavaFX integration.

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,60 @@ internal class JxBrowserPluginFunctionalTest {
125125
126126
tasks.register<Copy>("$taskName") {
127127
from(configurations.getByName("toCopy"))
128-
into("$libsFolder")
128+
into("${libsFolder.toString().replace("\\", "/")}")
129+
}
130+
""".trimIndent(),
131+
)
132+
133+
val result =
134+
GradleRunner.create()
135+
.withProjectDir(testProjectDir)
136+
.withPluginClasspath()
137+
.withArguments(taskName)
138+
.build()
139+
140+
result.outcome(":$taskName") shouldBe SUCCESS
141+
libsFolder.files() shouldContainExactlyInAnyOrder filesToCheck
142+
}
143+
144+
@Test
145+
fun `download JxBrowser 8 jars`() {
146+
val taskName = "downloadJars"
147+
val jxBrowserVersion = "8.0.0-eap.1"
148+
val filesToCheck =
149+
listOf(
150+
"jxbrowser-$jxBrowserVersion.jar",
151+
"jxbrowser-kotlin-$jxBrowserVersion.jar",
152+
"jxbrowser-compose-$jxBrowserVersion.jar",
153+
"jxbrowser-swing-$jxBrowserVersion.jar",
154+
)
155+
156+
buildFile.writeText(
157+
"""
158+
plugins {
159+
base
160+
id("com.teamdev.jxbrowser")
161+
}
162+
163+
jxbrowser {
164+
version = "$jxBrowserVersion"
165+
includePreviewBuilds()
166+
}
167+
168+
configurations {
169+
create("toCopy")
170+
}
171+
172+
dependencies {
173+
"toCopy"(jxbrowser.core)
174+
"toCopy"(jxbrowser.kotlin)
175+
"toCopy"(jxbrowser.compose)
176+
"toCopy"(jxbrowser.swing)
177+
}
178+
179+
tasks.register<Copy>("$taskName") {
180+
from(configurations.getByName("toCopy"))
181+
into("${libsFolder.toString().replace("\\", "/")}")
129182
}
130183
""".trimIndent(),
131184
)

0 commit comments

Comments
 (0)