aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt5
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt2
-rw-r--r--core/src/main/kotlin/DokkaMultimoduleBootstrapImpl.kt5
-rw-r--r--core/src/main/kotlin/configuration.kt27
-rw-r--r--core/src/main/kotlin/defaultConfiguration.kt22
-rw-r--r--core/src/main/kotlin/plugability/DokkaPlugin.kt2
6 files changed, 41 insertions, 22 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index bd632546..be3d6c9b 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -1,8 +1,6 @@
package org.jetbrains.dokka
-import com.google.gson.Gson
import org.jetbrains.dokka.DokkaConfiguration.PackageOptions
-import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import org.jetbrains.dokka.utilities.DokkaLogger
import java.util.function.BiConsumer
@@ -80,7 +78,6 @@ class DokkaBootstrapImpl : DokkaBootstrap {
}
private lateinit var generator: DokkaGenerator
- val gson = Gson()
fun configure(logger: DokkaLogger, configuration: DokkaConfigurationImpl) = with(configuration) {
@@ -113,7 +110,7 @@ class DokkaBootstrapImpl : DokkaBootstrap {
override fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String) = configure(
DokkaProxyLogger(logger),
- gson.fromJson(serializedConfigurationJSON, DokkaConfigurationImpl::class.java)
+ DokkaConfigurationImpl(serializedConfigurationJSON)
)
override fun generate() = generator.generate()
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index ce8d229a..ee1adf0b 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -68,7 +68,7 @@ class DokkaGenerator(
fun createDocumentationModels(
context: DokkaContext
) = context.configuration.sourceSets
- .flatMap { passConfiguration -> translateSources(passConfiguration, context) }
+ .flatMap { sourceSet -> translateSources(sourceSet, context) }
fun transformDocumentationModelBeforeMerge(
modulesFromPlatforms: List<DModule>,
diff --git a/core/src/main/kotlin/DokkaMultimoduleBootstrapImpl.kt b/core/src/main/kotlin/DokkaMultimoduleBootstrapImpl.kt
index 6825ce64..70b99f8d 100644
--- a/core/src/main/kotlin/DokkaMultimoduleBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaMultimoduleBootstrapImpl.kt
@@ -1,6 +1,5 @@
package org.jetbrains.dokka
-import com.google.gson.Gson
import org.jetbrains.dokka.DokkaBootstrapImpl.DokkaProxyLogger
import org.jetbrains.dokka.utilities.DokkaLogger
import java.util.function.BiConsumer
@@ -15,11 +14,11 @@ class DokkaMultimoduleBootstrapImpl : DokkaBootstrap {
override fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String) = configure(
DokkaProxyLogger(logger),
- Gson().fromJson(serializedConfigurationJSON, DokkaConfigurationImpl::class.java)
+ DokkaConfigurationImpl(serializedConfigurationJSON)
)
override fun generate() {
generator.generateAllModulesPage()
}
-} \ No newline at end of file
+}
diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt
index 463d2342..c531ab9a 100644
--- a/core/src/main/kotlin/configuration.kt
+++ b/core/src/main/kotlin/configuration.kt
@@ -1,6 +1,10 @@
+@file:Suppress("FunctionName")
+
package org.jetbrains.dokka
+import com.google.gson.Gson
import java.io.File
+import java.io.Serializable
import java.net.URL
object DokkaDefaults {
@@ -43,6 +47,23 @@ enum class Platform(val key: String) {
}
}
+data class DokkaSourceSetID(
+ val moduleName: String,
+ val sourceSetName: String
+) : Serializable {
+ override fun toString(): String {
+ return "$moduleName/$sourceSetName"
+ }
+}
+
+fun DokkaConfigurationImpl(json: String): DokkaConfigurationImpl {
+ return Gson().fromJson(json, DokkaConfigurationImpl::class.java)
+}
+
+fun DokkaConfiguration.toJson(): String {
+ return Gson().toJson(this)
+}
+
interface DokkaConfiguration {
val outputDir: String
val format: String
@@ -55,12 +76,12 @@ interface DokkaConfiguration {
val pluginsConfiguration: Map<String, String>
interface DokkaSourceSet {
- val moduleName: String
+ val sourceSetID: DokkaSourceSetID
val displayName: String
- val sourceSetID: String
+ val moduleDisplayName: String
val classpath: List<String>
val sourceRoots: List<SourceRoot>
- val dependentSourceSets: List<String>
+ val dependentSourceSets: Set<DokkaSourceSetID>
val samples: List<String>
val includes: List<String>
val includeNonPublic: Boolean
diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt
index d3ac9df2..47bd7fe2 100644
--- a/core/src/main/kotlin/defaultConfiguration.kt
+++ b/core/src/main/kotlin/defaultConfiguration.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import java.io.File
import java.net.URL
@@ -16,12 +17,12 @@ data class DokkaConfigurationImpl(
) : DokkaConfiguration
data class DokkaSourceSetImpl(
- override val moduleName: String,
+ override val moduleDisplayName: String,
override val displayName: String,
- override val sourceSetID: String,
+ override val sourceSetID: DokkaSourceSetID,
override val classpath: List<String>,
override val sourceRoots: List<SourceRootImpl>,
- override val dependentSourceSets: List<String>,
+ override val dependentSourceSets: Set<DokkaSourceSetID>,
override val samples: List<String>,
override val includes: List<String>,
override val includeNonPublic: Boolean,
@@ -39,23 +40,23 @@ data class DokkaSourceSetImpl(
override val noJdkLink: Boolean,
override val suppressedFiles: List<String>,
override val analysisPlatform: Platform
-) : DokkaConfiguration.DokkaSourceSet
+) : DokkaSourceSet
data class DokkaModuleDescriptionImpl(
override val name: String,
override val path: String,
override val docFile: String
-): DokkaConfiguration.DokkaModuleDescription
+) : DokkaConfiguration.DokkaModuleDescription
data class SourceRootImpl(
override val path: String
-): DokkaConfiguration.SourceRoot
+) : DokkaConfiguration.SourceRoot
data class SourceLinkDefinitionImpl(
override val path: String,
override val url: String,
override val lineSuffix: String?
-): DokkaConfiguration.SourceLinkDefinition {
+) : DokkaConfiguration.SourceLinkDefinition {
companion object {
fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinitionImpl {
val (path, urlAndLine) = srcLink.split('=')
@@ -73,9 +74,10 @@ data class PackageOptionsImpl(
override val reportUndocumented: Boolean?,
override val skipDeprecated: Boolean,
override val suppress: Boolean
-): DokkaConfiguration.PackageOptions
+) : DokkaConfiguration.PackageOptions
-data class ExternalDocumentationLinkImpl(override val url: URL,
- override val packageListUrl: URL
+data class ExternalDocumentationLinkImpl(
+ override val url: URL,
+ override val packageListUrl: URL
) : DokkaConfiguration.ExternalDocumentationLink
diff --git a/core/src/main/kotlin/plugability/DokkaPlugin.kt b/core/src/main/kotlin/plugability/DokkaPlugin.kt
index fe472b12..7ead43b8 100644
--- a/core/src/main/kotlin/plugability/DokkaPlugin.kt
+++ b/core/src/main/kotlin/plugability/DokkaPlugin.kt
@@ -82,4 +82,4 @@ inline fun <reified T : DokkaPlugin, reified R : ConfigurableBlock> configuratio
}
}
}
-} \ No newline at end of file
+}