aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt69
1 files changed, 69 insertions, 0 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
new file mode 100644
index 00000000..eb2b2a65
--- /dev/null
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -0,0 +1,69 @@
+package org.jetbrains.dokka
+
+import java.io.File
+import java.util.function.BiConsumer
+
+fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
+ val (path, urlAndLine) = srcLink.split('=')
+ return SourceLinkDefinition(File(path).absolutePath,
+ urlAndLine.substringBefore("#"),
+ urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it })
+}
+
+class DokkaBootstrapImpl : DokkaBootstrap {
+
+ class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : 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: BiConsumer<String, String>,
+ moduleName: String,
+ classpath: List<String>,
+ sources: List<String>,
+ samples: List<String>,
+ includes: List<String>,
+ outputDir: String,
+ format: String,
+ includeNonPublic: Boolean,
+ reportUndocumented: Boolean,
+ skipEmptyPackages: Boolean,
+ skipDeprecated: Boolean,
+ jdkVersion: Int,
+ generateIndexPages: Boolean,
+ sourceLinks: List<String>) {
+ generator = DokkaGenerator(
+ DokkaProxyLogger(logger),
+ classpath,
+ sources,
+ samples,
+ includes,
+ moduleName,
+ DocumentationOptions(
+ outputDir,
+ format,
+ includeNonPublic,
+ reportUndocumented,
+ skipEmptyPackages,
+ skipDeprecated,
+ jdkVersion,
+ generateIndexPages,
+ sourceLinks.map(::parseSourceLinkDefinition)
+ )
+ )
+
+ }
+
+ override fun generate() = generator.generate()
+} \ No newline at end of file