diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-26 11:47:49 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-31 15:10:04 +0200 |
commit | ee13af00483887fb6cfdde10a58cbb43542cf2d7 (patch) | |
tree | f8af0819f34e4188e3d3800b818efb864e623068 /core/test-api | |
parent | 8d25036f5b919e9d3acc8907e70e965330efae82 (diff) | |
download | dokka-ee13af00483887fb6cfdde10a58cbb43542cf2d7.tar.gz dokka-ee13af00483887fb6cfdde10a58cbb43542cf2d7.tar.bz2 dokka-ee13af00483887fb6cfdde10a58cbb43542cf2d7.zip |
Implement tests for ModuleAndPackageDocumentationReader
Diffstat (limited to 'core/test-api')
-rw-r--r-- | core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt | 54 |
1 files changed, 51 insertions, 3 deletions
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)) }) +} + |