aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Generation
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
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')
-rw-r--r--core/src/main/kotlin/Generation/DokkaGenerator.kt5
-rw-r--r--core/src/main/kotlin/Generation/configurationImpl.kt46
2 files changed, 47 insertions, 4 deletions
diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt
index 6b5df7c9..67c641a0 100644
--- a/core/src/main/kotlin/Generation/DokkaGenerator.kt
+++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt
@@ -7,6 +7,7 @@ import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiJavaFile
import com.intellij.psi.PsiManager
+import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
import org.jetbrains.dokka.Utilities.DokkaAnalysisModule
import org.jetbrains.dokka.Utilities.DokkaOutputModule
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
@@ -23,10 +24,6 @@ import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import kotlin.system.measureTimeMillis
-class SourceRoot(path: String, val defaultPlatforms: List<String> = emptyList()) {
- val path: String = File(path).absolutePath
-}
-
class DokkaGenerator(val logger: DokkaLogger,
val classpath: List<String>,
val sources: List<SourceRoot>,
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