diff options
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r-- | core/src/main/kotlin/model/CompositeSourceSetID.kt | 30 | ||||
-rw-r--r-- | core/src/main/kotlin/model/ContentSourceSet.kt (renamed from core/src/main/kotlin/pages/ContentSourceSet.kt) | 30 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/ContentNodes.kt | 1 |
3 files changed, 32 insertions, 29 deletions
diff --git a/core/src/main/kotlin/model/CompositeSourceSetID.kt b/core/src/main/kotlin/model/CompositeSourceSetID.kt new file mode 100644 index 00000000..5eb106bf --- /dev/null +++ b/core/src/main/kotlin/model/CompositeSourceSetID.kt @@ -0,0 +1,30 @@ +package org.jetbrains.dokka.model + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaSourceSetID + +data class CompositeSourceSetID( + private val children: Set<DokkaSourceSetID> +) { + constructor(sourceSetIDs: Iterable<DokkaSourceSetID>) : this(sourceSetIDs.toSet()) + constructor(sourceSetId: DokkaSourceSetID) : this(setOf(sourceSetId)) + + init { + require(children.isNotEmpty()) { "Expected at least one source set id" } + } + + val merged = DokkaSourceSetID( + moduleName = children.map { it.moduleName }.reduce { acc, s -> "$acc+$s" }, + sourceSetName = children.map { it.sourceSetName }.reduce { acc, s -> "$acc+$s" } + ) + + val all: Set<DokkaSourceSetID> = setOf(merged, *children.toTypedArray()) + + operator fun contains(sourceSetId: DokkaSourceSetID): Boolean { + return sourceSetId in all + } + + operator fun contains(sourceSet: DokkaConfiguration.DokkaSourceSet): Boolean { + return sourceSet.sourceSetID in this + } +} diff --git a/core/src/main/kotlin/pages/ContentSourceSet.kt b/core/src/main/kotlin/model/ContentSourceSet.kt index f53cdb12..6eee4c94 100644 --- a/core/src/main/kotlin/pages/ContentSourceSet.kt +++ b/core/src/main/kotlin/model/ContentSourceSet.kt @@ -1,10 +1,9 @@ -package org.jetbrains.dokka.pages +package org.jetbrains.dokka.model import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.Platform - data class ContentSourceSet( val sourceSetIDs: CompositeSourceSetID, val displayName: String, @@ -26,33 +25,6 @@ data class ContentSourceSet( } -data class CompositeSourceSetID( - private val children: Set<DokkaSourceSetID> -) { - constructor(sourceSetIDs: Iterable<DokkaSourceSetID>) : this(sourceSetIDs.toSet()) - constructor(sourceSetId: DokkaSourceSetID) : this(setOf(sourceSetId)) - - init { - require(children.isNotEmpty()) { "Expected at least one source set id" } - } - - val merged = DokkaSourceSetID( - moduleName = children.map { it.moduleName }.reduce { acc, s -> "$acc+$s" }, - sourceSetName = children.map { it.sourceSetName }.reduce { acc, s -> "$acc+$s" } - ) - - val all: List<DokkaSourceSetID> = listOf(merged, *children.toTypedArray()) - - operator fun contains(sourceSetId: DokkaSourceSetID): Boolean { - return sourceSetId in all - } - - operator fun contains(sourceSet: DokkaSourceSet): Boolean { - return sourceSet.sourceSetID in this - } -} - - fun DokkaSourceSet.toContentSourceSet(): ContentSourceSet = ContentSourceSet(this) fun Iterable<DokkaSourceSet>.toContentSourceSets(): Set<ContentSourceSet> = map { it.toContentSourceSet() }.toSet() diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index 02d6bf61..0d43d062 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -1,6 +1,7 @@ package org.jetbrains.dokka.pages import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.ContentSourceSet import org.jetbrains.dokka.model.WithChildren import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.WithExtraProperties |