From 546e8edfd95c16665319bc371c6ccf63706ad1e4 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 6 Dec 2016 16:05:01 +0300 Subject: Post-review changes, simplified proxies --- core/src/main/kotlin/DokkaBootstrapImpl.kt | 20 +++++++++++++++++--- core/src/main/kotlin/Utilities/DokkaLogging.kt | 6 ++++++ 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index cbec4985..eb2b2a65 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -1,6 +1,7 @@ package org.jetbrains.dokka import java.io.File +import java.util.function.BiConsumer fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition { val (path, urlAndLine) = srcLink.split('=') @@ -9,12 +10,25 @@ fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition { urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it }) } - class DokkaBootstrapImpl : DokkaBootstrap { + class DokkaProxyLogger(val consumer: BiConsumer) : DokkaLogger { + override fun info(message: String) { + consumer.accept("info", message) + } + + override fun warn(message: String) { + consumer.accept("warn", message) + } + + override fun error(message: String) { + consumer.accept("error", message) + } + } + lateinit var generator: DokkaGenerator - override fun configure(logger: DokkaLogger, + override fun configure(logger: BiConsumer, moduleName: String, classpath: List, sources: List, @@ -30,7 +44,7 @@ class DokkaBootstrapImpl : DokkaBootstrap { generateIndexPages: Boolean, sourceLinks: List) { generator = DokkaGenerator( - logger, + DokkaProxyLogger(logger), classpath, sources, samples, diff --git a/core/src/main/kotlin/Utilities/DokkaLogging.kt b/core/src/main/kotlin/Utilities/DokkaLogging.kt index 2e0fb395..1ef52837 100644 --- a/core/src/main/kotlin/Utilities/DokkaLogging.kt +++ b/core/src/main/kotlin/Utilities/DokkaLogging.kt @@ -1,5 +1,11 @@ package org.jetbrains.dokka +interface DokkaLogger { + fun info(message: String) + fun warn(message: String) + fun error(message: String) +} + object DokkaConsoleLogger : DokkaLogger { var warningCount: Int = 0 -- cgit