From 4002c4e91cb42ef77e93cac57ac49823629d33da Mon Sep 17 00:00:00 2001 From: Szymon Świstun Date: Thu, 27 Feb 2020 14:50:27 +0100 Subject: Add expect with generation --- .../src/test/kotlin/expect/AbstractExpectTest.kt | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt (limited to 'plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt') diff --git a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt new file mode 100644 index 00000000..ef97b04c --- /dev/null +++ b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt @@ -0,0 +1,104 @@ +package expect + +import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest +import org.junit.jupiter.api.Assertions.assertTrue +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths +import java.util.concurrent.TimeUnit + +abstract class AbstractExpectTest( + val testDir: Path? = Paths.get("src/test", "resources", "expect"), + val formats: List = listOf("html") +) : AbstractCoreTest() { + + protected fun generateOutput(path: Path, outFormat: String): Path? { + val config = dokkaConfiguration { + format = outFormat + passes { + pass { + sourceRoots = listOf(path.asString()) + } + } + } + + var result: Path? = null + testFromData(config, cleanupOutput = false) { + renderingStage = { _, context -> result = Paths.get(context.configuration.outputDir) } + } + return result + } + + protected fun compareOutput(expected: Path, obtained: Path?, gitTimeout: Long = 500) { + obtained?.let { path -> + val gitCompare = ProcessBuilder( + "git", + "--no-pager", + "diff", + expected.asString(), + path.asString() + ).also { logger.info("git diff command: ${it.command().joinToString(" ")}") } + .also { it.redirectErrorStream() }.start() + + assertTrue(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS)) { "Git timed out after $gitTimeout" } + gitCompare.inputStream.bufferedReader().lines().forEach { logger.info(it) } + assertTrue(gitCompare.exitValue() == 0) { "${path.fileName}: outputs don't match" } + } ?: throw AssertionError("obtained path is null") + } + + protected fun compareOutputWithExcludes( + expected: Path, + obtained: Path?, + excludes: List, + timeout: Long = 500 + ) { + obtained?.let { path -> + val (res, out, err) = runDiff(expected, obtained, excludes, timeout) + assertTrue(res == 0, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}") + } ?: throw AssertionError("obtained path is null") + } + + protected fun runDiff(exp: Path, obt: Path, excludes: List, timeout: Long): ProcessResult = + ProcessBuilder().command( + listOf("diff", "-ru") + excludes.flatMap { listOf("-x", it) } + listOf("--", exp.asString(), obt.asString()) + ).also { + it.redirectErrorStream() + }.start().also { assertTrue(it.waitFor(timeout, TimeUnit.MILLISECONDS), "diff timed out") }.let { + ProcessResult(it.exitValue(), it.inputStream.bufferResult()) + } + + + protected fun testOutput(p: Path, outFormat: String) { + val expectOut = p.resolve("out/$outFormat") + val testOut = generateOutput(p.resolve("src"), outFormat) + .also { logger.info("Test out: ${it?.asString()}") } + + compareOutput(expectOut.toAbsolutePath(), testOut?.toAbsolutePath()) + testOut?.deleteRecursively() + } + + protected fun testOutputWithExcludes( + p: Path, + outFormat: String, + ignores: List = emptyList(), + timeout: Long = 500 + ) { + val expected = p.resolve("out/$outFormat") + generateOutput(p.resolve("src"), outFormat) + ?.let { obtained -> + compareOutputWithExcludes(expected, obtained, ignores, timeout) + + obtained.deleteRecursively() + } ?: throw AssertionError("Output not generated for ${p.fileName}") + } + + protected fun generateExpect(p: Path, outFormat: String) { + val out = p.resolve("out/$outFormat/") + Files.createDirectories(out) + + val ret = generateOutput(p.resolve("src"), outFormat) + Files.list(out).forEach { it.deleteRecursively() } + ret?.let { Files.list(it).forEach { f -> f.copyRecursively(out.resolve(f.fileName)) } } + } + +} \ No newline at end of file -- cgit From 3f2a790190da4f40ea6d8a976aa1929b2a1b002b Mon Sep 17 00:00:00 2001 From: Błażej Kardyś Date: Tue, 5 May 2020 17:45:12 +0200 Subject: Changing approach from platform-driven to source-set-driven --- .idea/compiler.xml | 36 +++ core/src/main/kotlin/DokkaGenerator.kt | 36 +-- core/src/main/kotlin/configuration.kt | 6 +- core/src/main/kotlin/defaultConfiguration.kt | 2 + core/src/main/kotlin/model/Documentable.kt | 168 ++++++-------- core/src/main/kotlin/model/SourceSetData.kt | 23 ++ core/src/main/kotlin/model/aditionalExtras.kt | 4 +- core/src/main/kotlin/model/documentableUtils.kt | 15 +- core/src/main/kotlin/pages/ContentNodes.kt | 29 +-- core/src/main/kotlin/pages/PageNodes.kt | 5 +- core/src/main/kotlin/plugability/DokkaContext.kt | 14 +- .../PreMergeDocumentableTransformer.kt | 2 +- .../sources/SourceToDocumentableTranslator.kt | 4 +- plugins/base/src/main/kotlin/DokkaBase.kt | 6 +- .../src/main/kotlin/renderers/DefaultRenderer.kt | 21 +- .../src/main/kotlin/renderers/html/HtmlRenderer.kt | 58 ++--- .../main/kotlin/renderers/html/NavigationPage.kt | 4 +- .../resolvers/local/DefaultLocationProvider.kt | 9 +- .../kotlin/resolvers/local/LocationProvider.kt | 4 +- .../kotlin/signatures/KotlinSignatureProvider.kt | 35 ++- .../documentables/ActualTypealiasAdder.kt | 8 +- .../documentables/DefaultDocumentableMerger.kt | 233 ++++++++----------- .../documentables/DocumentableVisibilityFilter.kt | 55 +++-- .../InheritorsExtractorTransformer.kt | 23 +- .../ModuleAndPackageDocumentationTransformer.kt | 42 ++-- .../pages/comments/CommentsToContentConverter.kt | 3 +- .../pages/comments/DocTagToContentConverter.kt | 33 +-- .../merger/SameMethodNamePageMergerStrategy.kt | 2 +- .../pages/samples/SamplesTransformer.kt | 25 +- .../pages/sourcelinks/SourceLinksTransformer.kt | 23 +- .../DefaultDescriptorToDocumentableTranslator.kt | 252 ++++++++++----------- .../documentables/DefaultPageCreator.kt | 111 +++++---- .../documentables/PageContentBuilder.kt | 98 ++++---- .../psi/DefaultPsiToDocumentableTranslator.kt | 57 +++-- .../src/test/kotlin/expect/AbstractExpectTest.kt | 2 +- .../kotlin/linkableContent/LinkableContentTest.kt | 6 + plugins/base/src/test/kotlin/model/ClassesTest.kt | 20 +- .../base/src/test/kotlin/model/InheritorsTest.kt | 10 +- plugins/base/src/test/kotlin/model/JavaTest.kt | 4 +- plugins/base/src/test/kotlin/model/PackagesTest.kt | 4 +- .../test/kotlin/renderers/RenderingOnlyTestBase.kt | 7 +- .../renderers/html/PlatformDependentHintTest.kt | 120 ---------- .../renderers/html/SourceSetDependentHintTest.kt | 121 ++++++++++ .../annotatedFunction/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../annotatedFunction/out/html/root/index.html | 4 +- .../annotatedFunction/out/html/root/package-list | 4 +- .../annotatedFunction/out/html/scripts/pages.js | 0 .../out/html/navigation.html | 10 +- .../out/html/root/[jvm root]/-fancy/-init-.html | 32 --- .../out/html/root/[jvm root]/-fancy/equals.html | 32 --- .../out/html/root/[jvm root]/-fancy/hash-code.html | 32 --- .../out/html/root/[jvm root]/-fancy/index.html | 102 --------- .../out/html/root/[jvm root]/-fancy/to-string.html | 32 --- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 69 ------ .../out/html/root/[main root]/-fancy/-init-.html | 32 +++ .../out/html/root/[main root]/-fancy/equals.html | 32 +++ .../html/root/[main root]/-fancy/hash-code.html | 32 +++ .../out/html/root/[main root]/-fancy/index.html | 102 +++++++++ .../html/root/[main root]/-fancy/to-string.html | 32 +++ .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 69 ++++++ .../out/html/root/index.html | 4 +- .../out/html/root/package-list | 10 +- .../expect/function/out/html/navigation.html | 6 +- .../function/out/html/root/[jvm root]/fn.html | 34 --- .../function/out/html/root/[jvm root]/index.html | 50 ---- .../function/out/html/root/[main root]/fn.html | 34 +++ .../function/out/html/root/[main root]/index.html | 50 ++++ .../expect/function/out/html/root/index.html | 4 +- .../expect/function/out/html/root/package-list | 4 +- .../out/html/navigation.html | 10 +- .../out/html/root/[jvm root]/-fancy/-init-.html | 32 --- .../out/html/root/[jvm root]/-fancy/equals.html | 32 --- .../out/html/root/[jvm root]/-fancy/hash-code.html | 32 --- .../out/html/root/[jvm root]/-fancy/index.html | 83 ------- .../out/html/root/[jvm root]/-fancy/to-string.html | 32 --- .../out/html/root/[jvm root]/function.html | 32 --- .../out/html/root/[jvm root]/index.html | 69 ------ .../out/html/root/[main root]/-fancy/-init-.html | 32 +++ .../out/html/root/[main root]/-fancy/equals.html | 32 +++ .../html/root/[main root]/-fancy/hash-code.html | 32 +++ .../out/html/root/[main root]/-fancy/index.html | 83 +++++++ .../html/root/[main root]/-fancy/to-string.html | 32 +++ .../out/html/root/[main root]/function.html | 32 +++ .../out/html/root/[main root]/index.html | 69 ++++++ .../out/html/root/index.html | 4 +- .../out/html/root/package-list | 10 +- .../out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../out/html/root/index.html | 4 +- .../out/html/root/package-list | 4 +- .../out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/function.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/function.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../out/html/root/index.html | 4 +- .../out/html/root/package-list | 4 +- .../out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../out/html/root/index.html | 4 +- .../out/html/root/package-list | 4 +- .../functionWithParams/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/function.html | 34 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/function.html | 34 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../functionWithParams/out/html/root/index.html | 4 +- .../functionWithParams/out/html/root/package-list | 4 +- .../functionWithReceiver/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/fn.html | 40 ---- .../out/html/root/[jvm root]/index.html | 66 ------ .../out/html/root/[main root]/fn.html | 40 ++++ .../out/html/root/[main root]/index.html | 66 ++++++ .../functionWithReceiver/out/html/root/index.html | 4 +- .../out/html/root/package-list | 6 +- .../genericFunction/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/generic.html | 34 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/generic.html | 34 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../genericFunction/out/html/root/index.html | 4 +- .../genericFunction/out/html/root/package-list | 4 +- .../out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/generic.html | 34 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/generic.html | 34 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../out/html/root/index.html | 4 +- .../out/html/root/package-list | 4 +- .../expect/inlineFunction/out/html/navigation.html | 6 +- .../inlineFunction/out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../expect/inlineFunction/out/html/root/index.html | 4 +- .../inlineFunction/out/html/root/package-list | 4 +- .../inlineSuspendFunction/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../inlineSuspendFunction/out/html/root/index.html | 4 +- .../out/html/root/package-list | 4 +- .../expect/signatureTest/out/html/root/index.html | 2 +- .../out/html/root/signatureTest/index.html | 8 +- .../out/html/root/signatureTest/test.html | 2 +- .../out/html/root/signatureTest/test2.html | 2 +- .../expect/sinceKotlin/out/html/navigation.html | 6 +- .../html/root/[jvm root]/available-since1.1.html | 34 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../html/root/[main root]/available-since1.1.html | 34 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../expect/sinceKotlin/out/html/root/index.html | 4 +- .../expect/sinceKotlin/out/html/root/package-list | 4 +- .../suspendFunction/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../suspendFunction/out/html/root/index.html | 4 +- .../suspendFunction/out/html/root/package-list | 4 +- .../suspendInlineFunction/out/html/navigation.html | 6 +- .../out/html/root/[jvm root]/f.html | 32 --- .../out/html/root/[jvm root]/index.html | 50 ---- .../out/html/root/[main root]/f.html | 32 +++ .../out/html/root/[main root]/index.html | 50 ++++ .../suspendInlineFunction/out/html/root/index.html | 4 +- .../out/html/root/package-list | 4 +- plugins/gfm/src/main/kotlin/GfmPlugin.kt | 11 +- .../kotlin/converters/KotlinToJavaConverter.kt | 86 +++---- .../kotlin/signatures/JavaSignatureProvider.kt | 4 +- runners/cli/src/main/kotlin/cli/main.kt | 11 + .../dokka/gradle/ConfigurationExtractor.kt | 144 ++++++------ .../kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt | 47 ++-- .../dokka/gradle/configurationImplementations.kt | 2 + .../main/kotlin/org/jetbrains/dokka/gradle/main.kt | 4 +- .../kotlin/org/jetbrains/dokka/gradle/utils.kt | 14 +- runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 7 +- .../src/main/kotlin/testApi/context/MockContext.kt | 12 +- .../testApi/testRunner/DokkaTestGenerator.kt | 11 +- .../main/kotlin/testApi/testRunner/TestRunner.kt | 10 +- 193 files changed, 3010 insertions(+), 3003 deletions(-) create mode 100644 core/src/main/kotlin/model/SourceSetData.kt delete mode 100644 plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt create mode 100644 plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunction/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunction/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunction/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunction/out/html/root/[main root]/index.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunction/out/html/scripts/pages.js delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/-fancy/-init-.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/-fancy/equals.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/-fancy/hash-code.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/-fancy/index.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/-fancy/to-string.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/-fancy/-init-.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/-fancy/equals.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/-fancy/hash-code.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/-fancy/index.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/-fancy/to-string.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/annotatedFunctionWithAnnotationParameters/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/function/out/html/root/[jvm root]/fn.html delete mode 100644 plugins/base/src/test/resources/expect/function/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/function/out/html/root/[main root]/fn.html create mode 100644 plugins/base/src/test/resources/expect/function/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/-fancy/-init-.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/-fancy/equals.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/-fancy/hash-code.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/-fancy/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/-fancy/to-string.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/function.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/-fancy/-init-.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/-fancy/equals.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/-fancy/hash-code.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/-fancy/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/-fancy/to-string.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/function.html create mode 100644 plugins/base/src/test/resources/expect/functionWithAnnotatedParam/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithDefaultParameter/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithDefaultParameter/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithDefaultParameter/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/functionWithDefaultParameter/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithNoinlineParam/out/html/root/[jvm root]/function.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithNoinlineParam/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithNoinlineParam/out/html/root/[main root]/function.html create mode 100644 plugins/base/src/test/resources/expect/functionWithNoinlineParam/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithNotDocumentedAnnotation/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithNotDocumentedAnnotation/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithNotDocumentedAnnotation/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/functionWithNotDocumentedAnnotation/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithParams/out/html/root/[jvm root]/function.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithParams/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithParams/out/html/root/[main root]/function.html create mode 100644 plugins/base/src/test/resources/expect/functionWithParams/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithReceiver/out/html/root/[jvm root]/fn.html delete mode 100644 plugins/base/src/test/resources/expect/functionWithReceiver/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/functionWithReceiver/out/html/root/[main root]/fn.html create mode 100644 plugins/base/src/test/resources/expect/functionWithReceiver/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/genericFunction/out/html/root/[jvm root]/generic.html delete mode 100644 plugins/base/src/test/resources/expect/genericFunction/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/genericFunction/out/html/root/[main root]/generic.html create mode 100644 plugins/base/src/test/resources/expect/genericFunction/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/genericFunctionWithConstraints/out/html/root/[jvm root]/generic.html delete mode 100644 plugins/base/src/test/resources/expect/genericFunctionWithConstraints/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/genericFunctionWithConstraints/out/html/root/[main root]/generic.html create mode 100644 plugins/base/src/test/resources/expect/genericFunctionWithConstraints/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/inlineFunction/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/inlineFunction/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/inlineFunction/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/inlineFunction/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/inlineSuspendFunction/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/inlineSuspendFunction/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/inlineSuspendFunction/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/inlineSuspendFunction/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/sinceKotlin/out/html/root/[jvm root]/available-since1.1.html delete mode 100644 plugins/base/src/test/resources/expect/sinceKotlin/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/sinceKotlin/out/html/root/[main root]/available-since1.1.html create mode 100644 plugins/base/src/test/resources/expect/sinceKotlin/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/suspendFunction/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/suspendFunction/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/suspendFunction/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/suspendFunction/out/html/root/[main root]/index.html delete mode 100644 plugins/base/src/test/resources/expect/suspendInlineFunction/out/html/root/[jvm root]/f.html delete mode 100644 plugins/base/src/test/resources/expect/suspendInlineFunction/out/html/root/[jvm root]/index.html create mode 100644 plugins/base/src/test/resources/expect/suspendInlineFunction/out/html/root/[main root]/f.html create mode 100644 plugins/base/src/test/resources/expect/suspendInlineFunction/out/html/root/[main root]/index.html (limited to 'plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt') diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 7ee14d19..a7e03ba2 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -16,8 +16,14 @@ + + + + + + @@ -78,14 +84,24 @@ + + + + + + + + + + @@ -101,6 +117,8 @@ + + @@ -110,6 +128,10 @@ + + + + @@ -126,6 +148,8 @@ + + @@ -150,6 +174,18 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index 053b4cb6..6e62c033 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -1,23 +1,20 @@ package org.jetbrains.dokka -import com.intellij.openapi.vfs.VirtualFileManager -import com.intellij.psi.PsiJavaFile -import com.intellij.psi.PsiManager import org.jetbrains.dokka.analysis.AnalysisEnvironment import org.jetbrains.dokka.analysis.DokkaResolutionFacade import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.pages.PlatformData +import org.jetbrains.dokka.model.SourceSetCache +import org.jetbrains.dokka.model.SourceSetData +import org.jetbrains.dokka.model.sourceSet import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.utilities.DokkaLogger -import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.common.messages.MessageRenderer import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot import org.jetbrains.kotlin.utils.PathUtil import java.io.File @@ -31,13 +28,14 @@ class DokkaGenerator( ) { fun generate() = timed { report("Setting up analysis environments") - val platforms: Map = setUpAnalysis(configuration) + val sourceSetsCache = SourceSetCache() + val sourceSets: Map = setUpAnalysis(configuration, sourceSetsCache) report("Initializing plugins") - val context = initializePlugins(configuration, logger, platforms) + val context = initializePlugins(configuration, logger, sourceSets, sourceSetsCache) report("Creating documentation models") - val modulesFromPlatforms = createDocumentationModels(platforms, context) + val modulesFromPlatforms = createDocumentationModels(sourceSets, context) report("Transforming documentation model before merging") val transformedDocumentationBeforeMerge = transformDocumentationModelBeforeMerge(modulesFromPlatforms, context) @@ -62,27 +60,31 @@ class DokkaGenerator( logger.report() }.dump("\n\n === TIME MEASUREMENT ===\n") - fun setUpAnalysis(configuration: DokkaConfiguration): Map = + fun setUpAnalysis( + configuration: DokkaConfiguration, + sourceSetsCache: SourceSetCache + ): Map = configuration.passesConfigurations.map { - it.platformData to createEnvironmentAndFacade(it) + sourceSetsCache.getSourceSet(it) to createEnvironmentAndFacade(it) }.toMap() fun initializePlugins( configuration: DokkaConfiguration, logger: DokkaLogger, - platforms: Map, + sourceSets: Map, + sourceSetsCache: SourceSetCache, pluginOverrides: List = emptyList() - ) = DokkaContext.create(configuration, logger, platforms, pluginOverrides) + ) = DokkaContext.create(configuration, logger, sourceSets, sourceSetsCache, pluginOverrides) fun createDocumentationModels( - platforms: Map, + platforms: Map, context: DokkaContext ) = platforms.flatMap { (pdata, _) -> translateSources(pdata, context) } fun transformDocumentationModelBeforeMerge( modulesFromPlatforms: List, context: DokkaContext - ) = context[CoreExtensions.preMergeDocumentableTransformer].fold(modulesFromPlatforms) { acc, t -> t(acc, context) } + ) = context[CoreExtensions.preMergeDocumentableTransformer].fold(modulesFromPlatforms) { acc, t -> t(acc) } fun mergeDocumentationModels( modulesFromPlatforms: List, @@ -119,7 +121,7 @@ class DokkaGenerator( } pass.classpath.forEach { addClasspath(File(it)) } - addSources(pass.sourceRoots.map { it.path }) + addSources((pass.sourceRoots + pass.dependentSourceRoots).map { it.path }) loadLanguageVersionSettings(pass.languageVersion, pass.apiVersion) @@ -128,7 +130,7 @@ class DokkaGenerator( EnvironmentAndFacade(environment, facade) } - private fun translateSources(platformData: PlatformData, context: DokkaContext) = + private fun translateSources(platformData: SourceSetData, context: DokkaContext) = context[CoreExtensions.sourceToDocumentableTranslator].map { it.invoke(platformData, context) } diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index 34671c4e..88924924 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -1,6 +1,5 @@ package org.jetbrains.dokka -import org.jetbrains.dokka.pages.PlatformData import java.io.File import java.net.URL @@ -37,8 +36,10 @@ interface DokkaConfiguration { interface PassConfiguration { val moduleName: String + val sourceSetName: String val classpath: List val sourceRoots: List + val dependentSourceRoots: List val samples: List val includes: List val includeNonPublic: Boolean @@ -59,9 +60,6 @@ interface DokkaConfiguration { val analysisPlatform: Platform val targets: List val sinceKotlin: String? - - val platformData: PlatformData - get() = PlatformData(moduleName, analysisPlatform, targets) } interface SourceRoot { diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index ae674ea1..08f70b45 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -16,8 +16,10 @@ data class DokkaConfigurationImpl( data class PassConfigurationImpl ( override val moduleName: String, + override val sourceSetName: String, override val classpath: List, override val sourceRoots: List, + override val dependentSourceRoots: List, override val samples: List, override val includes: List, override val includeNonPublic: Boolean, diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 313f4cd4..85487725 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -1,11 +1,12 @@ package org.jetbrains.dokka.model import com.intellij.psi.PsiNamedElement +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.Platform import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.WithExtraProperties -import org.jetbrains.dokka.pages.PlatformData import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.load.kotlin.toSourceElement @@ -13,8 +14,9 @@ abstract class Documentable { abstract val name: String? abstract val dri: DRI abstract val children: List - abstract val documentation: PlatformDependent - abstract val platformData: List + abstract val documentation: SourceSetDependent + abstract val sourceSets: List + abstract val expectPresentInSet: SourceSetData? override fun toString(): String = "${javaClass.simpleName}($dri)" @@ -25,45 +27,10 @@ abstract class Documentable { override fun hashCode() = dri.hashCode() } -data class PlatformDependent( - val map: Map, - val expect: T? = null -) : Map by map { - val prevalentValue: T? - get() = map.values.distinct().singleOrNull() - - val allValues: Sequence = sequence { - expect?.also { yield(it) } - yieldAll(map.values) - } - - val allEntries: Sequence> = sequence { - expect?.also { yield(null to it) } - map.forEach { (k, v) -> yield(k to v) } - } - - fun getOrExpect(platform: PlatformData): T? = map[platform] ?: expect - - companion object { - fun empty(): PlatformDependent = PlatformDependent(emptyMap()) - - fun from(platformData: PlatformData, element: T) = PlatformDependent(mapOf(platformData to element)) - - @Suppress("UNCHECKED_CAST") - fun from(pairs: Iterable>) = - PlatformDependent( - pairs.filter { it.first != null }.toMap() as Map, - pairs.firstOrNull { it.first == null }?.second - ) - - fun from(vararg pairs: Pair) = from(pairs.asIterable()) - - fun expectFrom(element: T) = PlatformDependent(map = emptyMap(), expect = element) - } -} +typealias SourceSetDependent = Map interface WithExpectActual { - val sources: PlatformDependent + val sources: SourceSetDependent } interface WithScope { @@ -73,7 +40,7 @@ interface WithScope { } interface WithVisibility { - val visibility: PlatformDependent + val visibility: SourceSetDependent } interface WithType { @@ -81,7 +48,7 @@ interface WithType { } interface WithAbstraction { - val modifier: PlatformDependent + val modifier: SourceSetDependent } sealed class Modifier(val name: String) @@ -112,7 +79,7 @@ interface WithGenerics { } interface WithSupertypes { - val supertypes: PlatformDependent> + val supertypes: SourceSetDependent> } interface Callable : WithVisibility, WithType, WithAbstraction, WithExpectActual { @@ -124,8 +91,9 @@ sealed class DClasslike : Documentable(), WithScope, WithVisibility, WithExpectA data class DModule( override val name: String, val packages: List, - override val documentation: PlatformDependent, - override val platformData: List, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData? = null, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithExtraProperties { override val dri: DRI = DRI.topLevel @@ -141,8 +109,9 @@ data class DPackage( override val properties: List, override val classlikes: List, val typealiases: List, - override val documentation: PlatformDependent, - override val platformData: List, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData? = null, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties { override val name = dri.packageName.orEmpty() @@ -159,14 +128,15 @@ data class DClass( override val functions: List, override val properties: List, override val classlikes: List, - override val sources: PlatformDependent, - override val visibility: PlatformDependent, + override val sources: SourceSetDependent, + override val visibility: SourceSetDependent, override val companion: DObject?, override val generics: List, - override val supertypes: PlatformDependent>, - override val documentation: PlatformDependent, - override val modifier: PlatformDependent, - override val platformData: List, + override val supertypes: SourceSetDependent>, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val modifier: SourceSetDependent, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes, WithExtraProperties { @@ -181,16 +151,17 @@ data class DEnum( override val dri: DRI, override val name: String, val entries: List, - override val documentation: PlatformDependent, - override val sources: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sources: SourceSetDependent, override val functions: List, override val properties: List, override val classlikes: List, - override val visibility: PlatformDependent, + override val visibility: SourceSetDependent, override val companion: DObject?, override val constructors: List, - override val supertypes: PlatformDependent>, - override val platformData: List, + override val supertypes: SourceSetDependent>, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties { override val children: List @@ -202,11 +173,12 @@ data class DEnum( data class DEnumEntry( override val dri: DRI, override val name: String, - override val documentation: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, override val functions: List, override val properties: List, override val classlikes: List, - override val platformData: List, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties { override val children: List @@ -220,14 +192,15 @@ data class DFunction( override val name: String, val isConstructor: Boolean, val parameters: List, - override val documentation: PlatformDependent, - override val sources: PlatformDependent, - override val visibility: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sources: SourceSetDependent, + override val visibility: SourceSetDependent, override val type: Bound, override val generics: List, override val receiver: DParameter?, - override val modifier: PlatformDependent, - override val platformData: List, + override val modifier: SourceSetDependent, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), Callable, WithGenerics, WithExtraProperties { override val children: List @@ -239,16 +212,17 @@ data class DFunction( data class DInterface( override val dri: DRI, override val name: String, - override val documentation: PlatformDependent, - override val sources: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sources: SourceSetDependent, override val functions: List, override val properties: List, override val classlikes: List, - override val visibility: PlatformDependent, + override val visibility: SourceSetDependent, override val companion: DObject?, override val generics: List, - override val supertypes: PlatformDependent>, - override val platformData: List, + override val supertypes: SourceSetDependent>, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties { override val children: List @@ -260,14 +234,15 @@ data class DInterface( data class DObject( override val name: String?, override val dri: DRI, - override val documentation: PlatformDependent, - override val sources: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sources: SourceSetDependent, override val functions: List, override val properties: List, override val classlikes: List, - override val visibility: PlatformDependent, - override val supertypes: PlatformDependent>, - override val platformData: List, + override val visibility: SourceSetDependent, + override val supertypes: SourceSetDependent>, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithSupertypes, WithExtraProperties { override val children: List @@ -279,15 +254,16 @@ data class DObject( data class DAnnotation( override val name: String, override val dri: DRI, - override val documentation: PlatformDependent, - override val sources: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sources: SourceSetDependent, override val functions: List, override val properties: List, override val classlikes: List, - override val visibility: PlatformDependent, + override val visibility: SourceSetDependent, override val companion: DObject?, override val constructors: List, - override val platformData: List, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties { override val children: List @@ -299,15 +275,16 @@ data class DAnnotation( data class DProperty( override val dri: DRI, override val name: String, - override val documentation: PlatformDependent, - override val sources: PlatformDependent, - override val visibility: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sources: SourceSetDependent, + override val visibility: SourceSetDependent, override val type: Bound, override val receiver: DParameter?, val setter: DFunction?, val getter: DFunction?, - override val modifier: PlatformDependent, - override val platformData: List, + override val modifier: SourceSetDependent, + override val sourceSets: List, override val generics: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), Callable, WithExtraProperties, WithGenerics { @@ -321,9 +298,10 @@ data class DProperty( data class DParameter( override val dri: DRI, override val name: String?, - override val documentation: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, val type: Bound, - override val platformData: List, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithExtraProperties { override val children: List @@ -335,9 +313,10 @@ data class DParameter( data class DTypeParameter( override val dri: DRI, override val name: String, - override val documentation: PlatformDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, val bounds: List, - override val platformData: List, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithExtraProperties { override val children: List @@ -350,10 +329,11 @@ data class DTypeAlias( override val dri: DRI, override val name: String, override val type: Bound, - val underlyingType: PlatformDependent, - override val visibility: PlatformDependent, - override val documentation: PlatformDependent, - override val platformData: List, + val underlyingType: SourceSetDependent, + override val visibility: SourceSetDependent, + override val documentation: SourceSetDependent, + override val expectPresentInSet: SourceSetData?, + override val sourceSets: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithType, WithVisibility, WithExtraProperties { override val children: List @@ -417,7 +397,7 @@ sealed class JavaVisibility(name: String) : Visibility(name) { object Default : JavaVisibility("") } -fun PlatformDependent?.orEmpty(): PlatformDependent = this ?: PlatformDependent.empty() +fun SourceSetDependent?.orEmpty(): SourceSetDependent = this ?: emptyMap() interface DocumentableSource { val path: String @@ -429,4 +409,4 @@ class DescriptorDocumentableSource(val descriptor: DeclarationDescriptor) : Docu class PsiDocumentableSource(val psi: PsiNamedElement) : DocumentableSource { override val path = psi.containingFile.virtualFile.path -} +} \ No newline at end of file diff --git a/core/src/main/kotlin/model/SourceSetData.kt b/core/src/main/kotlin/model/SourceSetData.kt new file mode 100644 index 00000000..8f67f272 --- /dev/null +++ b/core/src/main/kotlin/model/SourceSetData.kt @@ -0,0 +1,23 @@ +package org.jetbrains.dokka.model + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.Platform +import org.jetbrains.dokka.plugability.DokkaContext + +data class SourceSetData( + val moduleName: String, + val sourceSetName: String, + val platform: Platform, + val sourceRoots: List = emptyList() +) + +class SourceSetCache { + private val sourceSets = HashMap() + + fun getSourceSet(pass: DokkaConfiguration.PassConfiguration) = + sourceSets.getOrPut("${pass.moduleName}/${pass.sourceSetName}", + { SourceSetData(pass.moduleName, pass.sourceSetName, pass.analysisPlatform, pass.sourceRoots) } + ) +} + +fun DokkaContext.sourceSet(pass: DokkaConfiguration.PassConfiguration) : SourceSetData = sourceSetCache.getSourceSet(pass) \ No newline at end of file diff --git a/core/src/main/kotlin/model/aditionalExtras.kt b/core/src/main/kotlin/model/aditionalExtras.kt index 58209939..27ad8a55 100644 --- a/core/src/main/kotlin/model/aditionalExtras.kt +++ b/core/src/main/kotlin/model/aditionalExtras.kt @@ -41,13 +41,13 @@ object PrimaryConstructorExtra : ExtraProperty, ExtraProperty.Key = this } -data class ActualTypealias(val underlyingType: PlatformDependent) : ExtraProperty { +data class ActualTypealias(val underlyingType: SourceSetDependent) : ExtraProperty { companion object : ExtraProperty.Key { override fun mergeStrategyFor( left: ActualTypealias, right: ActualTypealias ) = - MergeStrategy.Replace(ActualTypealias(PlatformDependent(left.underlyingType + right.underlyingType))) + MergeStrategy.Replace(ActualTypealias(left.underlyingType + right.underlyingType)) } override val key: ExtraProperty.Key = ActualTypealias diff --git a/core/src/main/kotlin/model/documentableUtils.kt b/core/src/main/kotlin/model/documentableUtils.kt index 7f946344..b09260ee 100644 --- a/core/src/main/kotlin/model/documentableUtils.kt +++ b/core/src/main/kotlin/model/documentableUtils.kt @@ -1,21 +1,18 @@ package org.jetbrains.dokka.model -import org.jetbrains.dokka.pages.PlatformData +fun SourceSetDependent.filtered(platformDataList: List) = filter { it.key in platformDataList } +fun SourceSetData?.filtered(platformDataList: List) = takeIf { this in platformDataList } -fun PlatformDependent.filtered(platformDataList: List) = PlatformDependent( - map.filter { it.key in platformDataList }, - expect -) - -fun DTypeParameter.filter(filteredData: List) = - if (filteredData.containsAll(platformData)) this +fun DTypeParameter.filter(filteredData: List) = + if (filteredData.containsAll(sourceSets)) this else { - val intersection = filteredData.intersect(platformData).toList() + val intersection = filteredData.intersect(sourceSets).toList() if (intersection.isEmpty()) null else DTypeParameter( dri, name, documentation.filtered(intersection), + expectPresentInSet?.takeIf { intersection.contains(expectPresentInSet) }, bounds, intersection, extra diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index 26bcdf77..bb669199 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -1,6 +1,7 @@ package org.jetbrains.dokka.pages import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.WithExtraProperties @@ -10,7 +11,7 @@ data class DCI(val dri: Set, val kind: Kind) { interface ContentNode : WithExtraProperties { val dci: DCI - val platforms: Set + val sourceSets: Set val style: Set