aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/DokkaBootstrapImpl.kt
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-02 15:08:52 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-02 16:51:03 +0300
commit54c3c87acfb31afc22afc5f20229384f755b677f (patch)
tree276b600a967ab9a2b710ae62e2acc1443d395c7d /core/src/main/kotlin/DokkaBootstrapImpl.kt
parentacbe2f8c47a81c8e6046214f600ffdef24890fa6 (diff)
downloaddokka-54c3c87acfb31afc22afc5f20229384f755b677f.tar.gz
dokka-54c3c87acfb31afc22afc5f20229384f755b677f.tar.bz2
dokka-54c3c87acfb31afc22afc5f20229384f755b677f.zip
Refactoring internal communication for gradle
Diffstat (limited to 'core/src/main/kotlin/DokkaBootstrapImpl.kt')
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt42
1 files changed, 9 insertions, 33 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index 8b10a5e8..fafa5daa 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -1,14 +1,8 @@
package org.jetbrains.dokka
-import java.io.File
+import ru.yole.jkid.deserialization.deserialize
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 })
-}
fun parsePerPackageOptions(arg: String): List<PackageOptions> {
if (arg.isBlank()) return emptyList()
@@ -25,14 +19,9 @@ fun parsePerPackageOptions(arg: String): List<PackageOptions> {
}
}
-fun parseSourceRoot(sourceRoot: String): SourceRoot {
- val components = sourceRoot.split("::", limit = 2)
- return SourceRoot(components.last(), if (components.size == 1) listOf() else components[0].split(','))
-}
-
class DokkaBootstrapImpl : DokkaBootstrap {
- class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
+ private class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
override fun info(message: String) {
consumer.accept("info", message)
}
@@ -48,26 +37,14 @@ class DokkaBootstrapImpl : DokkaBootstrap {
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,
- includeRootPackage: Boolean,
- reportUndocumented: Boolean,
- skipEmptyPackages: Boolean,
- skipDeprecated: Boolean,
- jdkVersion: Int,
- generateIndexPages: Boolean,
- sourceLinks: List<String>) {
+ override fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String)
+ = configure(DokkaProxyLogger(logger), deserialize<DokkaConfigurationImpl>(serializedConfigurationJSON))
+
+ fun configure(logger: DokkaLogger, configuration: DokkaConfiguration) = with(configuration) {
generator = DokkaGenerator(
- DokkaProxyLogger(logger),
+ logger,
classpath,
- sources.map(::parseSourceRoot),
+ sourceRoots,
samples,
includes,
moduleName,
@@ -81,10 +58,9 @@ class DokkaBootstrapImpl : DokkaBootstrap {
skipDeprecated,
jdkVersion,
generateIndexPages,
- sourceLinks.map(::parseSourceLinkDefinition)
+ sourceLinks
)
)
-
}
override fun generate() = generator.generate()