aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-28 18:24:11 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-31 15:10:04 +0200
commit8bae1b84fabce1eae68a6bd9464c5a13a03b36d4 (patch)
treeec222e6375f7282566b4770ae06fce76b529c174 /core
parentc75185e229c7e8bf8e2d894d08d1d0159cd60094 (diff)
downloaddokka-8bae1b84fabce1eae68a6bd9464c5a13a03b36d4.tar.gz
dokka-8bae1b84fabce1eae68a6bd9464c5a13a03b36d4.tar.bz2
dokka-8bae1b84fabce1eae68a6bd9464c5a13a03b36d4.zip
Implement dPackage and dModule test APIs in favour of default params in DModule and DPackage
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/model/Documentable.kt18
-rw-r--r--core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt39
2 files changed, 48 insertions, 9 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index 34ad6c2b..0ffc2f84 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -87,10 +87,10 @@ sealed class DClasslike : Documentable(), WithScope, WithVisibility, WithExpectA
data class DModule(
override val name: String,
- val packages: List<DPackage> = emptyList(),
- override val documentation: SourceSetDependent<DocumentationNode> = emptyMap(),
+ val packages: List<DPackage>,
+ override val documentation: SourceSetDependent<DocumentationNode>,
override val expectPresentInSet: DokkaSourceSet? = null,
- override val sourceSets: Set<DokkaSourceSet> = emptySet(),
+ override val sourceSets: Set<DokkaSourceSet>,
override val extra: PropertyContainer<DModule> = PropertyContainer.empty()
) : Documentable(), WithExtraProperties<DModule> {
override val dri: DRI = DRI.topLevel
@@ -102,13 +102,13 @@ data class DModule(
data class DPackage(
override val dri: DRI,
- override val functions: List<DFunction> = emptyList(),
- override val properties: List<DProperty> = emptyList(),
- override val classlikes: List<DClasslike> = emptyList(),
- val typealiases: List<DTypeAlias> = emptyList(),
- override val documentation: SourceSetDependent<DocumentationNode> = emptyMap(),
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
+ val typealiases: List<DTypeAlias>,
+ override val documentation: SourceSetDependent<DocumentationNode>,
override val expectPresentInSet: DokkaSourceSet? = null,
- override val sourceSets: Set<DokkaSourceSet> = emptySet(),
+ override val sourceSets: Set<DokkaSourceSet>,
override val extra: PropertyContainer<DPackage> = PropertyContainer.empty()
) : Documentable(), WithScope, WithExtraProperties<DPackage> {
diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
index 2d9f99b2..d7b4f64f 100644
--- a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
+++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.Description
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.doc.Text
+import org.jetbrains.dokka.model.properties.PropertyContainer
import java.io.File
fun dokkaConfiguration(block: TestDokkaConfigurationBuilder.() -> Unit): DokkaConfigurationImpl =
@@ -145,6 +146,44 @@ fun sourceSet(name: String): DokkaConfiguration.DokkaSourceSet {
)
}
+fun dModule(
+ name: String,
+ packages: List<DPackage> = emptyList(),
+ documentation: SourceSetDependent<DocumentationNode> = emptyMap(),
+ expectPresentInSet: DokkaConfiguration.DokkaSourceSet? = null,
+ sourceSets: Set<DokkaConfiguration.DokkaSourceSet> = emptySet(),
+ extra: PropertyContainer<DModule> = PropertyContainer.empty()
+): DModule = DModule(
+ name = name,
+ packages = packages,
+ documentation = documentation,
+ expectPresentInSet = expectPresentInSet,
+ sourceSets = sourceSets,
+ extra = extra
+)
+
+fun dPackage(
+ dri: DRI,
+ functions: List<DFunction> = emptyList(),
+ properties: List<DProperty> = emptyList(),
+ classlikes: List<DClasslike> = emptyList(),
+ typealiases: List<DTypeAlias> = emptyList(),
+ documentation: SourceSetDependent<DocumentationNode> = emptyMap(),
+ expectPresentInSet: DokkaConfiguration.DokkaSourceSet? = null,
+ sourceSets: Set<DokkaConfiguration.DokkaSourceSet> = emptySet(),
+ extra: PropertyContainer<DPackage> = PropertyContainer.empty()
+): DPackage = DPackage(
+ dri = dri,
+ functions = functions,
+ properties = properties,
+ classlikes = classlikes,
+ typealiases = typealiases,
+ documentation = documentation,
+ expectPresentInSet = expectPresentInSet,
+ sourceSets = sourceSets,
+ extra = extra
+)
+
fun documentationNode(vararg texts: String): DocumentationNode {
return DocumentationNode(texts.toList().map { Description(Text(it)) })
}