aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/pages
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-13 19:39:05 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-17 11:52:28 +0200
commit6f40db680336e7f3b4b68a8d4ad7b8a7ffe33270 (patch)
tree380c40023854c5a49761d2f26fded2a55c46f075 /core/src/main/kotlin/pages
parent9fb46c158585396099b850de757f34407ad7a82b (diff)
downloaddokka-6f40db680336e7f3b4b68a8d4ad7b8a7ffe33270.tar.gz
dokka-6f40db680336e7f3b4b68a8d4ad7b8a7ffe33270.tar.bz2
dokka-6f40db680336e7f3b4b68a8d4ad7b8a7ffe33270.zip
Moving CompositeSourceSetID and ContentSourceSet into `.dokka.model`
Diffstat (limited to 'core/src/main/kotlin/pages')
-rw-r--r--core/src/main/kotlin/pages/ContentNodes.kt1
-rw-r--r--core/src/main/kotlin/pages/ContentSourceSet.kt60
2 files changed, 1 insertions, 60 deletions
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
diff --git a/core/src/main/kotlin/pages/ContentSourceSet.kt b/core/src/main/kotlin/pages/ContentSourceSet.kt
deleted file mode 100644
index f53cdb12..00000000
--- a/core/src/main/kotlin/pages/ContentSourceSet.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.jetbrains.dokka.pages
-
-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,
- val analysisPlatform: Platform
-) {
- constructor(sourceSet: DokkaSourceSet) : this(
- sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID),
- displayName = sourceSet.displayName,
- analysisPlatform = sourceSet.analysisPlatform
- )
-
- operator fun contains(sourceSetID: DokkaSourceSetID): Boolean {
- return sourceSetID in sourceSetIDs
- }
-
- operator fun contains(sourceSet: DokkaSourceSet): Boolean {
- return sourceSet.sourceSetID in this
- }
-}
-
-
-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()
-
-val Iterable<ContentSourceSet>.sourceSetIDs: List<DokkaSourceSetID> get() = this.flatMap { it.sourceSetIDs.all }