aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-15 09:06:55 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-15 12:43:38 +0200
commit06ae216a4e23ee53907914731fc2fbc5443c2538 (patch)
treedb8de8c985b1d8d53ff69f4a9da11f5b05b57bde
parent06ac15a2907fd5c7a6ef0576ffa51f4937a29e0d (diff)
downloaddokka-06ae216a4e23ee53907914731fc2fbc5443c2538.tar.gz
dokka-06ae216a4e23ee53907914731fc2fbc5443c2538.tar.bz2
dokka-06ae216a4e23ee53907914731fc2fbc5443c2538.zip
MultimodulePageCreator: Improve error message on missing module docFile
-rw-r--r--plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt14
1 files changed, 13 insertions, 1 deletions
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<P>().firstOrNull()
-} \ No newline at end of file
+}