From 64d3108597ebafd0ece71cd97ddbd69aac7b5879 Mon Sep 17 00:00:00 2001 From: Jeremy Mailen Date: Thu, 12 Dec 2024 14:25:34 -0800 Subject: [PATCH] Load ktlint dependency always when Kotlinter applied (#425) Before we only add the dependency configuration when a compatible kotlin plug is detected which doesn't work for projects with only custom kotlinter tasks. Fixes #423 --- README.md | 8 ++++---- build.gradle.kts | 2 +- .../org/jmailen/gradle/kotlinter/KotlinterPlugin.kt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ba59601..89fee40 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Available on the Gradle Plugins Portal: https://plugins.gradle.org/plugin/org.jm ```kotlin plugins { - id("org.jmailen.kotlinter") version "5.0.0" + id("org.jmailen.kotlinter") version "5.0.1" } ``` @@ -36,7 +36,7 @@ plugins { ```groovy plugins { - id "org.jmailen.kotlinter" version "5.0.0" + id "org.jmailen.kotlinter" version "5.0.1" } ``` @@ -50,7 +50,7 @@ Root `build.gradle.kts` ```kotlin plugins { - id("org.jmailen.kotlinter") version "5.0.0" apply false + id("org.jmailen.kotlinter") version "5.0.1" apply false } ``` @@ -70,7 +70,7 @@ Root `build.gradle` ```groovy plugins { - id 'org.jmailen.kotlinter' version "5.0.0" apply false + id 'org.jmailen.kotlinter' version "5.0.1" apply false } ``` diff --git a/build.gradle.kts b/build.gradle.kts index a6b1b58..fc7fb0f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ val githubUrl = "https://github.com/jeremymailen/kotlinter-gradle" val webUrl = "https://github.com/jeremymailen/kotlinter-gradle" val projectDescription = "Lint and formatting for Kotlin using ktlint with configuration-free setup on JVM and Android projects" -version = "5.0.0" +version = "5.0.1" group = "org.jmailen.gradle" description = projectDescription diff --git a/src/main/kotlin/org/jmailen/gradle/kotlinter/KotlinterPlugin.kt b/src/main/kotlin/org/jmailen/gradle/kotlinter/KotlinterPlugin.kt index 01b3ad6..24f3936 100644 --- a/src/main/kotlin/org/jmailen/gradle/kotlinter/KotlinterPlugin.kt +++ b/src/main/kotlin/org/jmailen/gradle/kotlinter/KotlinterPlugin.kt @@ -29,6 +29,7 @@ class KotlinterPlugin : Plugin { override fun apply(project: Project) = with(project) { val kotlinterExtension = extensions.create("kotlinter", KotlinterExtension::class.java) + val ktlintConfiguration = createKtLintConfiguration(kotlinterExtension) if (this == rootProject) { registerPrePushHookTask() @@ -39,7 +40,6 @@ class KotlinterPlugin : Plugin { pluginManager.withPlugin(pluginId) { val lintKotlin = registerParentLintTask() val formatKotlin = registerParentFormatTask() - val ktlintConfiguration = createKtLintConfiguration(kotlinterExtension) registerSourceSetTasks(kotlinterExtension, sourceResolver, lintKotlin, formatKotlin)