diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 24a3d74..84c8886 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,7 +37,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: adopt - java-version: 16 + java-version: 17 - name: Setup Gradle uses: gradle/gradle-build-action@v2 diff --git a/build.gradle.kts b/build.gradle.kts index def9531..ba90099 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `kotlin-dsl` `maven-publish` - id("org.jmailen.kotlinter") + id("org.jlleitschuh.gradle.ktlint") id("io.gitlab.arturbosch.detekt") id("org.jetbrains.dokka") id("com.gradle.plugin-publish") @@ -18,7 +18,7 @@ group = "dev.mythicdrops" java { toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) + languageVersion.set(JavaLanguageVersion.of(17)) } withJavadocJar() withSourcesJar() @@ -132,7 +132,7 @@ dependencies { implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:_") // ktlint plugin - implementation("org.jmailen.gradle:kotlinter-gradle:_") + implementation("org.jlleitschuh.gradle:ktlint-gradle:_") // gradle nexus publish plugin implementation("io.github.gradle-nexus:publish-plugin:_") diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt index 85cbda6..15031a0 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt @@ -13,17 +13,19 @@ import org.gradle.testing.jacoco.plugins.JacocoPlugin import org.gradle.testing.jacoco.plugins.JacocoPluginExtension import org.gradle.testing.jacoco.tasks.JacocoReport +val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_17 + /** - * Plugin that configures Java for JDK 16 and enables JaCoCo. + * Plugin that configures Java for JDK 17 and enables JaCoCo. */ open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") { override fun configureProject(target: Project) { val javaExtension = target.extensions.create("mythicDropsJava") javaExtension.apply { - javaVersion.convention(JavaVersion.VERSION_16) + // default to Java 17 + javaVersion.convention(DEFAULT_JAVA_VERSION) } - // target JDK 16 target.configure { toolchain { languageVersion.set(JavaLanguageVersion.of(javaExtension.javaVersion.get().majorVersion)) @@ -40,7 +42,7 @@ open class MythicDropsJavaPlugin : DependentPlugin("Java", "java") { // enable and configure JaCoCo target.pluginManager.apply(JacocoPlugin::class.java) target.configure { - toolVersion = "0.8.7" + toolVersion = "0.8.8" } target.tasks.withType { reports { diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt index 8692e57..d642acc 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt @@ -12,24 +12,24 @@ import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jetbrains.kotlin.konan.file.File -import org.jmailen.gradle.kotlinter.KotlinterPlugin -import org.jmailen.gradle.kotlinter.tasks.FormatTask -import org.jmailen.gradle.kotlinter.tasks.LintTask +import org.jlleitschuh.gradle.ktlint.KtlintExtension +import org.jlleitschuh.gradle.ktlint.KtlintPlugin /** - * Plugin that configures Kotlin for JDK 16, enables Detekt, and enables/configures KTLint to use 0.46.0. + * Plugin that configures Kotlin for JDK 17, enables Detekt, and enables/configures KTLint to use 0.48.1. */ open class MythicDropsKotlinJvmPlugin : DependentPlugin("Kotlin JVM", "org.jetbrains.kotlin.jvm") { override fun configureProject(target: Project) { - val javaExtension = target.extensions.getByType() + val javaExtension = + target.extensions.getByType().apply { + javaVersion.convention(DEFAULT_JAVA_VERSION) + } // apply plugins target.pluginManager.apply(DetektPlugin::class.java) target.pluginManager.apply(DokkaPlugin::class.java) - target.pluginManager.apply(KotlinterPlugin::class.java) + target.pluginManager.apply(KtlintPlugin::class.java) - // configure kotlin to use JDK 16 target.configure { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(javaExtension.javaVersion.get().majorVersion)) @@ -37,11 +37,12 @@ open class MythicDropsKotlinJvmPlugin : DependentPlugin("Kotlin JVM", "org.jetbr } // exclude files from the build directory from being linted or formatted - target.tasks.withType { - exclude { fte -> fte.file.absolutePath.contains("${File.separator}build${File.separator}") } - } - target.tasks.withType { - exclude { fte -> fte.file.absolutePath.contains("${File.separator}build${File.separator}") } + target.configure { + // ktlint version that supports kotlin 1.8.0 + version.set("0.48.1") + filter { + exclude("**/build/**") + } } target.tasks.withType { diff --git a/version.properties b/version.properties index b020187..2173dcb 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=3.3.* +version=4.0.* diff --git a/versions.properties b/versions.properties index bb33cac..20d780d 100644 --- a/versions.properties +++ b/versions.properties @@ -13,7 +13,7 @@ plugin.io.gitlab.arturbosch.detekt=1.22.0 plugin.org.jetbrains.dokka=1.7.20 -plugin.org.jmailen.kotlinter=3.12.0 +plugin.org.jlleitschuh.gradle.ktlint=11.2.0 plugin.org.shipkit.shipkit-auto-version=1.2.2 @@ -33,11 +33,11 @@ version.org.jetbrains.dokka..dokka-core=1.7.20 version.org.jetbrains.dokka..dokka-gradle-plugin=1.7.20 -version.com.netflix.nebula..nebula-project-plugin=10.0.1 +version.com.netflix.nebula..nebula-project-plugin=10.1.2 version.io.gitlab.arturbosch.detekt..detekt-gradle-plugin=1.22.0 -version.org.jmailen.gradle..kotlinter-gradle=3.12.0 +version.org.jlleitschuh.gradle..ktlint-gradle=11.2.0 version.io.github.gradle-nexus..publish-plugin=1.1.0