diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-27 15:50:40 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-31 15:10:04 +0200 |
commit | 8cd28416817dfd7d28bb66b28e849d97cc09012b (patch) | |
tree | 962f9420f3ccdb47d6847c9e5a16d00018c9110c /core/src | |
parent | 732d181e4908ed0ddc513e305addc71560c0e109 (diff) | |
download | dokka-8cd28416817dfd7d28bb66b28e849d97cc09012b.tar.gz dokka-8cd28416817dfd7d28bb66b28e849d97cc09012b.tar.bz2 dokka-8cd28416817dfd7d28bb66b28e849d97cc09012b.zip |
Let module name be configurable withing `AbstractDokkaTask` and remove concept of `moduleDisplayName`
Diffstat (limited to 'core/src')
4 files changed, 12 insertions, 10 deletions
diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index 2aa252e1..9a1ff602 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -9,6 +9,7 @@ import java.io.Serializable import java.net.URL object DokkaDefaults { + val moduleName: String = "root" val outputDir = File("./dokka") const val format: String = "html" val cacheRoot: File? = null @@ -58,12 +59,13 @@ interface DokkaConfigurationBuilder<T : Any> { fun <T : Any> Iterable<DokkaConfigurationBuilder<T>>.build(): List<T> = this.map { it.build() } + data class DokkaSourceSetID( - val moduleName: String, + val scopeId: String, val sourceSetName: String ) : Serializable { override fun toString(): String { - return "$moduleName/$sourceSetName" + return "$scopeId/$sourceSetName" } } @@ -72,6 +74,7 @@ fun DokkaConfigurationImpl(json: String): DokkaConfigurationImpl = parseJson(jso fun DokkaConfiguration.toJsonString(): String = toJsonString(this) interface DokkaConfiguration : Serializable { + val moduleName: String val outputDir: File val cacheRoot: File? val offlineMode: Boolean @@ -84,7 +87,6 @@ interface DokkaConfiguration : Serializable { interface DokkaSourceSet : Serializable { val sourceSetID: DokkaSourceSetID val displayName: String - val moduleDisplayName: String val classpath: List<File> val sourceRoots: Set<File> val dependentSourceSets: Set<DokkaSourceSetID> diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index 8bd2d976..3fcc7aac 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -5,6 +5,7 @@ import java.io.File import java.net.URL data class DokkaConfigurationImpl( + override val moduleName: String = DokkaDefaults.moduleName, override val outputDir: File = DokkaDefaults.outputDir, override val cacheRoot: File? = DokkaDefaults.cacheRoot, override val offlineMode: Boolean = DokkaDefaults.offlineMode, @@ -12,12 +13,11 @@ data class DokkaConfigurationImpl( override val pluginsClasspath: List<File> = emptyList(), override val pluginsConfiguration: Map<String, String> = emptyMap(), override val modules: List<DokkaModuleDescriptionImpl> = emptyList(), - override val failOnWarning: Boolean = DokkaDefaults.failOnWarning + override val failOnWarning: Boolean = DokkaDefaults.failOnWarning, ) : DokkaConfiguration data class DokkaSourceSetImpl( - override val moduleDisplayName: String, override val displayName: String = DokkaDefaults.sourceSetDisplayName, override val sourceSetID: DokkaSourceSetID, override val classpath: List<File> = emptyList(), diff --git a/core/src/main/kotlin/model/CompositeSourceSetID.kt b/core/src/main/kotlin/model/CompositeSourceSetID.kt index 3c1cf7de..9f38dafb 100644 --- a/core/src/main/kotlin/model/CompositeSourceSetID.kt +++ b/core/src/main/kotlin/model/CompositeSourceSetID.kt @@ -14,7 +14,7 @@ data class CompositeSourceSetID( } val merged = DokkaSourceSetID( - moduleName = children.map { it.moduleName }.reduce { acc, s -> "$acc+$s" }, + scopeId = children.map { it.scopeId }.reduce { acc, s -> "$acc+$s" }, sourceSetName = children.map { it.sourceSetName }.reduce { acc, s -> "$acc+$s" } ) diff --git a/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt b/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt index 8efc84c6..ba33ab92 100644 --- a/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt +++ b/core/src/test/kotlin/utilities/DokkaConfigurationJsonTest.kt @@ -9,11 +9,11 @@ class DokkaConfigurationJsonTest { @Test fun `simple configuration toJsonString then parseJson`() { val configuration = DokkaConfigurationImpl( + moduleName = "moduleName", outputDir = File("customOutputDir"), pluginsClasspath = listOf(File("plugins/customPlugin.jar")), sourceSets = listOf( DokkaSourceSetImpl( - moduleDisplayName = "customModuleDisplayName", sourceRoots = setOf(File("customSourceRoot")), sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName") ) @@ -29,13 +29,13 @@ class DokkaConfigurationJsonTest { fun `parse simple configuration json`() { val json = """ { + "moduleName": "moduleName", "outputDir": "customOutputDir", "pluginsClasspath": [ "plugins/customPlugin.jar" ], "sourceSets": [ { - "moduleDisplayName": "customModuleDisplayName", "sourceSetID": { - "moduleName": "customModuleName", + "scopeId": "customModuleName", "sourceSetName": "customSourceSetName" }, "sourceRoots": [ "customSourceRoot" ], @@ -48,11 +48,11 @@ class DokkaConfigurationJsonTest { val parsedConfiguration = DokkaConfigurationImpl(json) assertEquals( DokkaConfigurationImpl( + moduleName = "moduleName", outputDir = File("customOutputDir"), pluginsClasspath = listOf(File("plugins/customPlugin.jar")), sourceSets = listOf( DokkaSourceSetImpl( - moduleDisplayName = "customModuleDisplayName", sourceRoots = setOf(File("customSourceRoot")), sourceSetID = DokkaSourceSetID("customModuleName", "customSourceSetName"), classpath = listOf(File("classpath/custom1.jar"), File("classpath/custom2.jar")) |