From 3dc0e7777a3d45c8b4b1e9ac91e76836a4eb4737 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Wed, 18 May 2022 19:18:37 +1000 Subject: Enable stricter validation for cacheable Gradle tasks (#2500) * Enable stricter validation for cacheable tasks * Address Gradle plugin strict validation violations --- runners/gradle-plugin/build.gradle.kts | 4 ++++ .../main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt | 2 ++ .../main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt | 2 ++ .../src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt | 2 ++ 4 files changed, 10 insertions(+) diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index 7cc5266d..95ffd9ef 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -92,6 +92,10 @@ publishing { } } +tasks.validatePlugins { + enableStricterValidation.set(true) +} + tasks.withType().configureEach { onlyIf { publication != publishing.publications["dokkaGradlePluginForIntegrationTests"] } } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt index 74125956..412695ec 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt @@ -4,7 +4,9 @@ import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.internal.plugins.DslObject import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Nested +import org.gradle.work.DisableCachingByDefault +@DisableCachingByDefault(because = "Abstract super-class, not to be instantiated directly") abstract class AbstractDokkaLeafTask : AbstractDokkaTask() { @get:Internal diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt index ad17a67d..92314c52 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTask.kt @@ -4,7 +4,9 @@ import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Nested +import org.gradle.work.DisableCachingByDefault +@DisableCachingByDefault(because = "Abstract super-class, not to be instantiated directly") abstract class AbstractDokkaParentTask : AbstractDokkaTask() { @get:Internal diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt index 1123328a..a654f9d5 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt @@ -12,6 +12,7 @@ import org.gradle.api.provider.Property import org.gradle.api.tasks.* import org.gradle.kotlin.dsl.listProperty import org.gradle.kotlin.dsl.mapProperty +import org.gradle.work.DisableCachingByDefault import org.jetbrains.dokka.* import org.jetbrains.dokka.plugability.ConfigurableBlock import org.jetbrains.dokka.plugability.DokkaPlugin @@ -19,6 +20,7 @@ import java.io.File import java.util.function.BiConsumer import kotlin.reflect.full.createInstance +@DisableCachingByDefault(because = "Abstract super-class, not to be instantiated directly") abstract class AbstractDokkaTask : DefaultTask() { @Input -- cgit