diff options
author | Szymon Świstun <sswistun@virtuslab.com> | 2020-01-14 10:34:36 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-01-15 18:47:35 +0100 |
commit | b13ff5993eb6a24adea0d17d989a594ae2e1e062 (patch) | |
tree | ca967a48886aaea4b2fcff6af6435573a608a304 /core/src/test/kotlin/utils/Builders.kt | |
parent | 0db075c17417884b6414b84e618a29f234286c4d (diff) | |
download | dokka-b13ff5993eb6a24adea0d17d989a594ae2e1e062.tar.gz dokka-b13ff5993eb6a24adea0d17d989a594ae2e1e062.tar.bz2 dokka-b13ff5993eb6a24adea0d17d989a594ae2e1e062.zip |
Add testing utils and examples
Diffstat (limited to 'core/src/test/kotlin/utils/Builders.kt')
-rw-r--r-- | core/src/test/kotlin/utils/Builders.kt | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/core/src/test/kotlin/utils/Builders.kt b/core/src/test/kotlin/utils/Builders.kt new file mode 100644 index 00000000..e881082f --- /dev/null +++ b/core/src/test/kotlin/utils/Builders.kt @@ -0,0 +1,78 @@ +package utils + +import org.jetbrains.dokka.DokkaConfigurationImpl +import org.jetbrains.dokka.PassConfigurationImpl +import org.jetbrains.dokka.Platform +import org.jetbrains.dokka.SourceRootImpl +import java.io.File + +object Builders { + data class ConfigBuilder( + val format: String = "html", + val generateIndexPages: Boolean = true, + val cacheRoot: String? = null, + val impliedPlatforms: List<String> = emptyList(), + val passesConfigurations: List<PassBuilder> = emptyList(), + var pluginsClasspath: List<String> = emptyList() + ) { + operator fun invoke(out: String) = + DokkaConfigurationImpl( + outputDir = out, + format = format, + generateIndexPages = generateIndexPages, + cacheRoot = cacheRoot, + impliedPlatforms = impliedPlatforms, + passesConfigurations = passesConfigurations.map { it() }, + pluginsClasspath = pluginsClasspath.map { File(it) } + ) + } + + data class PassBuilder( + val moduleName: String = "", + val classpath: List<String> = emptyList(), + val sourceRoots: List<String> = emptyList(), + val samples: List<String> = emptyList(), + val includes: List<String> = emptyList(), + val includeNonPublic: Boolean = true, + val includeRootPackage: Boolean = true, + val reportUndocumented: Boolean = false, + val skipEmptyPackages: Boolean = false, + val skipDeprecated: Boolean = false, + val jdkVersion: Int = 6, + val languageVersion: String? = null, + val apiVersion: String? = null, + val noStdlibLink: Boolean = false, + val noJdkLink: Boolean = false, + val suppressedFiles: List<String> = emptyList(), + val collectInheritedExtensionsFromLibraries: Boolean = true, + val analysisPlatform: String = "", + val targets: List<String> = emptyList(), + val sinceKotlin: String? = null + ) { + operator fun invoke() = + PassConfigurationImpl( + moduleName = moduleName, + classpath = classpath, + sourceRoots = sourceRoots.map{ SourceRootImpl(it) }, + samples = samples, + includes = includes, + includeNonPublic = includeNonPublic, + includeRootPackage = includeRootPackage, + reportUndocumented = reportUndocumented, + skipEmptyPackages = skipEmptyPackages, + skipDeprecated = skipDeprecated, + jdkVersion = jdkVersion, + languageVersion = languageVersion, + apiVersion = apiVersion, + noStdlibLink = noStdlibLink, + noJdkLink = noJdkLink, + suppressedFiles = suppressedFiles, + collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries, + analysisPlatform = Platform.fromString(analysisPlatform), + targets = targets, + sinceKotlin = sinceKotlin + ) + } + + +}
\ No newline at end of file |