diff --git a/build.gradle.kts b/build.gradle.kts index 200e74d..fd3f0e7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -68,6 +68,13 @@ gradlePlugin { implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJavaPlatformPlugin" tags.set(listOf("kotlin", "pixeloutlaw", "convention")) } + create("mythicDropsConventionJvmTestSuite") { + id = "dev.mythicdrops.gradle.convention.jvm-test-suite" + displayName = "mythicDropsGradleConventionJvmSuite" + description = "Common conventions for all MythicDrops JVM Test Suite Gradle projects." + implementationClass = "dev.mythicdrops.gradle.conventions.MythicDropsJvmTestSuitePlugin" + tags.set(listOf("kotlin", "pixeloutlaw", "convention")) + } create("mythicDropsConventionKotlinJvm") { id = "dev.mythicdrops.gradle.convention.kotlin.jvm" displayName = "mythicDropsGradleConventionKotlinJvm" @@ -93,6 +100,18 @@ tasks { from(dokkaJavadoc) } + // use JUnit Jupiter + withType { + useJUnitPlatform() + } + + withType { + compilerOptions { + apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0) + languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0) + } + } + getByName("generateChangelog") { dependsOn( "compileJava", @@ -107,9 +126,18 @@ tasks { ) } - // use JUnit Jupiter - withType { - useJUnitPlatform() + // Make GitHub release depend on generating a changelog + val generateChangelog = getByName("generateChangelog") { + previousRevision = project.ext.get("shipkit-auto-version.previous-tag")?.toString() + githubToken = System.getenv("GITHUB_TOKEN") + repository = "MythicDrops/mythicdrops-gradle-plugin" + } + getByName("githubRelease") { + dependsOn(generateChangelog) + repository = generateChangelog.repository + changelog = generateChangelog.outputFile + githubToken = System.getenv("GITHUB_TOKEN") + newTagRevision = System.getenv("GITHUB_SHA") } } @@ -152,19 +180,5 @@ dependencies { implementation("org.kohsuke:github-api:_") } -val generateChangelog = tasks.getByName("generateChangelog") { - previousRevision = project.ext.get("shipkit-auto-version.previous-tag")?.toString() - githubToken = System.getenv("GITHUB_TOKEN") - repository = "MythicDrops/mythicdrops-gradle-plugin" -} - -tasks.getByName("githubRelease") { - dependsOn(generateChangelog) - repository = generateChangelog.repository - changelog = generateChangelog.outputFile - githubToken = System.getenv("GITHUB_TOKEN") - newTagRevision = System.getenv("GITHUB_SHA") -} - project.ext.set("gradle.publish.key", System.getenv("GRADLE_PUBLISH_KEY")) project.ext.set("gradle.publish.secret", System.getenv("GRADLE_PUBLISH_SECRET")) diff --git a/gradle.properties b/gradle.properties index e236e3e..25fac37 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ kotlin.code.style=official org.gradle.console=plain +kotlin.experimental.tryK2=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9b0a13f..03bc515 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 8a4c24f..fdb729e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,7 +6,7 @@ pluginManagement { plugins { // See https://jmfayard.github.io/refreshVersions - id("de.fayard.refreshVersions") version "0.60.1" + id("de.fayard.refreshVersions") version "0.60.2" id("com.gradle.enterprise") version "3.14.1" } diff --git a/src/main/kotlin/dev/mythicdrops/gradle/MythicDropsPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/MythicDropsPlugin.kt index 12fc8a3..4eb1115 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/MythicDropsPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/MythicDropsPlugin.kt @@ -2,6 +2,7 @@ package dev.mythicdrops.gradle import dev.mythicdrops.gradle.conventions.MythicDropsJavaPlatformPlugin import dev.mythicdrops.gradle.conventions.MythicDropsJavaPlugin +import dev.mythicdrops.gradle.conventions.MythicDropsJvmTestSuitePlugin import dev.mythicdrops.gradle.conventions.MythicDropsKotlinJvmPlugin import dev.mythicdrops.gradle.conventions.MythicDropsMavenPublishPlugin import dev.mythicdrops.gradle.projects.MythicDropsBasePlugin @@ -28,6 +29,7 @@ open class MythicDropsPlugin : Plugin { pluginManager.apply(MythicDropsBasePlugin::class) pluginManager.apply(MythicDropsJavaPlugin::class) pluginManager.apply(MythicDropsJavaPlatformPlugin::class) + pluginManager.apply(MythicDropsJvmTestSuitePlugin::class) pluginManager.apply(MythicDropsKotlinJvmPlugin::class) pluginManager.apply(MythicDropsMavenPublishPlugin::class) } diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlatformPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlatformPlugin.kt index 24662f1..18b8a49 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlatformPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlatformPlugin.kt @@ -9,7 +9,7 @@ import org.gradle.kotlin.dsl.withType /** * Plugin that configures Maven publications for Java Platforms. */ -open class MythicDropsJavaPlatformPlugin : DependentPlugin("Java", "java-platform") { +open class MythicDropsJavaPlatformPlugin : DependentPlugin("Java Platform", "java-platform") { override fun configureProject(target: Project) { target.pluginManager.withPlugin("maven-publish") { target.extensions.getByType().publications.withType { diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt index 47adfad..130383c 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt @@ -19,8 +19,7 @@ val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_17 */ open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") { override fun configureProject(target: Project) { - val javaExtension = target.extensions.create("mythicDropsJava") - javaExtension.apply { + val javaExtension = target.extensions.create("mythicDropsJava").apply { // default to Java 17 javaVersion.convention(DEFAULT_JAVA_VERSION) } @@ -34,7 +33,7 @@ open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") { // enable and configure JaCoCo target.pluginManager.apply(JacocoPlugin::class.java) target.configure { - toolVersion = "0.8.8" + toolVersion = "0.8.10" } target.tasks.withType { reports { diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJvmTestSuitePlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJvmTestSuitePlugin.kt new file mode 100644 index 0000000..c5ba42a --- /dev/null +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJvmTestSuitePlugin.kt @@ -0,0 +1,21 @@ +package dev.mythicdrops.gradle.conventions + +import org.gradle.api.Project +import org.gradle.api.plugins.jvm.JvmTestSuite +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.withType +import org.gradle.testing.base.TestingExtension + +/** + * Plugin that configures the base JVM Test Suite to use JUnit Jupiter. + */ +open class MythicDropsJvmTestSuitePlugin : DependentPlugin("JVM Test Suite", "org.gradle.jvm-test-suite") { + @Suppress("UnstableApiUsage") + override fun configureProject(target: Project) { + target.configure { + suites.withType { + useJUnitJupiter() + } + } + } +} diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt index aa3391f..7879726 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt @@ -24,8 +24,7 @@ open class MythicDropsKotlinJvmPlugin : DependentPlugin("Kotlin JVM", "org.jetbr // exclude files from the build directory from being linted or formatted target.configure { - // ktlint version that supports kotlin 1.8.0 - version.set("0.48.2") + version.set("0.50.0") filter { exclude { entry -> entry.file.toString().contains("generated") diff --git a/src/main/kotlin/dev/mythicdrops/gradle/projects/MythicDropsBasePlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/projects/MythicDropsBasePlugin.kt index adc310e..120222e 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/projects/MythicDropsBasePlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/projects/MythicDropsBasePlugin.kt @@ -6,9 +6,7 @@ import com.adarshr.gradle.testlogger.theme.ThemeType import nebula.plugin.responsible.NebulaResponsiblePlugin import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.tasks.testing.Test import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.withType /** * Plugin that applies sensible defaults to all projects. Intended for use on root and subprojects. @@ -31,10 +29,5 @@ open class MythicDropsBasePlugin : Plugin { showSkippedStandardStreams = false showPassedStandardStreams = false } - - // make tests use JUnit Jupiter - target.tasks.withType() { - useJUnitPlatform() - } } } diff --git a/version.properties b/version.properties index 2ac630f..2daab6d 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=5.4.* +version=6.0.* diff --git a/versions.properties b/versions.properties index 1bdce1b..6b573cf 100644 --- a/versions.properties +++ b/versions.properties @@ -1,5 +1,5 @@ #### Dependencies and Plugin versions with their available updates. -#### Generated by `./gradlew refreshVersions` version 0.60.1 +#### Generated by `./gradlew refreshVersions` version 0.60.2 #### #### Don't manually edit or split the comments that start with four hashtags (####), #### they will be overwritten by refreshVersions. @@ -11,7 +11,7 @@ plugin.com.gradle.plugin-publish=1.2.1 plugin.io.gitlab.arturbosch.detekt=1.23.1 -plugin.org.jetbrains.dokka=1.8.20 +plugin.org.jetbrains.dokka=1.9.0 plugin.org.jlleitschuh.gradle.ktlint=11.5.1 @@ -29,9 +29,9 @@ version.org.shipkit..shipkit-changelog=1.2.0 version.com.adarshr..gradle-test-logger-plugin=3.2.0 -version.org.jetbrains.dokka..dokka-core=1.8.20 +version.org.jetbrains.dokka..dokka-core=1.9.0 -version.org.jetbrains.dokka..dokka-gradle-plugin=1.8.20 +version.org.jetbrains.dokka..dokka-gradle-plugin=1.9.0 version.com.netflix.nebula..nebula-project-plugin=10.1.5