aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/DokkaGenerator.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-31 20:16:01 +0200
committerGitHub <noreply@github.com>2023-08-31 20:16:01 +0200
commit02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch)
tree66f6d6f089a93b863bf1144666491eca6729ad05 /core/src/main/kotlin/DokkaGenerator.kt
parent6a181a7a2b03ec263788d137610e86937a57d434 (diff)
downloaddokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip
Enable explicit API mode (#3139)
Diffstat (limited to 'core/src/main/kotlin/DokkaGenerator.kt')
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt40
1 files changed, 21 insertions, 19 deletions
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 6132b92f..9ae3adb4 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -18,33 +18,35 @@ import org.jetbrains.dokka.utilities.DokkaLogger
*
* [generate] method has been split into submethods for test reasons
*/
-class DokkaGenerator(
+public class DokkaGenerator(
private val configuration: DokkaConfiguration,
private val logger: DokkaLogger
) {
- fun generate() = timed(logger) {
- report("Initializing plugins")
- val context = initializePlugins(configuration, logger)
+ public fun generate() {
+ timed(logger) {
+ report("Initializing plugins")
+ val context = initializePlugins(configuration, logger)
- runCatching {
- context.single(CoreExtensions.generation).run {
- logger.progress("Dokka is performing: $generationName")
- generate()
+ runCatching {
+ context.single(CoreExtensions.generation).run {
+ logger.progress("Dokka is performing: $generationName")
+ generate()
+ }
+ }.exceptionOrNull()?.let { e ->
+ finalizeCoroutines()
+ throw e
}
- }.exceptionOrNull()?.let { e ->
- finalizeCoroutines()
- throw e
- }
- finalizeCoroutines()
- }.dump("\n\n === TIME MEASUREMENT ===\n")
+ finalizeCoroutines()
+ }.dump("\n\n === TIME MEASUREMENT ===\n")
+ }
- fun initializePlugins(
+ public fun initializePlugins(
configuration: DokkaConfiguration,
logger: DokkaLogger,
additionalPlugins: List<DokkaPlugin> = emptyList()
- ) = DokkaContext.create(configuration, logger, additionalPlugins)
+ ): DokkaContext = DokkaContext.create(configuration, logger, additionalPlugins)
@OptIn(DelicateCoroutinesApi::class)
private fun finalizeCoroutines() {
@@ -54,15 +56,15 @@ class DokkaGenerator(
}
}
-class Timer internal constructor(startTime: Long, private val logger: DokkaLogger?) {
+public class Timer internal constructor(startTime: Long, private val logger: DokkaLogger?) {
private val steps = mutableListOf("" to startTime)
- fun report(name: String) {
+ public fun report(name: String) {
logger?.progress(name)
steps += (name to System.currentTimeMillis())
}
- fun dump(prefix: String = "") {
+ public fun dump(prefix: String = "") {
logger?.info(prefix)
val namePad = steps.map { it.first.length }.maxOrNull() ?: 0
val timePad = steps.windowed(2).map { (p1, p2) -> p2.second - p1.second }.maxOrNull()?.toString()?.length ?: 0