aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Generation/configurationImpl.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/Generation/configurationImpl.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/Generation/configurationImpl.kt')
-rw-r--r--core/src/main/kotlin/Generation/configurationImpl.kt46
1 files changed, 46 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Generation/configurationImpl.kt b/core/src/main/kotlin/Generation/configurationImpl.kt
new file mode 100644
index 00000000..6ed0d639
--- /dev/null
+++ b/core/src/main/kotlin/Generation/configurationImpl.kt
@@ -0,0 +1,46 @@
+package org.jetbrains.dokka
+
+import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
+import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
+import java.io.File
+
+
+data class SourceLinkDefinitionImpl(override val path: String,
+ override val url: String,
+ override val lineSuffix: String?) : SourceLinkDefinition {
+ companion object {
+ fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
+ val (path, urlAndLine) = srcLink.split('=')
+ return SourceLinkDefinitionImpl(File(path).absolutePath,
+ urlAndLine.substringBefore("#"),
+ urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it })
+ }
+ }
+}
+
+class SourceRootImpl(path: String, override val defaultPlatforms: List<String> = emptyList()) : SourceRoot {
+ override val path: String = File(path).absolutePath
+
+ companion object {
+ fun parseSourceRoot(sourceRoot: String): SourceRoot {
+ val components = sourceRoot.split("::", limit = 2)
+ return SourceRootImpl(components.last(), if (components.size == 1) listOf() else components[0].split(','))
+ }
+ }
+}
+
+data class DokkaConfigurationImpl(override val moduleName: String,
+ override val classpath: List<String>,
+ override val sourceRoots: List<SourceRootImpl>,
+ override val samples: List<String>,
+ override val includes: List<String>,
+ override val outputDir: String,
+ override val format: String,
+ override val includeNonPublic: Boolean,
+ override val includeRootPackage: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipEmptyPackages: Boolean,
+ override val skipDeprecated: Boolean,
+ override val jdkVersion: Int,
+ override val generateIndexPages: Boolean,
+ override val sourceLinks: List<SourceLinkDefinitionImpl>) : DokkaConfiguration \ No newline at end of file