diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/model/Documentable.kt | 18 | ||||
-rw-r--r-- | core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt | 54 |
2 files changed, 60 insertions, 12 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index adc46d2a..293b8a30 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>, - override val documentation: SourceSetDependent<DocumentationNode>, + val packages: List<DPackage> = emptyList(), + override val documentation: SourceSetDependent<DocumentationNode> = emptyMap(), override val expectPresentInSet: DokkaSourceSet? = null, - override val sourceSets: Set<DokkaSourceSet>, + override val sourceSets: Set<DokkaSourceSet> = emptySet(), 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>, - override val properties: List<DProperty>, - override val classlikes: List<DClasslike>, - val typealiases: List<DTypeAlias>, - override val documentation: SourceSetDependent<DocumentationNode>, + 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 expectPresentInSet: DokkaSourceSet? = null, - override val sourceSets: Set<DokkaSourceSet>, + override val sourceSets: Set<DokkaSourceSet> = emptySet(), override val extra: PropertyContainer<DPackage> = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties<DPackage> { override val name = dri.packageName.orEmpty() 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 e2720ff0..5bf7e52d 100644 --- a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt +++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt @@ -1,9 +1,12 @@ package testApi.testRunner -import com.intellij.openapi.application.PathManager import org.jetbrains.dokka.* +import org.jetbrains.dokka.links.DRI +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 java.io.File -import java.net.URL fun dokkaConfiguration(block: TestDokkaConfigurationBuilder.() -> Unit): DokkaConfigurationImpl = TestDokkaConfigurationBuilder().apply(block).build() @@ -35,6 +38,10 @@ class TestDokkaConfigurationBuilder { fun sourceSets(block: SourceSetsBuilder.() -> Unit) { sourceSets.addAll(SourceSetsBuilder().apply(block)) } + + fun add(sourceSet: DokkaSourceSetImpl) { + sourceSets.add(sourceSet) + } } @DokkaConfigurationDsl @@ -43,6 +50,10 @@ class SourceSetsBuilder : ArrayList<DokkaSourceSetImpl>() { DokkaSourceSetBuilder().apply(block).build().apply(::add) } +fun sourceSet(block: DokkaSourceSetBuilder.() -> Unit): DokkaSourceSetImpl { + return DokkaSourceSetBuilder().apply(block).build() +} + @DokkaConfigurationDsl class DokkaSourceSetBuilder( var moduleName: String = "root", @@ -55,7 +66,6 @@ class DokkaSourceSetBuilder( var samples: List<String> = emptyList(), var includes: List<String> = emptyList(), var includeNonPublic: Boolean = false, - var includeRootPackage: Boolean = true, var reportUndocumented: Boolean = false, var skipEmptyPackages: Boolean = false, var skipDeprecated: Boolean = false, @@ -95,3 +105,41 @@ class DokkaSourceSetBuilder( analysisPlatform = Platform.fromString(analysisPlatform) ) } + +val defaultSourceSet = DokkaSourceSetImpl( + moduleDisplayName = "DEFAULT", + displayName = "DEFAULT", + sourceSetID = DokkaSourceSetID("DEFAULT", "DEFAULT"), + classpath = emptyList(), + sourceRoots = emptySet(), + dependentSourceSets = emptySet(), + samples = emptySet(), + includes = emptySet(), + includeNonPublic = false, + reportUndocumented = false, + skipEmptyPackages = true, + skipDeprecated = false, + jdkVersion = 8, + sourceLinks = emptySet(), + perPackageOptions = emptyList(), + externalDocumentationLinks = emptySet(), + languageVersion = null, + apiVersion = null, + noStdlibLink = false, + noJdkLink = false, + suppressedFiles = emptySet(), + analysisPlatform = Platform.DEFAULT +) + +// TODO NOW: Clean up +fun sourceSet(name: String): DokkaConfiguration.DokkaSourceSet { + return defaultSourceSet.copy( + displayName = name, + sourceSetID = defaultSourceSet.sourceSetID.copy(sourceSetName = name) + ) +} + +fun documentationNode(vararg texts: String): DocumentationNode { + return DocumentationNode(texts.toList().map { Description(Text(it)) }) +} + |