From 6571ec8eb6c00a46d57711fe28ae4855517a9524 Mon Sep 17 00:00:00 2001 From: BoD Date: Tue, 11 Jul 2023 12:09:41 +0200 Subject: [PATCH 1/2] Mark tasks as not compatible with the Gradle configuration cache --- .../kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt index 066374e56c..158d132558 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt @@ -232,6 +232,7 @@ abstract class AbstractDokkaTask : DefaultTask() { init { group = JavaBasePlugin.DOCUMENTATION_GROUP + super.notCompatibleWithConfigurationCache("Dokka tasks are not yet compatible with the Gradle configuration cache. See https://github.com/Kotlin/dokka/issues/1217") } internal fun buildPluginsConfiguration(): List { From 6ef617a027a8d50b80a00a181f53120052542714 Mon Sep 17 00:00:00 2001 From: BoD Date: Fri, 18 Aug 2023 14:25:24 +0200 Subject: [PATCH 2/2] Use introspection to avoid calling missing method in Gradle < 7.4 --- .../org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt index 158d132558..1f679da825 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt @@ -23,6 +23,7 @@ import org.jetbrains.dokka.plugability.DokkaPlugin import java.util.concurrent.atomic.AtomicReference import java.util.function.BiConsumer import kotlin.reflect.full.createInstance +import kotlin.reflect.full.memberFunctions @DisableCachingByDefault(because = "Abstract super-class, not to be instantiated directly") abstract class AbstractDokkaTask : DefaultTask() { @@ -232,7 +233,11 @@ abstract class AbstractDokkaTask : DefaultTask() { init { group = JavaBasePlugin.DOCUMENTATION_GROUP - super.notCompatibleWithConfigurationCache("Dokka tasks are not yet compatible with the Gradle configuration cache. See https://github.com/Kotlin/dokka/issues/1217") + // notCompatibleWithConfigurationCache was introduced in Gradle 7.4 + val containsNotCompatibleWithConfigurationCache = this::class.memberFunctions.any { it.name == "notCompatibleWithConfigurationCache" && it.parameters.firstOrNull()?.name == "reason" } + if (containsNotCompatibleWithConfigurationCache) { + super.notCompatibleWithConfigurationCache("Dokka tasks are not yet compatible with the Gradle configuration cache. See https://github.com/Kotlin/dokka/issues/1217") + } } internal fun buildPluginsConfiguration(): List {