diff options
Diffstat (limited to 'core/src')
15 files changed, 103 insertions, 65 deletions
diff --git a/core/src/main/kotlin/Formats/GFMFormatService.kt b/core/src/main/kotlin/Formats/GFMFormatService.kt index cfb7fc03..cb31a1d3 100644 --- a/core/src/main/kotlin/Formats/GFMFormatService.kt +++ b/core/src/main/kotlin/Formats/GFMFormatService.kt @@ -3,11 +3,12 @@ package org.jetbrains.dokka import com.google.inject.Inject open class GFMOutputBuilder(to: StringBuilder, - location: Location, - locationService: LocationService, - languageService: LanguageService, - extension: String) - : MarkdownOutputBuilder(to, location, locationService, languageService, extension) + location: Location, + locationService: LocationService, + languageService: LanguageService, + extension: String, + impliedPlatforms: List<String>) + : MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { override fun appendTable(vararg columns: String, body: () -> Unit) { to.appendln(columns.joinToString(" | ", "| ", " |")) @@ -45,12 +46,14 @@ open class GFMOutputBuilder(to: StringBuilder, open class GFMFormatService(locationService: LocationService, signatureGenerator: LanguageService, - linkExtension: String) -: MarkdownFormatService(locationService, signatureGenerator, linkExtension) { + linkExtension: String, + impliedPlatforms: List<String>) +: MarkdownFormatService(locationService, signatureGenerator, linkExtension, impliedPlatforms) { @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService) : this(locationService, signatureGenerator, "md") + signatureGenerator: LanguageService, + impliedPlatforms: List<String>) : this(locationService, signatureGenerator, "md", impliedPlatforms) override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder = - GFMOutputBuilder(to, location, locationService, languageService, extension) + GFMOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index d73e4e62..6819e652 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -2,6 +2,7 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.name.Named +import org.jetbrains.dokka.Utilities.impliedPlatformsName import java.io.File import java.nio.file.Path import java.nio.file.Paths @@ -11,8 +12,9 @@ open class HtmlOutputBuilder(to: StringBuilder, locationService: LocationService, languageService: LanguageService, extension: String, + impliedPlatforms: List<String>, val templateService: HtmlTemplateService) - : StructuredOutputBuilder(to, location, locationService, languageService, extension) + : StructuredOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { override fun appendText(text: String) { to.append(text.htmlEscape()) @@ -95,7 +97,8 @@ open class HtmlOutputBuilder(to: StringBuilder, open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService, signatureGenerator: LanguageService, - val templateService: HtmlTemplateService) + val templateService: HtmlTemplateService, + @Named(impliedPlatformsName) val impliedPlatforms: List<String>) : StructuredFormatService(locationService, signatureGenerator, "html"), OutlineFormatService { override fun enumerateSupportFiles(callback: (String, String) -> Unit) { @@ -103,7 +106,7 @@ open class HtmlFormatService @Inject constructor(@Named("folders") locationServi } override fun createOutputBuilder(to: StringBuilder, location: Location) = - HtmlOutputBuilder(to, location, locationService, languageService, extension, templateService) + HtmlOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms, templateService) override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) { templateService.appendHeader(to, "Module Contents", locationService.calcPathToRoot(location)) diff --git a/core/src/main/kotlin/Formats/JekyllFormatService.kt b/core/src/main/kotlin/Formats/JekyllFormatService.kt index bab73379..d217bf38 100644 --- a/core/src/main/kotlin/Formats/JekyllFormatService.kt +++ b/core/src/main/kotlin/Formats/JekyllFormatService.kt @@ -1,13 +1,16 @@ package org.jetbrains.dokka import com.google.inject.Inject +import com.google.inject.name.Named +import org.jetbrains.dokka.Utilities.impliedPlatformsName open class JekyllOutputBuilder(to: StringBuilder, location: Location, locationService: LocationService, languageService: LanguageService, - extension: String) - : MarkdownOutputBuilder(to, location, locationService, languageService, extension) + extension: String, + impliedPlatforms: List<String>) + : MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { override fun appendNodes(nodes: Iterable<DocumentationNode>) { to.appendln("---") @@ -25,14 +28,15 @@ open class JekyllOutputBuilder(to: StringBuilder, open class JekyllFormatService(locationService: LocationService, signatureGenerator: LanguageService, - linkExtension: String) -: MarkdownFormatService(locationService, signatureGenerator, linkExtension) { + linkExtension: String, + impliedPlatforms: List<String>) +: MarkdownFormatService(locationService, signatureGenerator, linkExtension, impliedPlatforms) { @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService): this(locationService, signatureGenerator, "md") { - } + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List<String>): this(locationService, signatureGenerator, "md", impliedPlatforms) override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder = - JekyllOutputBuilder(to, location, locationService, languageService, extension) + JekyllOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt index 007e9353..1897c53b 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt @@ -1,14 +1,17 @@ package org.jetbrains.dokka import com.google.inject.Inject +import com.google.inject.name.Named +import org.jetbrains.dokka.Utilities.impliedPlatformsName open class KotlinWebsiteOutputBuilder(to: StringBuilder, location: Location, locationService: LocationService, languageService: LanguageService, - extension: String) - : JekyllOutputBuilder(to, location, locationService, languageService, extension) + extension: String, + impliedPlatforms: List<String>) + : JekyllOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { private var needHardLineBreaks = false private var insideDiv = 0 @@ -145,11 +148,12 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, } class KotlinWebsiteFormatService @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService) - : JekyllFormatService(locationService, signatureGenerator, "html") + signatureGenerator: LanguageService, + impliedPlatforms: List<String>) + : JekyllFormatService(locationService, signatureGenerator, "html", impliedPlatforms) { override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension) + KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) } @@ -157,8 +161,9 @@ class KotlinWebsiteRunnableSamplesOutputBuilder(to: StringBuilder, location: Location, locationService: LocationService, languageService: LanguageService, - extension: String) - : KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension) { + extension: String, + impliedPlatforms: List<String>) + : KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { override fun appendSampleBlockCode(language: String, imports: () -> Unit, body: () -> Unit) { div(to, "sample", true) { @@ -173,9 +178,10 @@ class KotlinWebsiteRunnableSamplesOutputBuilder(to: StringBuilder, } class KotlinWebsiteRunnableSamplesFormatService @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService) - : JekyllFormatService(locationService, signatureGenerator, "html") { + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List<String>) + : JekyllFormatService(locationService, signatureGenerator, "html", impliedPlatforms) { override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteRunnableSamplesOutputBuilder(to, location, locationService, languageService, extension) + KotlinWebsiteRunnableSamplesOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt index fc63b2f2..b9c9c04f 100644 --- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt +++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt @@ -1,6 +1,8 @@ package org.jetbrains.dokka import com.google.inject.Inject +import com.google.inject.name.Named +import org.jetbrains.dokka.Utilities.impliedPlatformsName import java.util.* enum class ListKind { @@ -14,8 +16,9 @@ open class MarkdownOutputBuilder(to: StringBuilder, location: Location, locationService: LocationService, languageService: LanguageService, - extension: String) - : StructuredOutputBuilder(to, location, locationService, languageService, extension) + extension: String, + impliedPlatforms: List<String>) + : StructuredOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { private val listKindStack = Stack<ListKind>() protected var inTableCell = false @@ -211,11 +214,13 @@ open class MarkdownOutputBuilder(to: StringBuilder, open class MarkdownFormatService(locationService: LocationService, signatureGenerator: LanguageService, - linkExtension: String) + linkExtension: String, + val impliedPlatforms: List<String>) : StructuredFormatService(locationService, signatureGenerator, "md", linkExtension) { @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService): this(locationService, signatureGenerator, "md") + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List<String>): this(locationService, signatureGenerator, "md", impliedPlatforms) override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder = - MarkdownOutputBuilder(to, location, locationService, languageService, extension) + MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 71f9d577..de2ef3ed 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -1,6 +1,7 @@ package org.jetbrains.dokka import org.jetbrains.dokka.LanguageService.RenderMode +import org.jetbrains.kotlin.utils.ifEmpty import java.util.* data class FormatLink(val text: String, val href: String) @@ -9,7 +10,8 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, val location: Location, val locationService: LocationService, val languageService: LanguageService, - val extension: String) : FormattedOutputBuilder { + val extension: String, + val impliedPlatforms: List<String>) : FormattedOutputBuilder { protected fun wrap(prefix: String, suffix: String, body: () -> Unit) { to.append(prefix) @@ -344,13 +346,16 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } private fun DocumentationNode.appendPlatforms() { - if (platforms.isEmpty()) return + val platforms = platformsToShow.ifEmpty { return } appendParagraph { appendStrong { to.append("Platform and version requirements:") } to.append(" " + platforms.joinToString()) } } + val DocumentationNode.platformsToShow: List<String> + get() = platforms.let { if (it.containsAll(impliedPlatforms)) it - impliedPlatforms else it } + private fun DocumentationNode.appendDescription() { if (content.description != ContentEmpty) { appendContent(content.description) @@ -498,8 +503,8 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } private fun appendPlatforms(items: List<DocumentationNode>) { - val platforms = items.foldRight(items.first().platforms.toSet()) { - node, platforms -> platforms.intersect(node.platforms) + val platforms = items.foldRight(items.first().platformsToShow.toSet()) { + node, platforms -> platforms.intersect(node.platformsToShow) } if (platforms.isNotEmpty()) { appendLine() diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt index cc9a1b74..8fda1eb1 100644 --- a/core/src/main/kotlin/Generation/DokkaGenerator.kt +++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.utils.PathUtil import java.io.File import kotlin.system.measureTimeMillis -class SourceRoot(val path: String, val implicitPlatforms: List<String> = emptyList()) +class SourceRoot(val path: String, val defaultPlatforms: List<String> = emptyList()) class DokkaGenerator(val logger: DokkaLogger, val classpath: List<String>, @@ -35,7 +35,7 @@ class DokkaGenerator(val logger: DokkaLogger, private val documentationModule = DocumentationModule(moduleName) fun generate() { - val sourcesGroupedByPlatform = sources.groupBy { it.implicitPlatforms } + val sourcesGroupedByPlatform = sources.groupBy { it.defaultPlatforms } for ((platforms, roots) in sourcesGroupedByPlatform) { appendSourceModule(platforms, roots.map { it.path }) } @@ -48,7 +48,7 @@ class DokkaGenerator(val logger: DokkaLogger, logger.info("done in ${timeBuild / 1000} secs") } - private fun appendSourceModule(implicitPlatforms: List<String>, sourcePaths: List<String>) { + private fun appendSourceModule(defaultPlatforms: List<String>, sourcePaths: List<String>) { val environment = createAnalysisEnvironment(sourcePaths) logger.info("Module: $moduleName") @@ -60,7 +60,7 @@ class DokkaGenerator(val logger: DokkaLogger, val startAnalyse = System.currentTimeMillis() val injector = Guice.createInjector( - DokkaAnalysisModule(environment, options, implicitPlatforms, documentationModule.nodeRefGraph, logger)) + DokkaAnalysisModule(environment, options, defaultPlatforms, documentationModule.nodeRefGraph, logger)) buildDocumentationModule(injector, documentationModule, { isSample(it) }, includes) diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index ceeed491..ce957d93 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -4,6 +4,7 @@ import com.google.inject.Inject import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiJavaFile import org.jetbrains.dokka.Kotlin.DescriptorDocumentationParser +import org.jetbrains.dokka.Utilities.defaultPlatformsName import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.Annotated @@ -38,7 +39,8 @@ data class DocumentationOptions(val outputDir: String, val skipDeprecated: Boolean = false, val jdkVersion: Int = 6, val generateIndexPages: Boolean = true, - val sourceLinks: List<SourceLinkDefinition>) + val sourceLinks: List<SourceLinkDefinition>, + val impliedPlatforms: List<String> = emptyList()) private fun isExtensionForExternalClass(extensionFunctionDescriptor: DeclarationDescriptor, extensionReceiverDescriptor: DeclarationDescriptor, @@ -58,8 +60,6 @@ interface PackageDocumentationBuilder { allFqNames: Collection<FqName>) } -const val implicitPlatformName = "implicitPlatform" - class DocumentationBuilder @Inject constructor(val resolutionFacade: DokkaResolutionFacade, val descriptorDocumentationParser: DescriptorDocumentationParser, @@ -68,7 +68,7 @@ class DocumentationBuilder val platformNodeRegistry: PlatformNodeRegistry, val logger: DokkaLogger, val linkResolver: DeclarationLinkResolver, - @GuiceNamed(implicitPlatformName) val implicitPlatforms: List<String>) { + @GuiceNamed(defaultPlatformsName) val defaultPlatforms: List<String>) { val boringBuiltinClasses = setOf( "kotlin.Unit", "kotlin.Byte", "kotlin.Short", "kotlin.Int", "kotlin.Long", "kotlin.Char", "kotlin.Boolean", "kotlin.Float", "kotlin.Double", "kotlin.String", "kotlin.Array", "kotlin.Any") @@ -241,8 +241,8 @@ class DocumentationBuilder } } - fun DocumentationNode.appendImplicitPlatforms() { - for (platform in implicitPlatforms) { + fun DocumentationNode.appenDefaultPlatforms() { + for (platform in defaultPlatforms) { append(platformNodeRegistry[platform], RefKind.Platform) } } @@ -299,7 +299,7 @@ class DocumentationBuilder } private fun DocumentationNode.updatePlatforms() { - for (platform in implicitPlatforms - platforms) { + for (platform in defaultPlatforms - platforms) { append(platformNodeRegistry[platform], RefKind.Platform) } } @@ -454,7 +454,7 @@ class DocumentationBuilder node.appendType(underlyingType, NodeKind.TypeAliasUnderlyingType) node.appendSourceLink(source) - node.appendImplicitPlatforms() + node.appenDefaultPlatforms() register(this, node) return node @@ -483,7 +483,7 @@ class DocumentationBuilder node.appendAnnotations(this) node.appendModifiers(this) node.appendSourceLink(source) - node.appendImplicitPlatforms() + node.appenDefaultPlatforms() register(this, node) return node } @@ -532,7 +532,7 @@ class DocumentationBuilder fun ConstructorDescriptor.build(): DocumentationNode { val node = nodeForDescriptor(this, NodeKind.Constructor) node.appendInPageChildren(valueParameters, RefKind.Detail) - node.appendImplicitPlatforms() + node.appenDefaultPlatforms() register(this, node) return node } @@ -561,7 +561,7 @@ class DocumentationBuilder node.appendModifiers(this) node.appendSourceLink(source) node.appendSignature(this) - node.appendImplicitPlatforms() + node.appenDefaultPlatforms() overriddenDescriptors.forEach { addOverrideLink(it, this) @@ -608,7 +608,7 @@ class DocumentationBuilder overriddenDescriptors.forEach { addOverrideLink(it, this) } - node.appendImplicitPlatforms() + node.appenDefaultPlatforms() register(this, node) return node diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index 9bb44e09..1f382f8c 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -11,9 +11,12 @@ import org.jetbrains.dokka.Samples.SampleProcessingService import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import java.io.File +const val defaultPlatformsName = "defaultPlatforms" +const val impliedPlatformsName = "impliedPlatforms" + class DokkaAnalysisModule(val environment: AnalysisEnvironment, val options: DocumentationOptions, - val implicitPlatforms: List<String>, + val defaultPlatforms: List<String>, val nodeReferenceGraph: NodeReferenceGraph, val logger: DokkaLogger) : Module { override fun configure(binder: Binder) { @@ -33,7 +36,7 @@ class DokkaAnalysisModule(val environment: AnalysisEnvironment, binder.bind<DocumentationOptions>().toInstance(options) binder.bind<DokkaLogger>().toInstance(logger) - binder.bind(StringListType).annotatedWith(Names.named(implicitPlatformName)).toInstance(implicitPlatforms) + binder.bind(StringListType).annotatedWith(Names.named(defaultPlatformsName)).toInstance(defaultPlatforms) binder.bind<NodeReferenceGraph>().toInstance(nodeReferenceGraph) } @@ -78,6 +81,7 @@ class DokkaOutputModule(val options: DocumentationOptions, binder.bind<DocumentationOptions>().toInstance(options) binder.bind<DokkaLogger>().toInstance(logger) + binder.bind(StringListType).annotatedWith(Names.named(impliedPlatformsName)).toInstance(options.impliedPlatforms) } } diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index a003cd60..86111e76 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -37,7 +37,7 @@ fun appendDocumentation(documentation: DocumentationModule, withKotlinRuntime: Boolean = false, format: String = "html", includeNonPublic: Boolean = true, - implicitPlatforms: List<String> = emptyList()) { + defaultPlatforms: List<String> = emptyList()) { val messageCollector = object : MessageCollector { override fun clear() { @@ -82,7 +82,7 @@ fun appendDocumentation(documentation: DocumentationModule, sourceLinks = listOf<SourceLinkDefinition>(), generateIndexPages = false) val injector = Guice.createInjector( - DokkaAnalysisModule(environment, options, implicitPlatforms, documentation.nodeRefGraph, DokkaConsoleLogger)) + DokkaAnalysisModule(environment, options, defaultPlatforms, documentation.nodeRefGraph, DokkaConsoleLogger)) buildDocumentationModule(injector, documentation) Disposer.dispose(environment) } diff --git a/core/src/test/kotlin/format/GFMFormatTest.kt b/core/src/test/kotlin/format/GFMFormatTest.kt index 5327c9dc..c097c5c8 100644 --- a/core/src/test/kotlin/format/GFMFormatTest.kt +++ b/core/src/test/kotlin/format/GFMFormatTest.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.KotlinLanguageService import org.junit.Test class GFMFormatTest { - private val gfmService = GFMFormatService(InMemoryLocationService, KotlinLanguageService()) + private val gfmService = GFMFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) @Test fun sample() { verifyGFMNodeByName("sample", "Foo") diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt index 1816c075..221ee811 100644 --- a/core/src/test/kotlin/format/HtmlFormatTest.kt +++ b/core/src/test/kotlin/format/HtmlFormatTest.kt @@ -7,7 +7,7 @@ import org.junit.Test import java.io.File class HtmlFormatTest { - private val htmlService = HtmlFormatService(InMemoryLocationService, KotlinLanguageService(), HtmlTemplateService.default()) + private val htmlService = HtmlFormatService(InMemoryLocationService, KotlinLanguageService(), HtmlTemplateService.default(), listOf()) @Test fun classWithCompanionObject() { verifyHtmlNode("classWithCompanionObject") diff --git a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt index 3363b0a3..27c84aca 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.KotlinWebsiteFormatService import org.junit.Test class KotlinWebSiteFormatTest { - private val kwsService = KotlinWebsiteFormatService(InMemoryLocationService, KotlinLanguageService()) + private val kwsService = KotlinWebsiteFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) @Test fun sample() { verifyKWSNodeByName("sample", "foo") diff --git a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt index 742d2908..ca38c604 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.KotlinWebsiteRunnableSamplesFormatService import org.junit.Test class KotlinWebSiteRunnableSamplesFormatTest { - private val kwsService = KotlinWebsiteRunnableSamplesFormatService(InMemoryLocationService, KotlinLanguageService()) + private val kwsService = KotlinWebsiteRunnableSamplesFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) @Test fun dropImport() { diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index dda31d11..c09f2624 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -4,7 +4,7 @@ import org.jetbrains.dokka.* import org.junit.Test class MarkdownFormatTest { - private val markdownService = MarkdownFormatService(InMemoryLocationService, KotlinLanguageService()) + private val markdownService = MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) @Test fun emptyDescription() { verifyMarkdownNode("emptyDescription") @@ -257,10 +257,18 @@ class MarkdownFormatTest { } } + @Test fun multiplePlatformsImplied() { + val module = buildMultiplePlatforms("multiplatformImplied") + verifyModelOutput(module, ".md", "testdata/format/multiplatformImplied/foo.kt") { model, output -> + MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf("JVM", "JS")) + .createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + } + } + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") - appendDocumentation(module, contentRootFromPath("testdata/format/$path/jvm.kt"), implicitPlatforms = listOf("JVM")) - appendDocumentation(module, contentRootFromPath("testdata/format/$path/js.kt"), implicitPlatforms = listOf("JS")) + appendDocumentation(module, contentRootFromPath("testdata/format/$path/jvm.kt"), defaultPlatforms = listOf("JVM")) + appendDocumentation(module, contentRootFromPath("testdata/format/$path/js.kt"), defaultPlatforms = listOf("JS")) return module } |