aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/ContentSourceSet.kt
blob: 8a1bf53cba230110dd392f11c3a3269f42b1e503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.jetbrains.dokka.model

import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.DokkaSourceSetID
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.utilities.SelfRepresentingSingletonSet

data class ContentSourceSet(
    val sourceSetIDs: CompositeSourceSetID,
    val displayName: String,
    val analysisPlatform: Platform
) : SelfRepresentingSingletonSet<ContentSourceSet> {
    constructor(sourceSet: DokkaSourceSet) : this(
        sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID),
        displayName = sourceSet.displayName,
        analysisPlatform = sourceSet.analysisPlatform
    )
}

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 }