From 202fa09316fb1e0ff586c0d2301f99284fc74d9a Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Tue, 30 May 2023 20:28:44 +0200 Subject: Add the ability to get serialized configuration of a task (#3008) --- .../gradle/internal/AbstractDokkaTaskExtensions.kt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/internal/AbstractDokkaTaskExtensions.kt (limited to 'runners/gradle-plugin/src/main/kotlin/org') diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/internal/AbstractDokkaTaskExtensions.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/internal/AbstractDokkaTaskExtensions.kt new file mode 100644 index 00000000..ba1f4505 --- /dev/null +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/internal/AbstractDokkaTaskExtensions.kt @@ -0,0 +1,24 @@ +package org.jetbrains.dokka.gradle.internal + +import org.jetbrains.dokka.InternalDokkaApi +import org.jetbrains.dokka.gradle.AbstractDokkaTask +import org.jetbrains.dokka.toPrettyJsonString +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.toCompactJsonString + +/** + * Serializes [DokkaConfiguration] of this [AbstractDokkaTask] as json + * + * Should be used for short-term debugging only, no guarantees are given for the support of this API. + * + * Better alternative should be introduced as part of [#2873](https://github.com/Kotlin/dokka/issues/2873). + */ +@InternalDokkaApi +fun AbstractDokkaTask.buildJsonConfiguration(prettyPrint: Boolean = true): String { + val configuration = this.buildDokkaConfiguration() + return if (prettyPrint) { + configuration.toPrettyJsonString() + } else { + configuration.toCompactJsonString() + } +} -- cgit