aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt20
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt2
-rw-r--r--core/src/main/kotlin/plugability/DefaultExtensions.kt2
-rw-r--r--core/src/main/kotlin/utilities/DokkaLogging.kt23
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt18
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt6
6 files changed, 53 insertions, 18 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index ccd87363..fc1b6926 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka
import com.google.gson.Gson
import org.jetbrains.dokka.DokkaConfiguration.PackageOptions
+import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import org.jetbrains.dokka.utilities.DokkaLogger
import java.util.function.BiConsumer
@@ -26,6 +27,9 @@ fun parsePerPackageOptions(arg: String): List<PackageOptions> {
class DokkaBootstrapImpl : DokkaBootstrap {
private class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
+ override var warningsCount: Int = 0
+ override var errorsCount: Int = 0
+
override fun debug(message: String) {
consumer.accept("debug", message)
}
@@ -39,11 +43,23 @@ class DokkaBootstrapImpl : DokkaBootstrap {
}
override fun warn(message: String) {
- consumer.accept("warn", message)
+ consumer.accept("warn", message).also { warningsCount++ }
}
override fun error(message: String) {
- consumer.accept("error", message)
+ consumer.accept("error", message).also { errorsCount++ }
+ }
+
+ override fun report() {
+ if (warningsCount > 0 || errorsCount > 0) {
+ println("Generation completed with $warningsCount warning" +
+ (if(DokkaConsoleLogger.warningsCount == 1) "" else "s") +
+ " and $errorsCount error" +
+ if(DokkaConsoleLogger.errorsCount == 1) "" else "s"
+ )
+ } else {
+ println("generation completed successfully")
+ }
}
}
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 138bd70d..fef71aab 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -54,6 +54,8 @@ class DokkaGenerator(
logger.progress("Rendering")
render(transformedPages, context)
+
+ logger.report()
}
fun setUpAnalysis(configuration: DokkaConfiguration): Map<PlatformData, EnvironmentAndFacade> =
diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt
index e4a47ee1..c45f28be 100644
--- a/core/src/main/kotlin/plugability/DefaultExtensions.kt
+++ b/core/src/main/kotlin/plugability/DefaultExtensions.kt
@@ -13,7 +13,7 @@ import org.jetbrains.dokka.transformers.psi.DefaultPsiToDocumentationTranslator
internal object DefaultExtensions {
private val renderer: LazyEvaluated<HtmlRenderer> = LazyEvaluated.fromRecipe { HtmlRenderer(it.single(CoreExtensions.outputWriter), it) }
- private val converter: LazyEvaluated<DocTagToContentConverter> = LazyEvaluated.fromRecipe {DocTagToContentConverter(it) }
+ private val converter: LazyEvaluated<DocTagToContentConverter> = LazyEvaluated.fromRecipe { DocTagToContentConverter(it) }
private val providerFactory: LazyEvaluated<DefaultLocationProviderFactory> = LazyEvaluated.fromRecipe { DefaultLocationProviderFactory(it) }
diff --git a/core/src/main/kotlin/utilities/DokkaLogging.kt b/core/src/main/kotlin/utilities/DokkaLogging.kt
index 9fe15d59..1c05c95d 100644
--- a/core/src/main/kotlin/utilities/DokkaLogging.kt
+++ b/core/src/main/kotlin/utilities/DokkaLogging.kt
@@ -1,16 +1,19 @@
package org.jetbrains.dokka.utilities
interface DokkaLogger {
+ var warningsCount: Int
+ var errorsCount: Int
fun debug(message: String)
fun info(message: String)
fun progress(message: String)
fun warn(message: String)
fun error(message: String)
+ fun report()
}
object DokkaConsoleLogger : DokkaLogger {
- var warningCount: Int = 0
- var errorCount: Int = 0
+ override var warningsCount: Int = 0
+ override var errorsCount: Int = 0
override fun debug(message: String)= println(message)
@@ -18,16 +21,16 @@ object DokkaConsoleLogger : DokkaLogger {
override fun info(message: String) = println(message)
- override fun warn(message: String) = println("WARN: $message").also { warningCount++ }
+ override fun warn(message: String) = println("WARN: $message").also { warningsCount++ }
- override fun error(message: String) = println("ERROR: $message").also { errorCount++ }
+ override fun error(message: String) = println("ERROR: $message").also { errorsCount++ }
- fun report() {
- if (warningCount > 0 || errorCount > 0) {
- println("generation completed with $warningCount warning" +
- (if(warningCount == 1) "" else "s") +
- " and $errorCount error" +
- if(errorCount == 1) "" else "s"
+ override fun report() {
+ if (warningsCount > 0 || errorsCount > 0) {
+ println("Generation completed with warningsCount warning" +
+ (if(warningsCount == 1) "" else "s") +
+ " and errorsCount error" +
+ if(errorsCount == 1) "" else "s"
)
} else {
println("generation completed successfully")
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt
index 1395af31..6b83fc8f 100644
--- a/runners/ant/src/main/kotlin/ant/dokka.kt
+++ b/runners/ant/src/main/kotlin/ant/dokka.kt
@@ -7,15 +7,29 @@ import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
import org.jetbrains.dokka.*
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
+import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import org.jetbrains.dokka.utilities.DokkaLogger
import java.io.File
class AntLogger(val task: Task): DokkaLogger {
+ override var warningsCount: Int = 0
+ override var errorsCount: Int = 0
override fun debug(message: String) = task.log(message, Project.MSG_DEBUG)
override fun info(message: String) = task.log(message, Project.MSG_VERBOSE)
override fun progress(message: String) = task.log(message, Project.MSG_INFO)
- override fun warn(message: String) = task.log(message, Project.MSG_WARN)
- override fun error(message: String) = task.log(message, Project.MSG_ERR)
+ override fun warn(message: String) = task.log(message, Project.MSG_WARN).also { warningsCount++ }
+ override fun error(message: String) = task.log(message, Project.MSG_ERR).also { errorsCount++ }
+ override fun report() {
+ if (warningsCount > 0 || errorsCount > 0) {
+ task.log("Generation completed with $warningsCount warning" +
+ (if(warningsCount == 1) "" else "s") +
+ " and $errorsCount error" +
+ if(errorsCount == 1) "" else "s"
+ )
+ } else {
+ task.log("generation completed successfully")
+ }
+ }
}
class AntSourceLinkDefinition(var path: String? = null, var url: String? = null, var lineSuffix: String? = null)
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index 2daac470..db8ddb01 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -196,9 +196,9 @@ object MainKt {
val javaHome = System.getProperty("java.home")
val default = File(javaHome, "../lib/tools.jar")
val mac = File(javaHome, "../Classes/classes.jar")
- when {
- default.exists() -> return default
- mac.exists() -> return mac
+ return when {
+ default.exists() -> default
+ mac.exists() -> mac
else -> {
throw Exception("tools.jar not found, please check it, also you can provide it manually, using -cp")
}