Skip to content

Commit 8c4ca36

Browse files
authored
Merge pull request #19 from dwursteisen/main
Bump Gradle / Kotlin / JVM target / other libs to the latest version
2 parents 9195ce6 + 893392c commit 8c4ca36

24 files changed

+369
-303
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ jobs:
1212
- name: Validate Gradle Wrapper
1313
uses: gradle/wrapper-validation-action@v1
1414
- name: Cache gradle
15-
uses: actions/cache@v1
15+
uses: actions/cache@v3
1616
with:
1717
path: ~/.gradle/caches
1818
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
19-
- name: Set up JDK 11
19+
- name: Set up JDK 17
2020
uses: actions/setup-java@v1
2121
with:
22-
java-version: 11
22+
java-version: 17
2323
- name: build
2424
run: ./gradlew build
2525

2626
env:
27-
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
27+
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

.github/workflows/publish-release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ jobs:
1414
- name: Validate Gradle Wrapper
1515
uses: gradle/wrapper-validation-action@v1
1616
- name: Cache gradle
17-
uses: actions/cache@v1
17+
uses: actions/cache@v3
1818
with:
1919
path: ~/.gradle/caches
20-
- name: Set up JDK 11
20+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
21+
- name: Set up JDK 17
2122
uses: actions/setup-java@v1
2223
with:
23-
java-version: 11
24+
java-version: 17
2425
- name: build
2526
run: ./gradlew publishPlugins -Pversion="${{github.event.release.tag_name}}" -Dgradle.publish.key=${{secrets.GRADLE_PUBLISH_KEY}} -Dgradle.publish.secret=${{secrets.GRADLE_PUBLISH_SECRET}}
2627

2728
env:
28-
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
29+
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

developer-plugin/build.gradle.kts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
@Suppress("DSL_SCOPE_VIOLATION")
@@ -36,6 +37,8 @@ dependencies {
3637
implementation(libs.jdoctor.core)
3738
implementation(libs.jdoctor.utils)
3839

40+
implementation(libs.publish.on.central.plugin)
41+
3942
// Use the Kotlin test library.
4043
testImplementation(libs.bundles.test)
4144
}
@@ -94,7 +97,7 @@ tasks.check {
9497
dependsOn(functionalTest)
9598
}
9699

97-
val javaVersion = JavaLanguageVersion.of(11)
100+
val javaVersion = JavaLanguageVersion.of(17)
98101
java {
99102
toolchain {
100103
languageVersion.set(javaVersion)
@@ -108,7 +111,9 @@ kotlin {
108111
}
109112

110113
project.tasks.withType(KotlinCompile::class.java).configureEach {
111-
kotlinOptions.jvmTarget = "11"
114+
compilerOptions {
115+
jvmTarget.set(JvmTarget.JVM_17)
116+
}
112117
val toolchainService = project.extensions.getByType(JavaToolchainService::class.java)
113118
kotlinJavaToolchain.toolchain.use(
114119
toolchainService.launcherFor {
@@ -117,8 +122,17 @@ project.tasks.withType(KotlinCompile::class.java).configureEach {
117122
)
118123
}
119124

120-
// Ensure "org.gradle.jvm.version" is set to "11" in Gradle metadata.
125+
// Ensure "org.gradle.jvm.version" is set to "17" in Gradle metadata.
121126
project.tasks.withType(JavaCompile::class.java).configureEach {
122-
sourceCompatibility = JavaVersion.VERSION_11.toString()
123-
targetCompatibility = JavaVersion.VERSION_11.toString()
127+
sourceCompatibility = JavaVersion.VERSION_17.toString()
128+
targetCompatibility = JavaVersion.VERSION_17.toString()
124129
}
130+
131+
testing.suites {
132+
withType<JvmTestSuite>().configureEach {
133+
useJUnitJupiter()
134+
dependencies {
135+
implementation(gradleTestKit())
136+
}
137+
}
138+
}

developer-plugin/src/functionalTest/kotlin/com/github/minigdx/gradle/plugin/MinigdxDeveloperPluginFunctionalTest.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ package com.github.minigdx.gradle.plugin
55

66
import org.gradle.testkit.runner.GradleRunner
77
import org.gradle.testkit.runner.TaskOutcome
8-
import org.junit.Rule
9-
import org.junit.rules.TemporaryFolder
8+
import org.junit.jupiter.api.io.TempDir
9+
import java.io.File
1010
import kotlin.test.Test
1111
import kotlin.test.assertEquals
1212
import kotlin.test.assertTrue
@@ -15,13 +15,12 @@ import kotlin.test.assertTrue
1515
* A simple functional test for the 'com.github.minigdx.gradle.plugin.greeting' plugin.
1616
*/
1717
class MinigdxDeveloperPluginFunctionalTest {
18-
19-
@get:Rule
20-
val temporaryFolder: TemporaryFolder = TemporaryFolder()
18+
@TempDir
19+
lateinit var temporaryFolder: File
2120

2221
@Test fun `can create github workflow`() {
2322
// Setup the test build
24-
val projectDir = temporaryFolder.newFolder("build", "functionalTest")
23+
val projectDir = File(temporaryFolder, "build/functionalTest")
2524
projectDir.mkdirs()
2625
projectDir.resolve("settings.gradle").writeText("""
2726
plugins {
@@ -51,7 +50,7 @@ class MinigdxDeveloperPluginFunctionalTest {
5150

5251
@Test fun `can create makefile`() {
5352
// Setup the test build
54-
val projectDir = temporaryFolder.newFolder("build", "functionalTest")
53+
val projectDir = File(temporaryFolder, "build/functionalTest")
5554
projectDir.mkdirs()
5655
projectDir.resolve("settings.gradle").writeText("""
5756
plugins {

developer-plugin/src/functionalTest/kotlin/com/github/minigdx/gradle/plugin/MinigdxKotlinJvmPluginFunctionalTest.kt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ package com.github.minigdx.gradle.plugin
55

66
import org.gradle.testkit.runner.GradleRunner
77
import org.gradle.testkit.runner.TaskOutcome
8-
import org.junit.Rule
9-
import org.junit.rules.TemporaryFolder
10-
import kotlin.test.Test
8+
import org.junit.jupiter.api.Test
9+
import org.junit.jupiter.api.io.TempDir
10+
import java.io.File
1111
import kotlin.test.assertEquals
1212
import kotlin.test.assertTrue
1313

@@ -16,14 +16,12 @@ import kotlin.test.assertTrue
1616
*/
1717
class MinigdxKotlinJvmPluginFunctionalTest {
1818

19-
@get:Rule
20-
val temporaryFolder: TemporaryFolder = TemporaryFolder()
19+
@TempDir
20+
lateinit var projectDir: File
2121

2222
@Test
2323
fun `can build`() {
2424
// Setup the test build
25-
val projectDir = temporaryFolder.newFolder("build", "functionalTest")
26-
projectDir.mkdirs()
2725
projectDir.resolve("settings.gradle").writeText("""
2826
plugins {
2927
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
@@ -40,7 +38,8 @@ plugins {
4038
// Run the build
4139
val result = GradleRunner.create()
4240
.forwardOutput()
43-
.withPluginClasspath().withArguments("build")
41+
.withPluginClasspath()
42+
.withArguments("build")
4443
.withProjectDir(projectDir)
4544
.build()
4645

@@ -51,8 +50,6 @@ plugins {
5150
@Test
5251
fun `can build with configuration cache`() {
5352
// Setup the test build
54-
val projectDir = temporaryFolder.newFolder("build", "functionalTest")
55-
projectDir.mkdirs()
5653
projectDir.resolve("settings.gradle").writeText("""
5754
plugins {
5855
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
@@ -66,19 +63,23 @@ plugins {
6663
"""
6764
)
6865

69-
// Run the build
66+
// Run the build (first run to populate cache)
7067
GradleRunner.create()
7168
.forwardOutput()
72-
.withPluginClasspath().withArguments("build", "--configuration-cache")
69+
.withPluginClasspath()
70+
.withArguments("build", "--configuration-cache")
7371
.withProjectDir(projectDir)
7472
.build()
73+
74+
// Run the build again and check for cache reuse
7575
val result = GradleRunner.create()
7676
.forwardOutput()
77-
.withPluginClasspath().withArguments("build", "--configuration-cache")
77+
.withPluginClasspath()
78+
.withArguments("build", "--configuration-cache")
7879
.withProjectDir(projectDir)
7980
.build()
8081

8182
// Verify the result
8283
assertTrue(result.output.contains("Reusing configuration cache."))
8384
}
84-
}
85+
}

developer-plugin/src/functionalTest/kotlin/com/github/minigdx/gradle/plugin/MinigdxKotlinMppPluginFunctionalTest.kt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ package com.github.minigdx.gradle.plugin
55

66
import org.gradle.testkit.runner.GradleRunner
77
import org.gradle.testkit.runner.TaskOutcome
8-
import org.junit.Ignore
9-
import org.junit.Rule
10-
import org.junit.rules.TemporaryFolder
11-
import kotlin.test.Test
8+
import org.junit.jupiter.api.Disabled
9+
import org.junit.jupiter.api.Test
10+
import org.junit.jupiter.api.io.TempDir
11+
import java.io.File
1212
import kotlin.test.assertEquals
1313
import kotlin.test.assertTrue
1414

@@ -17,13 +17,15 @@ import kotlin.test.assertTrue
1717
*/
1818
class MinigdxKotlinMppPluginFunctionalTest {
1919

20-
@get:Rule
21-
val temporaryFolder: TemporaryFolder = TemporaryFolder()
20+
@TempDir
21+
lateinit var projectDir: File
2222

23-
@Test fun `can build`() {
23+
@Test
24+
fun `can build`() {
2425
// Setup the test build
25-
val projectDir = temporaryFolder.newFolder("build", "functionalTest")
26-
projectDir.mkdirs()
26+
val buildDir = projectDir.resolve("build")
27+
val functionalTestDir = projectDir.resolve("functionalTest")
28+
functionalTestDir.mkdirs()
2729
projectDir.resolve("settings.gradle").writeText("""
2830
plugins {
2931
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
@@ -48,11 +50,9 @@ plugins {
4850
}
4951

5052
@Test
51-
@Ignore("Configuration Cache not yet supported by Kotlin Multiplatform")
53+
@Disabled("Configuration Cache not yet supported by Kotlin Multiplatform")
5254
fun `can build with configuration cache`() {
5355
// Setup the test build
54-
val projectDir = temporaryFolder.newFolder("build", "functionalTest")
55-
projectDir.mkdirs()
5656
projectDir.resolve("settings.gradle").writeText("""
5757
plugins {
5858
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
@@ -64,22 +64,23 @@ plugins {
6464
}
6565
""")
6666

67-
// Run the build
67+
// Run the build (first run to populate cache)
6868
GradleRunner.create()
6969
.forwardOutput()
7070
.withPluginClasspath()
7171
.withArguments("build", "--configuration-cache")
7272
.withProjectDir(projectDir)
7373
.build()
7474

75+
// Run the build again and check for cache reuse
7576
val result = GradleRunner.create()
76-
.forwardOutput()
77-
.withPluginClasspath()
78-
.withArguments("build", "--configuration-cache")
79-
.withProjectDir(projectDir)
80-
.build()
77+
.forwardOutput()
78+
.withPluginClasspath()
79+
.withArguments("build", "--configuration-cache")
80+
.withProjectDir(projectDir)
81+
.build()
8182

8283
// Verify the result
8384
assertTrue(result.output.contains("Reusing configuration cache."))
8485
}
85-
}
86+
}

developer-plugin/src/main/kotlin/com/github/minigdx/gradle/plugin/MiniGdxDeveloperExtension.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ open class MiniGdxDeveloperExtension(private val project: Project) {
6565
companion object {
6666

6767
val IOS_MPP_PROPERTY = "minigdx.mpp.ios"
68+
val WASM_MPP_PROPERTY = "minigdx.mpp.wasm"
6869
val K2_MPP_PROPERTY = "minigdx.mpp.k2"
6970
val KTLINT_PROPERTY = "mnigdx.ktlint"
71+
val DOKKA_SKIP_PROPERTY = "minigdx.dokka.skip"
7072
}
7173
}
7274

0 commit comments

Comments
 (0)