aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorSimon Ogorodnik <sem-oro@yandex.ru>2016-12-06 16:24:43 +0300
committerGitHub <noreply@github.com>2016-12-06 16:24:43 +0300
commit2d03ad01f650bc997dce076abaab0a61c2301a96 (patch)
tree957dbe5280cf1114cfecfca35d18b264be195255 /core/src/main/kotlin
parent5d030c6303270d8955b71c6738afd9c80d73662f (diff)
parent546e8edfd95c16665319bc371c6ccf63706ad1e4 (diff)
downloaddokka-2d03ad01f650bc997dce076abaab0a61c2301a96.tar.gz
dokka-2d03ad01f650bc997dce076abaab0a61c2301a96.tar.bz2
dokka-2d03ad01f650bc997dce076abaab0a61c2301a96.zip
Merge pull request #123 from Kotlin/isolated-classloader
Now dokka-fatjar complete isolated from poisonous Gradle environment
Diffstat (limited to 'core/src/main/kotlin')
-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