diff --git a/plugin-build/plugin/build.gradle.kts b/plugin-build/plugin/build.gradle.kts index 0143d7a..a21134d 100644 --- a/plugin-build/plugin/build.gradle.kts +++ b/plugin-build/plugin/build.gradle.kts @@ -32,7 +32,8 @@ gradlePlugin { version = property("VERSION").toString() description = property("DESCRIPTION").toString() displayName = property("DISPLAY_NAME").toString() - tags.set(listOf("plugin", "gradle", "sample", "template")) + // Note: tags cannot include "plugin" or "gradle" when publishing + tags.set(listOf("sample", "template")) } } } @@ -42,6 +43,15 @@ gradlePlugin { vcsUrl.set(property("VCS_URL").toString()) } +// Use Detekt with type resolution for check +tasks.named("check").configure { + this.setDependsOn( + this.dependsOn.filterNot { + it is TaskProvider<*> && it.name == "detekt" + } + tasks.named("detektMain"), + ) +} + tasks.create("setupPluginUploadFromEnvironment") { doLast { val key = System.getenv("GRADLE_PUBLISH_KEY") diff --git a/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplateExampleTask.kt b/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplateExampleTask.kt index e6c4ecd..cce6265 100644 --- a/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplateExampleTask.kt +++ b/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplateExampleTask.kt @@ -31,7 +31,7 @@ abstract class TemplateExampleTask : DefaultTask() { @TaskAction fun sampleAction() { - val prettyTag = tag.orNull?.let { "[$it]" } ?: "" + val prettyTag = tag.orNull?.let { "[$it]" }.orEmpty() logger.lifecycle("$prettyTag message is: ${message.orNull}") logger.lifecycle("$prettyTag tag is: ${tag.orNull}") diff --git a/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplatePlugin.kt b/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplatePlugin.kt index 3aa15e1..35d29d1 100644 --- a/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplatePlugin.kt +++ b/plugin-build/plugin/src/main/java/com/ncorti/kotlin/gradle/template/plugin/TemplatePlugin.kt @@ -6,6 +6,7 @@ import org.gradle.api.Project const val EXTENSION_NAME = "templateExampleConfig" const val TASK_NAME = "templateExample" +@Suppress("UnnecessaryAbstractClass") abstract class TemplatePlugin : Plugin { override fun apply(project: Project) { // Add the 'template' extension object