From 06ae216a4e23ee53907914731fc2fbc5443c2538 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 15 Jul 2020 09:06:55 +0200 Subject: MultimodulePageCreator: Improve error message on missing module docFile --- .../main/kotlin/allModulePage/MultimodulePageCreator.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'plugins/base/src/main/kotlin') diff --git a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt index e3da9ecc..de2242f2 100644 --- a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt +++ b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt @@ -1,6 +1,8 @@ package org.jetbrains.dokka.base.allModulePage +import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet +import org.jetbrains.dokka.DokkaException import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.resolvers.local.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter @@ -24,6 +26,7 @@ class MultimodulePageCreator( override fun invoke(): RootPageNode { val parser = MarkdownParser(logger = logger) val modules = context.configuration.modules + modules.forEach(::throwOnMissingModuleDocFile) val commentsConverter = context.plugin(DokkaBase::class)?.querySingle { commentsToContentConverter } val signatureProvider = context.plugin(DokkaBase::class)?.querySingle { signatureProvider } @@ -64,6 +67,15 @@ class MultimodulePageCreator( ) } + private fun throwOnMissingModuleDocFile(module: DokkaConfiguration.DokkaModuleDescription) { + val docFile = File(module.docFile) + if (!docFile.exists() || !docFile.isFile) { + throw DokkaException( + "Missing documentation file for module ${module.name}: ${docFile.absolutePath}" + ) + } + } + private fun DocumentationNode.firstParagraph() = this.children.flatMap { it.root.children }.filterIsInstance

().firstOrNull() -} \ No newline at end of file +} -- cgit