aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/CoreExtensions.kt4
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt10
-rw-r--r--core/src/main/kotlin/renderers/DefaultRenderer.kt6
-rw-r--r--core/src/main/kotlin/renderers/FileWriter.kt4
-rw-r--r--core/src/main/kotlin/renderers/HtmlRenderer.kt6
-rw-r--r--core/src/main/kotlin/renderers/Writer.kt7
-rw-r--r--core/src/test/kotlin/generator/DokkaTestGenerator.kt78
-rw-r--r--core/src/test/kotlin/generator/TestRunner.kt157
-rw-r--r--core/src/test/kotlin/generator/test/GeneratorTest.kt62
-rw-r--r--core/src/test/kotlin/generator/test/MultiplatformTest.kt52
-rw-r--r--core/src/test/kotlin/utils/Builders.kt78
-rw-r--r--core/src/test/resources/sourceSets/example/commonMain/kotlin/Clock.kt15
-rw-r--r--core/src/test/resources/sourceSets/example/commonMain/kotlin/House.kt24
-rw-r--r--core/src/test/resources/sourceSets/example/jsMain/kotlin/Clock.kt21
-rw-r--r--core/src/test/resources/sourceSets/example/jvmAndJsSecondCommonMain/kotlin/Greeter.kt10
-rw-r--r--core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/Clock.kt34
-rw-r--r--core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ClockDays.kt15
-rw-r--r--core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ParticularClock.kt32
18 files changed, 600 insertions, 15 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt
index 7393dd68..191a6c59 100644
--- a/core/src/main/kotlin/CoreExtensions.kt
+++ b/core/src/main/kotlin/CoreExtensions.kt
@@ -4,8 +4,8 @@ import org.jetbrains.dokka.pages.CommentsToContentConverter
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.ExtensionPoint
-import org.jetbrains.dokka.renderers.FileWriter
import org.jetbrains.dokka.renderers.Renderer
+import org.jetbrains.dokka.renderers.Writer
import org.jetbrains.dokka.resolvers.LocationProvider
import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentationTranslator
import org.jetbrains.dokka.transformers.documentation.DocumentationNodeMerger
@@ -26,7 +26,7 @@ object CoreExtensions {
val commentsToContentConverterFactory by coreExtension<(DokkaContext) -> CommentsToContentConverter>()
val documentationToPageTranslator by coreExtension<DocumentationToPageTranslator>()
val pageTransformer by coreExtension<PageNodeTransformer>()
- val rendererFactory by coreExtension<(FileWriter, LocationProvider, DokkaContext) -> Renderer>()
+ val rendererFactory by coreExtension<(Writer, LocationProvider, DokkaContext) -> Renderer>()
val locationProviderFactory by coreExtension<(root: PageNode, DokkaConfiguration, DokkaContext) -> LocationProvider>()
val fileExtension by coreExtension<String>()
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index b4035617..845ad53f 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -16,12 +16,12 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
-class DokkaGenerator(
+open class DokkaGenerator(
private val configuration: DokkaConfiguration,
private val logger: DokkaLogger
) {
- fun generate() {
+ open fun generate() {
logger.debug("Setting up analysis environments")
val platforms: Map<PlatformData, EnvironmentAndFacade> = configuration.passesConfigurations.map {
PlatformData(it.moduleName, it.analysisPlatform, it.targets) to createEnvironmentAndFacade(it)
@@ -59,7 +59,7 @@ class DokkaGenerator(
renderer.render(transformedPages)
}
- private fun createEnvironmentAndFacade(pass: DokkaConfiguration.PassConfiguration): EnvironmentAndFacade =
+ protected fun createEnvironmentAndFacade(pass: DokkaConfiguration.PassConfiguration): EnvironmentAndFacade =
AnalysisEnvironment(DokkaMessageCollector(logger), pass.analysisPlatform).run {
if (analysisPlatform == Platform.jvm) {
addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
@@ -75,7 +75,7 @@ class DokkaGenerator(
EnvironmentAndFacade(environment, facade)
}
- private fun translateDescriptors(platformData: PlatformData, context: DokkaContext): Module {
+ protected fun translateDescriptors(platformData: PlatformData, context: DokkaContext): Module {
val (environment, facade) = context.platforms.getValue(platformData)
val packageFragments = environment.getSourceFiles().asSequence()
@@ -88,7 +88,7 @@ class DokkaGenerator(
.invoke(platformData.name, packageFragments, platformData, context)
}
- private class DokkaMessageCollector(private val logger: DokkaLogger) : MessageCollector {
+ protected class DokkaMessageCollector(private val logger: DokkaLogger) : MessageCollector {
override fun clear() {
seenErrors = false
}
diff --git a/core/src/main/kotlin/renderers/DefaultRenderer.kt b/core/src/main/kotlin/renderers/DefaultRenderer.kt
index e2ebf8b3..8f6c6635 100644
--- a/core/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/core/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -5,7 +5,7 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.resolvers.LocationProvider
abstract class DefaultRenderer<T>(
- protected val fileWriter: FileWriter,
+ protected val writer: Writer,
protected val locationProvider: LocationProvider,
protected val context: DokkaContext
) : Renderer {
@@ -64,7 +64,7 @@ abstract class DefaultRenderer<T>(
}
protected open fun renderPage(page: PageNode) =
- fileWriter.write(locationProvider.resolve(page), buildPage(page, ::buildPageContent), "")
+ writer.write(locationProvider.resolve(page), buildPage(page, ::buildPageContent), "")
protected open fun renderPages(root: PageNode) {
renderPage(root)
@@ -77,7 +77,7 @@ abstract class DefaultRenderer<T>(
getPackageNamesAndPlatforms(root)
.keys
.joinToString("\n")
- .also { fileWriter.write("${root.name}/package-list", it, "") }
+ .also { writer.write("${root.name}/package-list", it, "") }
protected open fun getPackageNamesAndPlatforms(root: PageNode): Map<String, List<PlatformData>> =
root.children
diff --git a/core/src/main/kotlin/renderers/FileWriter.kt b/core/src/main/kotlin/renderers/FileWriter.kt
index 9ee02b4b..c9785dfd 100644
--- a/core/src/main/kotlin/renderers/FileWriter.kt
+++ b/core/src/main/kotlin/renderers/FileWriter.kt
@@ -4,10 +4,10 @@ import java.io.File
import java.io.IOException
import java.nio.file.Paths
-class FileWriter(val root: String, val extension: String){
+class FileWriter(override val root: String, override val extension: String) : Writer {
private val createdFiles: MutableSet<String> = mutableSetOf()
- fun write(path: String, text: String, ext: String = extension){
+ override fun write(path: String, text: String, ext: String){
if (createdFiles.contains(path)) {
println("ERROR. An attempt to write $root/$path several times!")
return
diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt
index 2c450ae5..2bb07666 100644
--- a/core/src/main/kotlin/renderers/HtmlRenderer.kt
+++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt
@@ -9,10 +9,10 @@ import java.io.File
import java.net.URL
open class HtmlRenderer(
- fileWriter: FileWriter,
+ writer: Writer,
locationProvider: LocationProvider,
context: DokkaContext
-) : DefaultRenderer<FlowContent>(fileWriter, locationProvider, context) {
+) : DefaultRenderer<FlowContent>(writer, locationProvider, context) {
override fun FlowContent.buildList(node: ContentList, pageContext: PageNode) =
if (node.ordered) ol {
@@ -121,7 +121,7 @@ open class HtmlRenderer(
}
override fun buildSupportFiles() { // TODO copy file instead of reading
- fileWriter.write(
+ writer.write(
"style.css",
javaClass.getResourceAsStream("/dokka/styles/style.css").reader().readText()
)
diff --git a/core/src/main/kotlin/renderers/Writer.kt b/core/src/main/kotlin/renderers/Writer.kt
new file mode 100644
index 00000000..ead281fe
--- /dev/null
+++ b/core/src/main/kotlin/renderers/Writer.kt
@@ -0,0 +1,7 @@
+package org.jetbrains.dokka.renderers
+
+interface Writer {
+ val root: String
+ val extension: String
+ fun write(path: String, text: String, ext: String = extension)
+} \ No newline at end of file
diff --git a/core/src/test/kotlin/generator/DokkaTestGenerator.kt b/core/src/test/kotlin/generator/DokkaTestGenerator.kt
new file mode 100644
index 00000000..9ceeeadf
--- /dev/null
+++ b/core/src/test/kotlin/generator/DokkaTestGenerator.kt
@@ -0,0 +1,78 @@
+package org.jetbrains.dokka
+
+import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.pages.ModulePageNode
+import org.jetbrains.dokka.pages.PlatformData
+import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.plugability.single
+import org.jetbrains.dokka.renderers.FileWriter
+import org.jetbrains.dokka.utilities.DokkaLogger
+
+class DokkaTestGenerator(
+ private val configuration: DokkaConfiguration,
+ private val logger: DokkaLogger,
+ private val setupTest: (Map<PlatformData, EnvironmentAndFacade>) -> Unit?,
+ private val pluginInitTest: (DokkaContext) -> Unit?,
+ private val documentablesCreationTest: (List<Module>) -> Unit?,
+ private val documentablesMergingTest: (Module) -> Unit?,
+ private val documentablesTransformationTest: (Module) -> Unit?,
+ private val pagesCreationTest: (ModulePageNode) -> Unit?,
+ private val pagesTransformationTest: (ModulePageNode) -> Unit?,
+ private val finalTest: (DokkaConfiguration) -> Unit?
+) : DokkaGenerator(configuration, logger) {
+
+ override fun generate() {
+ logger.debug("Setting up analysis environments")
+ val platforms = configuration.passesConfigurations.map {
+ PlatformData(it.moduleName, it.analysisPlatform, it.targets) to createEnvironmentAndFacade(it)
+ }.toMap()
+
+ setupTest(platforms)
+
+ logger.debug("Initializing plugins")
+ val context = DokkaContext.create(configuration.pluginsClasspath, logger, platforms)
+
+ pluginInitTest(context)
+
+ logger.debug("Creating documentation models")
+ val modulesFromPlatforms = platforms.map { (pdata, _) -> translateDescriptors(pdata, context) }
+
+ documentablesCreationTest(modulesFromPlatforms)
+
+ logger.debug("Merging documentation models")
+ val documentationModel = context.single(CoreExtensions.documentationMerger)
+ .invoke(modulesFromPlatforms, context)
+
+ documentablesMergingTest(documentationModel)
+
+ logger.debug("Transforming documentation model")
+ val transformedDocumentation = context[CoreExtensions.documentationTransformer]
+ .fold(documentationModel) { acc, t -> t(acc, context) }
+
+ documentablesTransformationTest(transformedDocumentation)
+
+ logger.debug("Creating pages")
+ val pages = context.single(CoreExtensions.documentationToPageTranslator)
+ .invoke(transformedDocumentation, context)
+
+ pagesCreationTest(pages)
+
+ logger.debug("Transforming pages")
+ val transformedPages = context[CoreExtensions.pageTransformer]
+ .fold(pages) { acc, t -> t(acc, context) }
+
+ pagesTransformationTest(transformedPages)
+
+ logger.debug("Rendering")
+ val fileWriter = FileWriter(configuration.outputDir, "")
+ val locationProvider = context.single(CoreExtensions.locationProviderFactory)
+ .invoke(transformedPages, configuration, context)
+ val renderer = context.single(CoreExtensions.rendererFactory)
+ .invoke(fileWriter, locationProvider, context)
+
+ renderer.render(transformedPages)
+
+ finalTest(configuration)
+ }
+
+} \ No newline at end of file
diff --git a/core/src/test/kotlin/generator/TestRunner.kt b/core/src/test/kotlin/generator/TestRunner.kt
new file mode 100644
index 00000000..305996f8
--- /dev/null
+++ b/core/src/test/kotlin/generator/TestRunner.kt
@@ -0,0 +1,157 @@
+package generator
+
+import com.intellij.util.io.createDirectories
+import com.intellij.util.io.exists
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.DokkaTestGenerator
+import org.jetbrains.dokka.EnvironmentAndFacade
+import org.jetbrains.dokka.SourceRootImpl
+import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.pages.ModulePageNode
+import org.jetbrains.dokka.pages.PlatformData
+import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.utilities.DokkaConsoleLogger
+import org.jetbrains.dokka.utilities.DokkaLogger
+import utils.Builders
+import java.io.File
+import java.nio.charset.Charset
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.Paths
+
+data class ConfigParams(val name: String, val root: Path, val out: Path)
+
+object TestRunner {
+
+ private val createdDirs: MutableList<File> = mutableListOf()
+
+ fun cleanup() {
+ createdDirs.forEach { f -> f.takeIf { it.exists() }?.deleteRecursively() }
+ createdDirs.clear()
+ }
+
+ fun srcSetFromName(name: String) =
+ ClassLoader.getSystemResource("sourceSets/$name").takeIf { it != null }
+ ?.let { Paths.get(it.toURI()).toString() }
+
+ fun testFromSourceSets(
+ name: String,
+ configBuilder: Builders.ConfigBuilder,
+ setupTest: (Map<PlatformData, EnvironmentAndFacade>) -> Unit? = {},
+ pluginInitTest: (DokkaContext) -> Unit? = {},
+ documentablesCreationTest: (List<Module>) -> Unit? = {},
+ documentablesMergingTest: (Module) -> Unit? = {},
+ documentablesTransformationTest: (Module) -> Unit? = {},
+ pagesCreationTest: (ModulePageNode) -> Unit? = {},
+ pagesTransformationTest: (ModulePageNode) -> Unit? = {},
+ finalTest: (DokkaConfiguration) -> Unit? = {},
+ logger: DokkaLogger = DokkaConsoleLogger
+ ) {
+ val (out, _) = getTestDirs(name)
+ DokkaTestGenerator(
+ configBuilder(out.toString()),
+ logger,
+ setupTest,
+ pluginInitTest,
+ documentablesCreationTest,
+ documentablesMergingTest,
+ documentablesTransformationTest,
+ pagesCreationTest,
+ pagesTransformationTest,
+ finalTest
+ ).generate()
+ }
+
+ fun testInline(
+ name: String,
+ query: String,
+ config: (ConfigParams) -> DokkaConfiguration,
+ setupTest: (Map<PlatformData, EnvironmentAndFacade>) -> Unit? = {},
+ pluginInitTest: (DokkaContext) -> Unit? = {},
+ documentablesCreationTest: (List<Module>) -> Unit? = {},
+ documentablesMergingTest: (Module) -> Unit? = {},
+ documentablesTransformationTest: (Module) -> Unit? = {},
+ pagesCreationTest: (ModulePageNode) -> Unit? = {},
+ pagesTransformationTest: (ModulePageNode) -> Unit? = {},
+ finalTest: (DokkaConfiguration) -> Unit? = {},
+ logger: DokkaLogger = DokkaConsoleLogger
+ ) {
+
+ val (root, out) = getTestDirs(name)
+ query.toFileMap().materializeFiles(root)
+ DokkaTestGenerator(
+ config(ConfigParams(name, root, out)),
+ logger,
+ setupTest,
+ pluginInitTest,
+ documentablesCreationTest,
+ documentablesMergingTest,
+ documentablesTransformationTest,
+ pagesCreationTest,
+ pagesTransformationTest,
+ finalTest
+ ).generate()
+ }
+
+ fun generatePassesForPlatforms(
+ testName: String,
+ platforms: List<String>,
+ passBuilder: Builders.PassBuilder
+ ): List<Builders.PassBuilder> {
+ fun File.nameLower() = this.name.toLowerCase()
+ fun File.isCommon() = this.nameLower().contains("common")
+ fun File.getPlatforms(platforms: List<String>) =
+ platforms.filter { this.nameLower().contains(it.toLowerCase()) }
+
+
+ val testSrcDirs =
+ srcSetFromName(testName)?.let { fName ->
+ File(fName).listFiles()?.filter { it.isDirectory }
+ } ?: emptyList()
+
+ val dirs =
+ platforms.associateWith { platform ->
+ testSrcDirs.filter { file ->
+ platform == "common" && file.isCommon() && file.getPlatforms(platforms).size == 1 ||
+ platform != "common" && file.nameLower().contains(platform.toLowerCase())
+ }.map { it.path }
+ }.filter { (_, value) -> value.isNotEmpty() }
+
+ return dirs.map { (platform, srcs) ->
+ passBuilder.copy(moduleName = "$testName-$platform", analysisPlatform = platform, sourceRoots = srcs)
+ }
+ }
+
+ fun getTestDirs(name: String) =
+ Files.createTempDirectory(name).also { it.takeIf { it.exists() }?.deleteContents() }
+ .let { it to it.resolve("out").also { it.createDirectories() } }
+ .also { createdDirs += it.first.toFile() }
+
+ fun String.toFileMap(): Map<String, String> = this.replace("\r\n", "\n")
+ .split("\n/")
+ .map {fileString ->
+ fileString.split("\n", limit = 2)
+ .let {
+ it.first().trim().removePrefix("/") to it.last().trim()
+ }
+ }
+ .toMap()
+
+ fun Map<String, String>.materializeFiles(
+ root: Path = Paths.get("."),
+ charset: Charset = Charset.forName("utf-8")
+ ) = this.map { (path, content) ->
+ val file = root.resolve(path)
+ Files.createDirectories(file.parent)
+ Files.write(file, content.toByteArray(charset))
+ }
+
+ fun File.deleteContents() {
+ this.listFiles()?.forEach { it.deleteRecursively() }
+ }
+
+ fun Path.deleteContents() {
+ this.toFile().deleteContents()
+ }
+
+} \ No newline at end of file
diff --git a/core/src/test/kotlin/generator/test/GeneratorTest.kt b/core/src/test/kotlin/generator/test/GeneratorTest.kt
new file mode 100644
index 00000000..97eb8b92
--- /dev/null
+++ b/core/src/test/kotlin/generator/test/GeneratorTest.kt
@@ -0,0 +1,62 @@
+package generator.test
+
+import generator.ConfigParams
+import generator.TestRunner
+import org.jetbrains.dokka.*
+import org.jetbrains.dokka.utilities.DokkaConsoleLogger
+import org.junit.AfterClass
+import org.junit.Rule
+import org.junit.Test
+import org.junit.rules.TestName
+import utils.Builders
+
+class GeneratorTest {
+
+ companion object {
+ @AfterClass @JvmStatic
+ fun cleanup() = TestRunner.cleanup()
+ }
+
+ val builder = Builders.ConfigBuilder(
+ format = "html",
+ generateIndexPages = true
+ )
+
+ val name: TestName = TestName()
+ @Rule
+ fun name(): TestName = name
+
+ val logger = DokkaConsoleLogger
+ fun config(): (ConfigParams) -> DokkaConfiguration = { (name, root, out) ->
+ builder.copy(
+ passesConfigurations = listOf(
+ Builders.PassBuilder(
+ moduleName = name,
+ sourceRoots = listOf(root.toString()),
+ analysisPlatform = "jvm",
+ targets = listOf("jvm")
+ )
+ )
+ )(out.toString())
+ }
+
+ @Test
+ fun test1() {
+ TestRunner.testInline(
+ name = name.methodName,
+ query = """
+ |/src/main/kotlin/test/Test.kt
+ |package test
+ |
+ |object Test {
+ | fun test2(str: String): Unit {println(str)}
+ |}
+ """.trimMargin(),
+ pagesCreationTest = { pages ->
+ val test = pages.parentMap.size == 7
+ if (!test) println(pages.parentMap.size)
+ assert(test)
+ }, config = config(), logger = logger
+ )
+ }
+} \ No newline at end of file
diff --git a/core/src/test/kotlin/generator/test/MultiplatformTest.kt b/core/src/test/kotlin/generator/test/MultiplatformTest.kt
new file mode 100644
index 00000000..2e28797d
--- /dev/null
+++ b/core/src/test/kotlin/generator/test/MultiplatformTest.kt
@@ -0,0 +1,52 @@
+package generator.test
+
+import generator.TestRunner
+import org.jetbrains.dokka.Platform
+import org.jetbrains.dokka.utilities.DokkaConsoleLogger
+import org.junit.AfterClass
+import org.junit.Rule
+import org.junit.Test
+import org.junit.rules.TestName
+import utils.Builders
+
+class MultiplatformTest {
+
+ companion object {
+ @AfterClass @JvmStatic
+ fun cleanup() =
+ TestRunner.cleanup()
+ }
+
+ val platforms = Platform.values().map { it.name }
+
+ val configBuilder = Builders.ConfigBuilder(
+ format = "html",
+ generateIndexPages = true
+ )
+ val passBuilder = Builders.PassBuilder(targets = platforms)
+
+ val name: TestName = TestName()
+ @Rule
+ fun name(): TestName = name
+
+ val logger = DokkaConsoleLogger
+
+ @Test
+ fun example() {
+ val testName = name.methodName
+
+ val passBuilders =
+ TestRunner.generatePassesForPlatforms(testName, platforms, passBuilder)
+
+ TestRunner.testFromSourceSets(
+ name = testName,
+ configBuilder = configBuilder.copy(passesConfigurations = passBuilders),
+ pagesTransformationTest = { assert(it.children.size == 2) },
+ finalTest = {
+ assert(it.passesConfigurations.size == 3)
+ },
+ logger = logger
+ )
+ }
+
+} \ No newline at end of file
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
diff --git a/core/src/test/resources/sourceSets/example/commonMain/kotlin/Clock.kt b/core/src/test/resources/sourceSets/example/commonMain/kotlin/Clock.kt
new file mode 100644
index 00000000..4753cb32
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/commonMain/kotlin/Clock.kt
@@ -0,0 +1,15 @@
+package example
+
+/**
+ * Documentation for expected class Clock
+ * in common module
+ */
+expect open class Clock() {
+ fun getTime(): String
+ /**
+ * Time in minis
+ */
+ fun getTimesInMillis(): String
+ fun getYear(): String
+}
+
diff --git a/core/src/test/resources/sourceSets/example/commonMain/kotlin/House.kt b/core/src/test/resources/sourceSets/example/commonMain/kotlin/House.kt
new file mode 100644
index 00000000..c879dee7
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/commonMain/kotlin/House.kt
@@ -0,0 +1,24 @@
+package example
+
+class House(val street: String, val number: Int) {
+
+ /**
+ * The owner of the house
+ */
+ var owner: String = ""
+
+ /**
+ * The owner of the house
+ */
+ val differentOwner: String = ""
+
+ fun addFloor() {}
+
+ class Basement {
+ val pickles : List<Any> = mutableListOf()
+ }
+
+ companion object {
+ val DEFAULT = House("",0)
+ }
+} \ No newline at end of file
diff --git a/core/src/test/resources/sourceSets/example/jsMain/kotlin/Clock.kt b/core/src/test/resources/sourceSets/example/jsMain/kotlin/Clock.kt
new file mode 100644
index 00000000..967cffcd
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/jsMain/kotlin/Clock.kt
@@ -0,0 +1,21 @@
+package example
+
+import greeteer.Greeter
+import kotlin.js.Date
+
+/**
+ * Documentation for actual class Clock in JS
+ */
+actual open class Clock {
+ actual fun getTime() = Date.now().toString()
+ fun onlyJsFunction(): Int = 42
+ actual fun getTimesInMillis(): String = Date.now().toString()
+
+ actual fun getYear(): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+}
+
+fun main() {
+ Greeter().greet().also { println(it) }
+} \ No newline at end of file
diff --git a/core/src/test/resources/sourceSets/example/jvmAndJsSecondCommonMain/kotlin/Greeter.kt b/core/src/test/resources/sourceSets/example/jvmAndJsSecondCommonMain/kotlin/Greeter.kt
new file mode 100644
index 00000000..8a52e2f3
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/jvmAndJsSecondCommonMain/kotlin/Greeter.kt
@@ -0,0 +1,10 @@
+package greeteer
+
+import example.Clock
+
+class Greeter {
+ /**
+ * Some docs for the [greet] function
+ */
+ fun greet() = Clock().let{ "Hello there! THe time is ${it.getTime()}" }
+} \ No newline at end of file
diff --git a/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/Clock.kt b/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/Clock.kt
new file mode 100644
index 00000000..9ec01fb6
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/Clock.kt
@@ -0,0 +1,34 @@
+package example
+
+import greeteer.Greeter
+
+actual open class Clock {
+ actual fun getTime(): String = System.currentTimeMillis().toString()
+ actual fun getTimesInMillis(): String = System.currentTimeMillis().toString()
+
+ /**
+ * Documentation for onlyJVMFunction on...
+ * wait for it...
+ * ...JVM!
+ */
+ fun onlyJVMFunction(): Double = 2.5
+ /**
+ * Custom equals function
+ */
+ override fun equals(other: Any?): Boolean {
+ return super.equals(other)
+ }
+
+ open fun getDayOfTheWeek(): String {
+ TODO("not implemented")
+ }
+ actual fun getYear(): String {
+ TODO("not implemented")
+ }
+}
+
+fun clockList() = listOf(Clock())
+
+fun main() {
+ Greeter().greet().also { println(it) }
+} \ No newline at end of file
diff --git a/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ClockDays.kt b/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ClockDays.kt
new file mode 100644
index 00000000..136ae5c8
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ClockDays.kt
@@ -0,0 +1,15 @@
+package example
+
+/**
+ * frgergergrthe
+ * */
+enum class ClockDays {
+ /**
+ * dfsdfsdfds
+ * */
+ FIRST,
+ SECOND, // test2
+ THIRD, // test3
+ FOURTH, // test4
+ FIFTH // test5
+} \ No newline at end of file
diff --git a/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ParticularClock.kt b/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ParticularClock.kt
new file mode 100644
index 00000000..40813b50
--- /dev/null
+++ b/core/src/test/resources/sourceSets/example/jvmMain/kotlin/example/ParticularClock.kt
@@ -0,0 +1,32 @@
+package example
+
+import greeteer.Greeter
+
+class ParticularClock(private val clockDay: ClockDays) : Clock() {
+
+ /**
+ * Rings bell [times]
+ */
+ fun ringBell(times: Int) {}
+
+ /**
+ * Uses provider [greeter]
+ */
+ fun useGreeter(greeter: Greeter) {
+
+ }
+
+ /**
+ * Day of the week
+ */
+ override fun getDayOfTheWeek() = clockDay.name
+}
+
+/**
+ * A sample extension function
+ * When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
+ * @usesMathJax
+ */
+fun Clock.extensionFun() {
+
+} \ No newline at end of file