-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to get serialized configuration of a task (#3008)
(cherry picked from commit 202fa09)
- Loading branch information
1 parent
b6ee078
commit e3c383c
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...plugin/src/main/kotlin/org/jetbrains/dokka/gradle/internal/AbstractDokkaTaskExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |