From 79a7a136bdc3a59d7bb3aebb51e565b58e2b789c Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 29 Aug 2017 16:58:32 +0200 Subject: Fix README: outFormat in Maven must be outputFormat --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 383d238b..63bc6cbc 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ The available configuration options are shown below: data - html + html some/out/dir -- cgit From f3db3f313c599b84b1a9810723c6a503c0baf7a9 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 30 Nov 2017 19:04:11 +0300 Subject: New format stub --- .../main/kotlin/Formats/JavaLayoutHtmlFormat.kt | 45 ++++++++++++++++++++++ core/src/main/kotlin/Formats/StandardFormats.kt | 2 +- .../dokka/format/java-layout-html.properties | 2 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt create mode 100644 core/src/main/resources/dokka/format/java-layout-html.properties diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt new file mode 100644 index 00000000..c023c477 --- /dev/null +++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt @@ -0,0 +1,45 @@ +package org.jetbrains.dokka.formats + +import org.jetbrains.dokka.* +import org.jetbrains.dokka.Formats.KotlinFormatDescriptorBase + + +class JavaLayoutHtmlFormatDescriptor : KotlinFormatDescriptorBase() { + override val formatServiceClass = JavaLayoutHtmlFormatService::class + override val generatorServiceClass = JavaLayoutHtmlFormatGenerator::class +} + + +class JavaLayoutHtmlFormatService : FormatService { + override val extension: String + get() = TODO("not implemented") + + + override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder { + TODO("not implemented") + } +} + +class JavaLayoutHtmlFormatOutputBuilder : FormattedOutputBuilder { + override fun appendNodes(nodes: Iterable) { + TODO("not implemented") + } +} + +class JavaLayoutHtmlFormatGenerator : Generator { + override fun buildPages(nodes: Iterable) { + TODO("not implemented") + } + + override fun buildOutlines(nodes: Iterable) { + TODO("not implemented") + } + + override fun buildSupportFiles() { + TODO("not implemented") + } + + override fun buildPackageList(nodes: Iterable) { + TODO("not implemented") + } +} \ No newline at end of file diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt index f3d638c6..c0c86f06 100644 --- a/core/src/main/kotlin/Formats/StandardFormats.kt +++ b/core/src/main/kotlin/Formats/StandardFormats.kt @@ -13,7 +13,7 @@ abstract class KotlinFormatDescriptorBase : FormatDescriptor { override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class - override val generatorServiceClass = FileGenerator::class + override val generatorServiceClass: KClass = FileGenerator::class override val outlineServiceClass: KClass? = null override val sampleProcessingService: KClass = DefaultSampleProcessingService::class override val packageListServiceClass: KClass? = DefaultPackageListService::class diff --git a/core/src/main/resources/dokka/format/java-layout-html.properties b/core/src/main/resources/dokka/format/java-layout-html.properties new file mode 100644 index 00000000..c5c6bb15 --- /dev/null +++ b/core/src/main/resources/dokka/format/java-layout-html.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.formats.JavaLayoutHtmlFormatDescriptor +description=Produces Kotlin Style Docs with Javadoc like layout \ No newline at end of file -- cgit From 1b722f7c61ea3405b8f33612044b28f0b4087406 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 30 Nov 2017 20:34:25 +0300 Subject: WIP --- build.gradle | 1 + core/build.gradle | 2 + .../main/kotlin/Formats/JavaLayoutHtmlFormat.kt | 53 ++++++++++++++++++---- .../dokka/format/java-layout-html.properties | 2 +- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 0002ee69..5772bc5d 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,7 @@ allprojects { maven { url 'https://jitpack.io' } maven { url "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/$bundled_kotlin_compiler_version/maven" } ivy(repo) + maven { url "https://dl.bintray.com/kotlin/kotlinx.html" } } } diff --git a/core/build.gradle b/core/build.gradle index a8f0f275..d37b98b3 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -33,6 +33,8 @@ dependencies { compile intellijCoreAnalysis() + compile 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.8' + //tools.jar def toolsJar = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs().findAll { it.path.endsWith("jar") }) compileOnly toolsJar diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt index c023c477..832c466e 100644 --- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt +++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt @@ -1,7 +1,11 @@ -package org.jetbrains.dokka.formats +package org.jetbrains.dokka.Formats +import com.google.inject.Inject +import kotlinx.html.li +import kotlinx.html.stream.appendHTML +import kotlinx.html.ul import org.jetbrains.dokka.* -import org.jetbrains.dokka.Formats.KotlinFormatDescriptorBase +import java.io.File class JavaLayoutHtmlFormatDescriptor : KotlinFormatDescriptorBase() { @@ -22,24 +26,53 @@ class JavaLayoutHtmlFormatService : FormatService { class JavaLayoutHtmlFormatOutputBuilder : FormattedOutputBuilder { override fun appendNodes(nodes: Iterable) { - TODO("not implemented") + + } +} + + +class JavaLayoutHtmlFormatNavListBuilder @Inject constructor(private val locationService: LocationService) : OutlineFormatService { + override fun getOutlineFileName(location: Location): File { + TODO() + } + + override fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder) { + with(to.appendHTML()) { + //a(href = ) + li { + when { + node.kind == NodeKind.Package -> appendOutline(location, to, node.members) + } + } + } + } + + override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { + with(to.appendHTML()) { + ul { body() } + } } + } -class JavaLayoutHtmlFormatGenerator : Generator { +class JavaLayoutHtmlFormatGenerator @Inject constructor( + private val outlineFormatService: OutlineFormatService +) : Generator { override fun buildPages(nodes: Iterable) { - TODO("not implemented") + } override fun buildOutlines(nodes: Iterable) { - TODO("not implemented") + for (node in nodes) { + if (node.kind == NodeKind.Module) { + //outlineFormatService.formatOutline() + } + } } - override fun buildSupportFiles() { - TODO("not implemented") - } + override fun buildSupportFiles() {} override fun buildPackageList(nodes: Iterable) { - TODO("not implemented") + } } \ No newline at end of file diff --git a/core/src/main/resources/dokka/format/java-layout-html.properties b/core/src/main/resources/dokka/format/java-layout-html.properties index c5c6bb15..fbb2bbed 100644 --- a/core/src/main/resources/dokka/format/java-layout-html.properties +++ b/core/src/main/resources/dokka/format/java-layout-html.properties @@ -1,2 +1,2 @@ -class=org.jetbrains.dokka.formats.JavaLayoutHtmlFormatDescriptor +class=org.jetbrains.dokka.Formats.JavaLayoutHtmlFormatDescriptor description=Produces Kotlin Style Docs with Javadoc like layout \ No newline at end of file -- cgit From 7acc52ba723eab08fe796fcfd68755e7f0eb6a66 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 00:50:08 +0300 Subject: WIP: Refactoring, remove LocationService, rework FormatDescriptor --- core/build.gradle | 2 +- core/src/main/kotlin/Formats/FormatDescriptor.kt | 38 +++++++++-- core/src/main/kotlin/Formats/GFMFormatService.kt | 46 ++++++------- core/src/main/kotlin/Formats/HtmlFormatService.kt | 13 ++-- .../src/main/kotlin/Formats/HtmlTemplateService.kt | 2 +- .../main/kotlin/Formats/JavaLayoutHtmlFormat.kt | 22 ++++-- .../src/main/kotlin/Formats/JekyllFormatService.kt | 26 +++---- .../kotlin/Formats/KotlinWebsiteFormatService.kt | 67 +++++++++--------- .../Formats/KotlinWebsiteHtmlFormatService.kt | 26 +++---- .../main/kotlin/Formats/MarkdownFormatService.kt | 14 ++-- core/src/main/kotlin/Formats/PackageListService.kt | 9 ++- core/src/main/kotlin/Formats/StandardFormats.kt | 8 +-- .../main/kotlin/Formats/StructuredFormatService.kt | 19 +++--- core/src/main/kotlin/Formats/YamlOutlineService.kt | 8 ++- .../src/main/kotlin/Generation/ConsoleGenerator.kt | 42 ------------ core/src/main/kotlin/Generation/FileGenerator.kt | 17 +++-- core/src/main/kotlin/Generation/Generator.kt | 5 ++ .../kotlin/Locations/FoldersLocationService.kt | 40 ++++------- core/src/main/kotlin/Locations/LocationService.kt | 79 ++++++++++++++-------- .../Locations/SingleFolderLocationService.kt | 30 ++++---- core/src/main/kotlin/Utilities/DokkaModules.kt | 46 ++++++------- core/src/test/kotlin/TestAPI.kt | 15 ---- 22 files changed, 292 insertions(+), 282 deletions(-) delete mode 100644 core/src/main/kotlin/Generation/ConsoleGenerator.kt diff --git a/core/build.gradle b/core/build.gradle index d37b98b3..b089dc07 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -22,7 +22,7 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$bundled_kotlin_compiler_version" compile "org.jetbrains.kotlin:kotlin-reflect:$bundled_kotlin_compiler_version" - compile group: 'com.google.inject', name: 'guice', version: '3.0' + compile group: 'com.google.inject', name: 'guice', version: '4.1.0' compile "org.jsoup:jsoup:1.8.3" compile "org.jetbrains.kotlin:kotlin-compiler:$bundled_kotlin_compiler_version" diff --git a/core/src/main/kotlin/Formats/FormatDescriptor.kt b/core/src/main/kotlin/Formats/FormatDescriptor.kt index da0156a7..fc0c4417 100644 --- a/core/src/main/kotlin/Formats/FormatDescriptor.kt +++ b/core/src/main/kotlin/Formats/FormatDescriptor.kt @@ -1,17 +1,47 @@ package org.jetbrains.dokka.Formats +import com.google.inject.Binder import org.jetbrains.dokka.* import org.jetbrains.dokka.Model.DescriptorSignatureProvider import org.jetbrains.dokka.Samples.SampleProcessingService +import org.jetbrains.dokka.Utilities.bind +import org.jetbrains.dokka.Utilities.toOptional +import org.jetbrains.dokka.Utilities.toType import kotlin.reflect.KClass interface FormatDescriptor { - val formatServiceClass: KClass? - val outlineServiceClass: KClass? - val generatorServiceClass: KClass + fun configureAnalysis(binder: Binder) + fun configureOutput(binder: Binder) +} + +interface FormatDescriptorAnalysisComponentProvider : FormatDescriptor { + val packageDocumentationBuilderClass: KClass val javaDocumentationBuilderClass: KClass val sampleProcessingService: KClass - val packageListServiceClass: KClass? val descriptorSignatureProvider: KClass + + + override fun configureAnalysis(binder: Binder): Unit = with(binder) { + bind() toType descriptorSignatureProvider + bind() toType packageDocumentationBuilderClass + bind() toType javaDocumentationBuilderClass + bind() toType sampleProcessingService + } } + +abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider { + + override fun configureOutput(binder: Binder): Unit = with(binder) { + bind() toOptional (outlineServiceClass) + bind() toOptional formatServiceClass + bind() toType generatorServiceClass + //bind() toType generatorServiceClass + bind() toOptional packageListServiceClass + } + + abstract val formatServiceClass: KClass? + abstract val outlineServiceClass: KClass? + abstract val generatorServiceClass: KClass + abstract val packageListServiceClass: KClass? +} \ No newline at end of file diff --git a/core/src/main/kotlin/Formats/GFMFormatService.kt b/core/src/main/kotlin/Formats/GFMFormatService.kt index f741561c..036ec856 100644 --- a/core/src/main/kotlin/Formats/GFMFormatService.kt +++ b/core/src/main/kotlin/Formats/GFMFormatService.kt @@ -4,14 +4,14 @@ import com.google.inject.Inject import com.google.inject.name.Named import org.jetbrains.dokka.Utilities.impliedPlatformsName -open class GFMOutputBuilder(to: StringBuilder, - location: Location, - locationService: LocationService, - languageService: LanguageService, - extension: String, - impliedPlatforms: List) - : MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) -{ +open class GFMOutputBuilder( + to: StringBuilder, + location: Location, + generator: NodeLocationAwareGenerator, + languageService: LanguageService, + extension: String, + impliedPlatforms: List +) : MarkdownOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { override fun appendTable(vararg columns: String, body: () -> Unit) { to.appendln(columns.joinToString(" | ", "| ", " |")) to.appendln("|" + "---|".repeat(columns.size)) @@ -21,8 +21,7 @@ open class GFMOutputBuilder(to: StringBuilder, override fun appendUnorderedList(body: () -> Unit) { if (inTableCell) { wrapInTag("ul", body) - } - else { + } else { super.appendUnorderedList(body) } } @@ -30,8 +29,7 @@ open class GFMOutputBuilder(to: StringBuilder, override fun appendOrderedList(body: () -> Unit) { if (inTableCell) { wrapInTag("ol", body) - } - else { + } else { super.appendOrderedList(body) } } @@ -39,23 +37,25 @@ open class GFMOutputBuilder(to: StringBuilder, override fun appendListItem(body: () -> Unit) { if (inTableCell) { wrapInTag("li", body) - } - else { + } else { super.appendListItem(body) } } } -open class GFMFormatService(locationService: LocationService, - signatureGenerator: LanguageService, - linkExtension: String, - impliedPlatforms: List) -: MarkdownFormatService(locationService, signatureGenerator, linkExtension, impliedPlatforms) { +open class GFMFormatService( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + linkExtension: String, + impliedPlatforms: List +) : MarkdownFormatService(generator, signatureGenerator, linkExtension, impliedPlatforms) { - @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List) : this(locationService, signatureGenerator, "md", impliedPlatforms) + @Inject constructor( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List + ) : this(generator, signatureGenerator, "md", impliedPlatforms) override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder = - GFMOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + GFMOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index 5e05f51a..560d8597 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -5,16 +5,15 @@ 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 open class HtmlOutputBuilder(to: StringBuilder, location: Location, - locationService: LocationService, + generator: NodeLocationAwareGenerator, languageService: LanguageService, extension: String, impliedPlatforms: List, val templateService: HtmlTemplateService) - : StructuredOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + : StructuredOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { override fun appendText(text: String) { to.append(text.htmlEscape()) @@ -95,18 +94,18 @@ open class HtmlOutputBuilder(to: StringBuilder, } } -open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService, +open class HtmlFormatService @Inject constructor(generator: NodeLocationAwareGenerator, signatureGenerator: LanguageService, val templateService: HtmlTemplateService, @Named(impliedPlatformsName) val impliedPlatforms: List) -: StructuredFormatService(locationService, signatureGenerator, "html"), OutlineFormatService { +: StructuredFormatService(generator, signatureGenerator, "html"), OutlineFormatService { override fun enumerateSupportFiles(callback: (String, String) -> Unit) { callback("/dokka/styles/style.css", "style.css") } override fun createOutputBuilder(to: StringBuilder, location: Location) = - HtmlOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms, templateService) + HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService) override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable) { templateService.appendHeader(to, "Module Contents", locationService.calcPathToRoot(location)) @@ -123,7 +122,7 @@ open class HtmlFormatService @Inject constructor(@Named("folders") locationServi link.append(languageService.render(node, LanguageService.RenderMode.FULL)) val tempBuilder = StringBuilder() createOutputBuilder(tempBuilder, location).appendContent(link) - to.appendln("${tempBuilder.toString()}
") + to.appendln("$tempBuilder
") } override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt index 010bc702..22832e34 100644 --- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt +++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt @@ -16,7 +16,7 @@ interface HtmlTemplateService { to.appendln("") to.appendln("") } - override fun appendHeader(to: StringBuilder, title: String?, basePath: Path) { + override fun appendHeader(to: StringBuilder, title: String?, relativePathToRoot: String) { to.appendln("") to.appendln("") to.appendln("") diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt index 832c466e..9fb72e37 100644 --- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt +++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt @@ -1,16 +1,30 @@ package org.jetbrains.dokka.Formats +import com.google.inject.Binder import com.google.inject.Inject import kotlinx.html.li import kotlinx.html.stream.appendHTML import kotlinx.html.ul import org.jetbrains.dokka.* +import org.jetbrains.dokka.Kotlin.KotlinDescriptorSignatureProvider +import org.jetbrains.dokka.Samples.DefaultSampleProcessingService +import org.jetbrains.dokka.Utilities.bind +import org.jetbrains.dokka.Utilities.toType import java.io.File -class JavaLayoutHtmlFormatDescriptor : KotlinFormatDescriptorBase() { - override val formatServiceClass = JavaLayoutHtmlFormatService::class - override val generatorServiceClass = JavaLayoutHtmlFormatGenerator::class +class JavaLayoutHtmlFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider { + override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class + override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class + override val sampleProcessingService = DefaultSampleProcessingService::class + override val descriptorSignatureProvider = KotlinDescriptorSignatureProvider::class + + override fun configureOutput(binder: Binder): Unit = with(binder) { + bind() toType generatorServiceClass + } + + val formatServiceClass = JavaLayoutHtmlFormatService::class + val generatorServiceClass = JavaLayoutHtmlFormatGenerator::class } @@ -31,7 +45,7 @@ class JavaLayoutHtmlFormatOutputBuilder : FormattedOutputBuilder { } -class JavaLayoutHtmlFormatNavListBuilder @Inject constructor(private val locationService: LocationService) : OutlineFormatService { +class JavaLayoutHtmlFormatNavListBuilder @Inject constructor() : OutlineFormatService { override fun getOutlineFileName(location: Location): File { TODO() } diff --git a/core/src/main/kotlin/Formats/JekyllFormatService.kt b/core/src/main/kotlin/Formats/JekyllFormatService.kt index 6b97bbe0..a948dfa9 100644 --- a/core/src/main/kotlin/Formats/JekyllFormatService.kt +++ b/core/src/main/kotlin/Formats/JekyllFormatService.kt @@ -6,12 +6,11 @@ import org.jetbrains.dokka.Utilities.impliedPlatformsName open class JekyllOutputBuilder(to: StringBuilder, location: Location, - locationService: LocationService, + generator: NodeLocationAwareGenerator, languageService: LanguageService, extension: String, impliedPlatforms: List) - : MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) -{ + : MarkdownOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { override fun appendNodes(nodes: Iterable) { to.appendln("---") appendFrontMatter(nodes, to) @@ -26,17 +25,20 @@ open class JekyllOutputBuilder(to: StringBuilder, } -open class JekyllFormatService(locationService: LocationService, - signatureGenerator: LanguageService, - linkExtension: String, - impliedPlatforms: List) -: MarkdownFormatService(locationService, signatureGenerator, linkExtension, impliedPlatforms) { +open class JekyllFormatService( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + linkExtension: String, + impliedPlatforms: List +) : MarkdownFormatService(generator, signatureGenerator, linkExtension, impliedPlatforms) { - @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List): this(locationService, signatureGenerator, "html", impliedPlatforms) + @Inject constructor( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List + ) : this(generator, signatureGenerator, "html", impliedPlatforms) override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder = - JekyllOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + JekyllOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt index 08349980..a98002d4 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt @@ -6,14 +6,14 @@ import org.jetbrains.dokka.Utilities.impliedPlatformsName import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty -open class KotlinWebsiteOutputBuilder(to: StringBuilder, - location: Location, - locationService: LocationService, - languageService: LanguageService, - extension: String, - impliedPlatforms: List) - : JekyllOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) -{ +open class KotlinWebsiteOutputBuilder( + to: StringBuilder, + location: Location, + generator: NodeLocationAwareGenerator, + languageService: LanguageService, + extension: String, + impliedPlatforms: List +) : JekyllOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { private var needHardLineBreaks = false private var insideDiv = 0 @@ -70,8 +70,7 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, override fun appendHeader(level: Int, body: () -> Unit) { if (insideDiv > 0) { wrapInTag("p", body, newlineAfterClose = true) - } - else { + } else { super.appendHeader(level, body) } } @@ -79,8 +78,7 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, override fun appendLine() { if (insideDiv > 0) { to.appendln("
") - } - else { + } else { super.appendLine() } } @@ -135,13 +133,14 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, to.append("
") } + override fun appendIndentedSoftLineBreak() { if (needHardLineBreaks) { to.append("
    ") } } - private fun identifierClassName(kind: IdentifierKind) = when(kind) { + private fun identifierClassName(kind: IdentifierKind) = when (kind) { IdentifierKind.ParameterName -> "parameterName" IdentifierKind.SummarizedTypeName -> "summarizedTypeName" else -> "identifier" @@ -172,28 +171,29 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, } } -class KotlinWebsiteFormatService @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List, - logger: DokkaLogger) - : JekyllFormatService(locationService, signatureGenerator, "html", impliedPlatforms) -{ +class KotlinWebsiteFormatService @Inject constructor( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List, + logger: DokkaLogger +) : JekyllFormatService(generator, signatureGenerator, "html", impliedPlatforms) { init { logger.warn("Format kotlin-website deprecated and will be removed in next release") } override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + KotlinWebsiteOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) } -class KotlinWebsiteRunnableSamplesOutputBuilder(to: StringBuilder, - location: Location, - locationService: LocationService, - languageService: LanguageService, - extension: String, - impliedPlatforms: List) - : KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) { +class KotlinWebsiteRunnableSamplesOutputBuilder( + to: StringBuilder, + location: Location, + generator: NodeLocationAwareGenerator, + languageService: LanguageService, + extension: String, + impliedPlatforms: List +) : KotlinWebsiteOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { override fun appendSampleBlockCode(language: String, imports: () -> Unit, body: () -> Unit) { div(to, "sample", markdown = true) { @@ -207,17 +207,18 @@ class KotlinWebsiteRunnableSamplesOutputBuilder(to: StringBuilder, } } -class KotlinWebsiteRunnableSamplesFormatService @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List, - logger: DokkaLogger) - : JekyllFormatService(locationService, signatureGenerator, "html", impliedPlatforms) { +class KotlinWebsiteRunnableSamplesFormatService @Inject constructor( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List, + logger: DokkaLogger +) : JekyllFormatService(generator, signatureGenerator, "html", impliedPlatforms) { init { logger.warn("Format kotlin-website-samples deprecated and will be removed in next release") } override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteRunnableSamplesOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + KotlinWebsiteRunnableSamplesOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt index 378401f3..8fd53cdd 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt @@ -14,13 +14,14 @@ private object EmptyHtmlTemplateService : HtmlTemplateService { } -open class KotlinWebsiteHtmlOutputBuilder(to: StringBuilder, - location: Location, - locationService: LocationService, - languageService: LanguageService, - extension: String, - impliedPlatforms: List) - : HtmlOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms, EmptyHtmlTemplateService) { +open class KotlinWebsiteHtmlOutputBuilder( + to: StringBuilder, + location: Location, + generator: NodeLocationAwareGenerator, + languageService: LanguageService, + extension: String, + impliedPlatforms: List +) : HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, EmptyHtmlTemplateService) { private var needHardLineBreaks = false private var insideDiv = 0 @@ -169,14 +170,15 @@ open class KotlinWebsiteHtmlOutputBuilder(to: StringBuilder, } } -class KotlinWebsiteHtmlFormatService @Inject constructor(locationService: LocationService, - signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List) - : HtmlFormatService(locationService, signatureGenerator, EmptyHtmlTemplateService, impliedPlatforms) { +class KotlinWebsiteHtmlFormatService @Inject constructor( + generator: NodeLocationAwareGenerator, + signatureGenerator: LanguageService, + @Named(impliedPlatformsName) impliedPlatforms: List +) : HtmlFormatService(generator, signatureGenerator, EmptyHtmlTemplateService, impliedPlatforms) { override fun enumerateSupportFiles(callback: (String, String) -> Unit) {} override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteHtmlOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + KotlinWebsiteHtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt index a7c18a28..4265394f 100644 --- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt +++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt @@ -21,11 +21,11 @@ private val TWO_LINE_BREAKS = System.lineSeparator() + System.lineSeparator() open class MarkdownOutputBuilder(to: StringBuilder, location: Location, - locationService: LocationService, + generator: NodeLocationAwareGenerator, languageService: LanguageService, extension: String, impliedPlatforms: List) - : StructuredOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + : StructuredOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) { private val listStack = ArrayDeque() protected var inTableCell = false @@ -225,15 +225,15 @@ open class MarkdownOutputBuilder(to: StringBuilder, } } -open class MarkdownFormatService(locationService: LocationService, +open class MarkdownFormatService(generator: NodeLocationAwareGenerator, signatureGenerator: LanguageService, linkExtension: String, val impliedPlatforms: List) -: StructuredFormatService(locationService, signatureGenerator, "md", linkExtension) { - @Inject constructor(locationService: LocationService, +: StructuredFormatService(generator, signatureGenerator, "md", linkExtension) { + @Inject constructor(generator: NodeLocationAwareGenerator, signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List): this(locationService, signatureGenerator, "md", impliedPlatforms) + @Named(impliedPlatformsName) impliedPlatforms: List): this(generator, signatureGenerator, "md", impliedPlatforms) override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder = - MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) + MarkdownOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) } diff --git a/core/src/main/kotlin/Formats/PackageListService.kt b/core/src/main/kotlin/Formats/PackageListService.kt index e7f4e952..be50fac4 100644 --- a/core/src/main/kotlin/Formats/PackageListService.kt +++ b/core/src/main/kotlin/Formats/PackageListService.kt @@ -7,10 +7,9 @@ interface PackageListService { fun formatPackageList(module: DocumentationModule): String } -class DefaultPackageListService @Inject constructor(locationService: FileLocationService, - val formatService: FormatService) : PackageListService { - - val locationService: FileLocationService = locationService.withExtension(formatService.linkExtension) +class DefaultPackageListService @Inject constructor( + val generator: FileGenerator, + val formatService: FormatService) : PackageListService { override fun formatPackageList(module: DocumentationModule): String { val packages = mutableSetOf() @@ -26,7 +25,7 @@ class DefaultPackageListService @Inject constructor(locationService: FileLocatio } NodeKind.Signature -> { if (relocated) - nonStandardLocations[node.name] = locationService.relativePathToLocation(module, node.owner!!) + nonStandardLocations[node.name] = generator.relativePathToLocation(module, node.owner!!) } NodeKind.ExternalClass -> { node.members.forEach { visit(it, relocated = true) } diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt index c0c86f06..54544ebc 100644 --- a/core/src/main/kotlin/Formats/StandardFormats.kt +++ b/core/src/main/kotlin/Formats/StandardFormats.kt @@ -3,17 +3,17 @@ package org.jetbrains.dokka.Formats import org.jetbrains.dokka.* import org.jetbrains.dokka.Kotlin.KotlinAsJavaDescriptorSignatureProvider import org.jetbrains.dokka.Kotlin.KotlinDescriptorSignatureProvider -import org.jetbrains.dokka.Model.DescriptorSignatureProvider import org.jetbrains.dokka.Samples.DefaultSampleProcessingService import org.jetbrains.dokka.Samples.KotlinWebsiteSampleProcessingService import org.jetbrains.dokka.Samples.SampleProcessingService import kotlin.reflect.KClass -abstract class KotlinFormatDescriptorBase : FormatDescriptor { +abstract class KotlinFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() { + override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class - override val generatorServiceClass: KClass = FileGenerator::class + override val generatorServiceClass = FileGenerator::class override val outlineServiceClass: KClass? = null override val sampleProcessingService: KClass = DefaultSampleProcessingService::class override val packageListServiceClass: KClass? = DefaultPackageListService::class @@ -25,7 +25,7 @@ class HtmlFormatDescriptor : KotlinFormatDescriptorBase() { override val outlineServiceClass = HtmlFormatService::class } -class HtmlAsJavaFormatDescriptor : FormatDescriptor { +class HtmlAsJavaFormatDescriptor : FileGeneratorBasedFormatDescriptor() { override val formatServiceClass = HtmlFormatService::class override val outlineServiceClass = HtmlFormatService::class override val generatorServiceClass = FileGenerator::class diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 5167a102..952e14cf 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -7,11 +7,13 @@ data class FormatLink(val text: String, val href: String) abstract class StructuredOutputBuilder(val to: StringBuilder, val location: Location, - val locationService: LocationService, + val generator: NodeLocationAwareGenerator, val languageService: LanguageService, val extension: String, val impliedPlatforms: List) : FormattedOutputBuilder { + protected fun DocumentationNode.location() = generator.location(this) + protected fun wrap(prefix: String, suffix: String, body: () -> Unit) { to.append(prefix) body() @@ -204,16 +206,16 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, if (from.owner?.kind == NodeKind.GroupNode) return link(from.owner!!, to, extension, name) - return FormatLink(name(to), locationService.relativePathToLocation(from, to)) + return FormatLink(name(to), from.location().relativePathTo(to.location())) } fun locationHref(from: Location, to: DocumentationNode): String { val topLevelPage = to.references(RefKind.TopLevelPage).singleOrNull()?.to if (topLevelPage != null) { val signature = to.detailOrNull(NodeKind.Signature) - return from.relativePathTo(locationService.location(topLevelPage), signature?.name ?: to.name) + return from.relativePathTo(topLevelPage.location(), signature?.name ?: to.name) } - return from.relativePathTo(locationService.location(to)) + return from.relativePathTo(to.location()) } private fun DocumentationNode.isModuleOrPackage(): Boolean = @@ -349,7 +351,8 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, overrides.forEach { appendParagraph { to.append("Overrides ") - val location = locationService.relativePathToLocation(this, it) + val location = location().relativePathTo(it.location()) + appendLink(FormatLink(it.owner!!.name + "." + it.name, location)) } } @@ -383,7 +386,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, else platformsToShow - if(platforms.isEmpty()) return + if (platforms.isEmpty()) return appendParagraph { appendStrong { to.append("Platform and version requirements:") } @@ -674,9 +677,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } -abstract class StructuredFormatService(locationService: LocationService, +abstract class StructuredFormatService(val generator: NodeLocationAwareGenerator, val languageService: LanguageService, override val extension: String, override final val linkExtension: String = extension) : FormatService { - val locationService: LocationService = locationService.withExtension(linkExtension) + } diff --git a/core/src/main/kotlin/Formats/YamlOutlineService.kt b/core/src/main/kotlin/Formats/YamlOutlineService.kt index 7968824c..c36f98eb 100644 --- a/core/src/main/kotlin/Formats/YamlOutlineService.kt +++ b/core/src/main/kotlin/Formats/YamlOutlineService.kt @@ -3,15 +3,17 @@ package org.jetbrains.dokka import com.google.inject.Inject import java.io.File -class YamlOutlineService @Inject constructor(val locationService: LocationService, - val languageService: LanguageService) : OutlineFormatService { +class YamlOutlineService @Inject constructor( + val generator: NodeLocationAwareGenerator, + val languageService: LanguageService +) : OutlineFormatService { override fun getOutlineFileName(location: Location): File = File("${location.path}.yml") var outlineLevel = 0 override fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder) { val indent = " ".repeat(outlineLevel) to.appendln("$indent- title: ${languageService.renderName(node)}") - to.appendln("$indent url: ${locationService.location(node).path}") + to.appendln("$indent url: ${generator.location(node).path}") } override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { diff --git a/core/src/main/kotlin/Generation/ConsoleGenerator.kt b/core/src/main/kotlin/Generation/ConsoleGenerator.kt deleted file mode 100644 index 301f86b9..00000000 --- a/core/src/main/kotlin/Generation/ConsoleGenerator.kt +++ /dev/null @@ -1,42 +0,0 @@ -package org.jetbrains.dokka - -class ConsoleGenerator(val signatureGenerator: LanguageService, val locationService: LocationService) { - val IndentStep = " " - - fun generate(node: DocumentationNode, indent: String = "") { - println("@${locationService.location(node).path}") - generateHeader(node, indent) - //generateDetails(node, indent) - generateMembers(node, indent) - generateLinks(node, indent) - } - - fun generateHeader(node: DocumentationNode, indent: String = "") { - println(indent + signatureGenerator.render(node)) - val docString = node.content.toString() - if (!docString.isEmpty()) - println("$indent\"${docString.replace("\n", "\n$indent")}\"") - println() - } - - fun generateMembers(node: DocumentationNode, indent: String = "") { - val items = node.members.sortedBy { it.name } - for (child in items) - generate(child, indent + IndentStep) - } - - fun generateDetails(node: DocumentationNode, indent: String = "") { - val items = node.details - for (child in items) - generate(child, indent + " ") - } - - fun generateLinks(node: DocumentationNode, indent: String = "") { - val items = node.links - if (items.isEmpty()) - return - println("$indent Links") - for (child in items) - generate(child, indent + " ") - } -} \ No newline at end of file diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index e055c537..3193a5bc 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -1,22 +1,27 @@ package org.jetbrains.dokka import com.google.inject.Inject +import com.google.inject.name.Named import java.io.File import java.io.FileOutputStream import java.io.IOException import java.io.OutputStreamWriter -class FileGenerator @Inject constructor(val locationService: FileLocationService) : Generator { +class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) : NodeLocationAwareGenerator { @set:Inject(optional = true) var outlineService: OutlineFormatService? = null @set:Inject(optional = true) lateinit var formatService: FormatService @set:Inject(optional = true) lateinit var options: DocumentationOptions @set:Inject(optional = true) var packageListService: PackageListService? = null + override fun location(node: DocumentationNode): FileLocation { + return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any())).appendExtension(formatService.extension)) + } + override fun buildPages(nodes: Iterable) { - val specificLocationService = locationService.withExtension(formatService.extension) + //val specificLocationService = locationService.withExtension(formatService.extension) - for ((location, items) in nodes.groupBy { specificLocationService.location(it) }) { + for ((location, items) in nodes.groupBy { location(it) }) { val file = location.file file.parentFile?.mkdirsOrFail() try { @@ -34,7 +39,7 @@ class FileGenerator @Inject constructor(val locationService: FileLocationService override fun buildOutlines(nodes: Iterable) { val outlineService = this.outlineService ?: return - for ((location, items) in nodes.groupBy { locationService.location(it) }) { + for ((location, items) in nodes.groupBy { location(it) }) { val file = outlineService.getOutlineFileName(location) file.parentFile?.mkdirsOrFail() FileOutputStream(file).use { @@ -47,7 +52,7 @@ class FileGenerator @Inject constructor(val locationService: FileLocationService override fun buildSupportFiles() { formatService.enumerateSupportFiles { resource, targetPath -> - FileOutputStream(locationService.location(listOf(targetPath), false).file).use { + FileOutputStream(relativePathToNode(listOf(targetPath), false)).use { javaClass.getResourceAsStream(resource).copyTo(it) } } @@ -58,7 +63,7 @@ class FileGenerator @Inject constructor(val locationService: FileLocationService for (module in nodes) { - val moduleRoot = locationService.location(module).file.parentFile + val moduleRoot = location(module).file.parentFile val packageListFile = File(moduleRoot, "package-list") packageListFile.writeText("\$dokka.format:${options.outputFormat}\n" + diff --git a/core/src/main/kotlin/Generation/Generator.kt b/core/src/main/kotlin/Generation/Generator.kt index 76a5f350..003386ef 100644 --- a/core/src/main/kotlin/Generation/Generator.kt +++ b/core/src/main/kotlin/Generation/Generator.kt @@ -19,3 +19,8 @@ fun Generator.buildPage(node: DocumentationNode): Unit = buildPages(listOf(node) fun Generator.buildOutline(node: DocumentationNode): Unit = buildOutlines(listOf(node)) fun Generator.buildAll(node: DocumentationNode): Unit = buildAll(listOf(node)) + + +interface NodeLocationAwareGenerator: Generator { + fun location(node: DocumentationNode): Location +} \ No newline at end of file diff --git a/core/src/main/kotlin/Locations/FoldersLocationService.kt b/core/src/main/kotlin/Locations/FoldersLocationService.kt index 83e1cf6a..ae5301e7 100644 --- a/core/src/main/kotlin/Locations/FoldersLocationService.kt +++ b/core/src/main/kotlin/Locations/FoldersLocationService.kt @@ -3,28 +3,18 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.name.Named import java.io.File - -class FoldersLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { - constructor(root: String): this(File(root), "") - - override val root: Location - get() = FileLocation(rootFile) - - override fun withExtension(newExtension: String): FileLocationService { - return if (extension.isEmpty()) FoldersLocationService(rootFile, newExtension) else this - } - - override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation { - return FileLocation(File(rootFile, relativePathToNode(qualifiedName, hasMembers)).appendExtension(extension)) - } -} - -fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String { - val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } - return if (!hasMembers) { - // leaf node, use file in owner's folder - parts.joinToString("/") - } else { - parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" - } -} +// +//class FoldersLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { +// constructor(root: String): this(File(root), "") +// +// override val root: Location +// get() = FileLocation(rootFile) +// +// override fun withExtension(newExtension: String): FileLocationService { +// return if (extension.isEmpty()) FoldersLocationService(rootFile, newExtension) else this +// } +// +// override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation { +// return FileLocation(File(rootFile, relativePathToNode(qualifiedName, hasMembers)).appendExtension(extension)) +// } +//} diff --git a/core/src/main/kotlin/Locations/LocationService.kt b/core/src/main/kotlin/Locations/LocationService.kt index a51ef8d4..6b7e0511 100644 --- a/core/src/main/kotlin/Locations/LocationService.kt +++ b/core/src/main/kotlin/Locations/LocationService.kt @@ -32,37 +32,51 @@ data class FileLocation(val file: File): Location { } } -/** - * Provides means of retrieving locations for [DocumentationNode](documentation nodes) - * - * `LocationService` determines where documentation for particular node should be generated - * - * * [FoldersLocationService] – represent packages and types as folders, members as files in those folders. - * * [SingleFolderLocationService] – all documentation is generated into single folder using fully qualified names - * for file names. - */ -interface LocationService { - fun withExtension(newExtension: String) = this - fun location(node: DocumentationNode): Location = location(node.path.map { it.name }, node.members.any()) - /** - * Calculates a location corresponding to the specified [qualifiedName]. - * @param hasMembers if true, the node for which the location is calculated has member nodes. - */ - fun location(qualifiedName: List, hasMembers: Boolean): Location - - val root: Location +fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String { + val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } + return if (!hasMembers) { + // leaf node, use file in owner's folder + parts.joinToString("/") + } else { + parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" + } } -interface FileLocationService: LocationService { - override fun withExtension(newExtension: String): FileLocationService = this - - override fun location(node: DocumentationNode): FileLocation = location(node.path.map { it.name }, node.members.any()) - override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation -} +// +///** +// * Provides means of retrieving locations for [DocumentationNode](documentation nodes) +// * +// * `LocationService` determines where documentation for particular node should be generated +// * +// * * [FoldersLocationService] – represent packages and types as folders, members as files in those folders. +// * * [SingleFolderLocationService] – all documentation is generated into single folder using fully qualified names +// * for file names. +// */ +//interface LocationService { +// fun withExtension(newExtension: String) = this +// +// fun location(node: DocumentationNode): Location = location(node.path.map { it.name }, node.members.any()) +// +// /** +// * Calculates a location corresponding to the specified [qualifiedName]. +// * @param hasMembers if true, the node for which the location is calculated has member nodes. +// */ +// fun location(qualifiedName: List, hasMembers: Boolean): Location +// +// val root: Location +//} +// +// +//interface FileLocationService: LocationService { +// override fun withExtension(newExtension: String): FileLocationService = this +// +// override fun location(node: DocumentationNode): FileLocation = location(node.path.map { it.name }, node.members.any()) +// override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation +//} fun identifierToFilename(path: String): String { val escaped = path.replace('<', '-').replace('>', '-') @@ -70,9 +84,14 @@ fun identifierToFilename(path: String): String { return if (lowercase == "index") "--index--" else lowercase } -/** - * Returns relative location between two nodes. Used for relative links in documentation. - */ -fun LocationService.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { +///** +// * Returns relative location between two nodes. Used for relative links in documentation. +// */ +//fun LocationService.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { +// return location(owner).relativePathTo(location(node), null) +//} + + +fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { return location(owner).relativePathTo(location(node), null) -} +} \ No newline at end of file diff --git a/core/src/main/kotlin/Locations/SingleFolderLocationService.kt b/core/src/main/kotlin/Locations/SingleFolderLocationService.kt index 1b4fdc28..25cf6f8e 100644 --- a/core/src/main/kotlin/Locations/SingleFolderLocationService.kt +++ b/core/src/main/kotlin/Locations/SingleFolderLocationService.kt @@ -3,18 +3,18 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.name.Named import java.io.File - -class SingleFolderLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { - constructor(root: String): this(File(root), "") - - override fun withExtension(newExtension: String): FileLocationService = - SingleFolderLocationService(rootFile, newExtension) - - override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation { - val filename = qualifiedName.map { identifierToFilename(it) }.joinToString("-") - return FileLocation(File(rootFile, filename).appendExtension(extension)) - } - - override val root: Location - get() = FileLocation(rootFile) -} \ No newline at end of file +// +//class SingleFolderLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { +// constructor(root: String): this(File(root), "") +// +// override fun withExtension(newExtension: String): FileLocationService = +// SingleFolderLocationService(rootFile, newExtension) +// +// override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation { +// val filename = qualifiedName.map { identifierToFilename(it) }.joinToString("-") +// return FileLocation(File(rootFile, filename).appendExtension(extension)) +// } +// +// override val root: Location +// get() = FileLocation(rootFile) +//} \ No newline at end of file diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index dfb114ec..9db08010 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -4,6 +4,7 @@ import com.google.inject.Binder import com.google.inject.Module import com.google.inject.Provider import com.google.inject.TypeLiteral +import com.google.inject.binder.AnnotatedBindingBuilder import com.google.inject.name.Names import org.jetbrains.dokka.* import org.jetbrains.dokka.Formats.FormatDescriptor @@ -11,6 +12,7 @@ import org.jetbrains.dokka.Model.DescriptorSignatureProvider import org.jetbrains.dokka.Samples.SampleProcessingService import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import java.io.File +import kotlin.reflect.KClass const val impliedPlatformsName = "impliedPlatforms" @@ -22,12 +24,7 @@ class DokkaAnalysisModule(val environment: AnalysisEnvironment, override fun configure(binder: Binder) { binder.bind().toInstance(logger) - val descriptor = ServiceLocator.lookup("format", options.outputFormat) - binder.bind().to(descriptor.descriptorSignatureProvider.java) binder.registerCategory("language") - binder.bind().to(descriptor.packageDocumentationBuilderClass.java) - binder.bind().to(descriptor.javaDocumentationBuilderClass.java) - binder.bind().to(descriptor.sampleProcessingService.java) val coreEnvironment = environment.createCoreEnvironment() binder.bind().toInstance(coreEnvironment) @@ -40,6 +37,9 @@ class DokkaAnalysisModule(val environment: AnalysisEnvironment, binder.bind().toInstance(defaultPlatformsProvider) binder.bind().toInstance(nodeReferenceGraph) + + val descriptor = ServiceLocator.lookup("format", options.outputFormat) + descriptor.configureAnalysis(binder) } } @@ -56,35 +56,26 @@ class DokkaOutputModule(val options: DocumentationOptions, binder.bind(File::class.java).annotatedWith(Names.named("outputDir")).toInstance(File(options.outputDir)) - binder.bindNameAnnotated("singleFolder") - binder.bindNameAnnotated("singleFolder") - binder.bindNameAnnotated("folders") - binder.bindNameAnnotated("folders") +// binder.bindNameAnnotated("singleFolder") +// binder.bindNameAnnotated("singleFolder") +// binder.bindNameAnnotated("folders") +// binder.bindNameAnnotated("folders") // defaults - binder.bind(LocationService::class.java).to(FoldersLocationService::class.java) - binder.bind(FileLocationService::class.java).to(FoldersLocationService::class.java) +// binder.bind(LocationService::class.java).to(FoldersLocationService::class.java) +// binder.bind(FileLocationService::class.java).to(FoldersLocationService::class.java) binder.registerCategory("outline") binder.registerCategory("format") binder.registerCategory("generator") - val descriptor = ServiceLocator.lookup("format", options.outputFormat) - - descriptor.outlineServiceClass?.let { clazz -> - binder.bind(OutlineFormatService::class.java).to(clazz.java) - } - descriptor.formatServiceClass?.let { clazz -> - binder.bind(FormatService::class.java).to(clazz.java) - } - - binder.bind().to(descriptor.generatorServiceClass.java) - - descriptor.packageListServiceClass?.let { binder.bind().to(it.java) } - binder.bind().toInstance(options) binder.bind().toInstance(logger) binder.bind(StringListType).annotatedWith(Names.named(impliedPlatformsName)).toInstance(options.impliedPlatforms) + + val descriptor = ServiceLocator.lookup("format", options.outputFormat) + + descriptor.configureOutput(binder) } } @@ -100,4 +91,9 @@ private inline fun Binder.bindNameAnnotat } -inline fun Binder.bind() = bind(T::class.java) +inline fun Binder.bind(): AnnotatedBindingBuilder = bind(T::class.java) + +inline infix fun > AnnotatedBindingBuilder.toOptional(kClass: TKClass?) = + kClass?.let { to(it.java) } + +inline infix fun > AnnotatedBindingBuilder.toType(kClass: TKClass) = to(kClass.java) diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index ff8a5260..aa3eff48 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -270,21 +270,6 @@ fun ContentNode.toTestString(): String { }.toString() } -class InMemoryLocation(override val path: String): Location { - override fun relativePathTo(other: Location, anchor: String?): String = - if (anchor != null) other.path + "#" + anchor else other.path -} - -object InMemoryLocationService: LocationService { - override fun location(qualifiedName: List, hasMembers: Boolean) = - InMemoryLocation(relativePathToNode(qualifiedName, hasMembers)) - - override val root: Location - get() = InMemoryLocation("") -} - -val tempLocation = InMemoryLocation("") - val ContentRoot.path: String get() = when(this) { is KotlinSourceRoot -> path -- cgit From f08f711a4290b47149ae3454d698e78c9f4c8e16 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 03:46:54 +0300 Subject: Fix Javadoc format --- core/src/main/kotlin/javadoc/dokka-adapters.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/javadoc/dokka-adapters.kt b/core/src/main/kotlin/javadoc/dokka-adapters.kt index c98a3801..84dff8f0 100644 --- a/core/src/main/kotlin/javadoc/dokka-adapters.kt +++ b/core/src/main/kotlin/javadoc/dokka-adapters.kt @@ -1,12 +1,16 @@ package org.jetbrains.dokka.javadoc +import com.google.inject.Binder import com.google.inject.Inject import com.sun.tools.doclets.formats.html.HtmlDoclet import org.jetbrains.dokka.* import org.jetbrains.dokka.Formats.FormatDescriptor +import org.jetbrains.dokka.Formats.FormatDescriptorAnalysisComponentProvider import org.jetbrains.dokka.Kotlin.KotlinAsJavaDescriptorSignatureProvider import org.jetbrains.dokka.Model.DescriptorSignatureProvider import org.jetbrains.dokka.Samples.DefaultSampleProcessingService +import org.jetbrains.dokka.Utilities.bind +import org.jetbrains.dokka.Utilities.toType import kotlin.reflect.KClass class JavadocGenerator @Inject constructor(val options: DocumentationOptions, val logger: DokkaLogger) : Generator { @@ -30,13 +34,13 @@ class JavadocGenerator @Inject constructor(val options: DocumentationOptions, va } } -class JavadocFormatDescriptor : FormatDescriptor { - override val formatServiceClass = null - override val outlineServiceClass = null - override val generatorServiceClass = JavadocGenerator::class +class JavadocFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider { override val packageDocumentationBuilderClass = KotlinAsJavaDocumentationBuilder::class override val javaDocumentationBuilderClass = JavaPsiDocumentationBuilder::class override val sampleProcessingService = DefaultSampleProcessingService::class - override val packageListServiceClass: KClass? = null override val descriptorSignatureProvider = KotlinAsJavaDescriptorSignatureProvider::class + + override fun configureOutput(binder: Binder): Unit = with(binder) { + bind() toType JavadocGenerator::class + } } -- cgit From c1abcaf32abd4e2d74b9246385b3541096cdb5b9 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 04:29:07 +0300 Subject: Extract Analysis components out of FormatDescriptor Fight with statically injected HtmlTemplateService --- core/src/main/kotlin/Formats/AnalysisComponents.kt | 45 ++++++++++++++++++++++ core/src/main/kotlin/Formats/FormatDescriptor.kt | 25 ++++-------- .../Formats/KotlinWebsiteHtmlFormatService.kt | 14 ++++--- core/src/main/kotlin/Formats/StandardFormats.kt | 42 ++++++++++---------- core/src/main/kotlin/Utilities/DokkaModules.kt | 5 --- core/src/main/kotlin/javadoc/dokka-adapters.kt | 13 ++----- 6 files changed, 84 insertions(+), 60 deletions(-) create mode 100644 core/src/main/kotlin/Formats/AnalysisComponents.kt diff --git a/core/src/main/kotlin/Formats/AnalysisComponents.kt b/core/src/main/kotlin/Formats/AnalysisComponents.kt new file mode 100644 index 00000000..97e1311e --- /dev/null +++ b/core/src/main/kotlin/Formats/AnalysisComponents.kt @@ -0,0 +1,45 @@ +package org.jetbrains.dokka.Formats + +import com.google.inject.Binder +import org.jetbrains.dokka.* +import org.jetbrains.dokka.Kotlin.KotlinAsJavaDescriptorSignatureProvider +import org.jetbrains.dokka.Kotlin.KotlinDescriptorSignatureProvider +import org.jetbrains.dokka.Model.DescriptorSignatureProvider +import org.jetbrains.dokka.Samples.DefaultSampleProcessingService +import org.jetbrains.dokka.Samples.SampleProcessingService +import org.jetbrains.dokka.Utilities.bind +import org.jetbrains.dokka.Utilities.toType +import kotlin.reflect.KClass + + +interface FormatDescriptorAnalysisComponentProvider : FormatDescriptorAnalysisComponent { + + val packageDocumentationBuilderClass: KClass + val javaDocumentationBuilderClass: KClass + val sampleProcessingService: KClass + val descriptorSignatureProvider: KClass + + + override fun configureAnalysis(binder: Binder): Unit = with(binder) { + bind() toType descriptorSignatureProvider + bind() toType packageDocumentationBuilderClass + bind() toType javaDocumentationBuilderClass + bind() toType sampleProcessingService + } +} + + +object KotlinAsJava: FormatDescriptorAnalysisComponentProvider { + override val packageDocumentationBuilderClass = KotlinAsJavaDocumentationBuilder::class + override val javaDocumentationBuilderClass = JavaPsiDocumentationBuilder::class + override val sampleProcessingService = DefaultSampleProcessingService::class + override val descriptorSignatureProvider = KotlinAsJavaDescriptorSignatureProvider::class +} + + +object KotlinAsKotlin: FormatDescriptorAnalysisComponentProvider { + override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class + override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class + override val sampleProcessingService = DefaultSampleProcessingService::class + override val descriptorSignatureProvider = KotlinDescriptorSignatureProvider::class +} \ No newline at end of file diff --git a/core/src/main/kotlin/Formats/FormatDescriptor.kt b/core/src/main/kotlin/Formats/FormatDescriptor.kt index fc0c4417..d3861b82 100644 --- a/core/src/main/kotlin/Formats/FormatDescriptor.kt +++ b/core/src/main/kotlin/Formats/FormatDescriptor.kt @@ -9,33 +9,24 @@ import org.jetbrains.dokka.Utilities.toOptional import org.jetbrains.dokka.Utilities.toType import kotlin.reflect.KClass -interface FormatDescriptor { + +interface FormatDescriptorAnalysisComponent { fun configureAnalysis(binder: Binder) - fun configureOutput(binder: Binder) } -interface FormatDescriptorAnalysisComponentProvider : FormatDescriptor { - - val packageDocumentationBuilderClass: KClass - val javaDocumentationBuilderClass: KClass - val sampleProcessingService: KClass - val descriptorSignatureProvider: KClass +interface FormatDescriptorOutputComponent { + fun configureOutput(binder: Binder) +} +interface FormatDescriptor: FormatDescriptorAnalysisComponent, FormatDescriptorOutputComponent - override fun configureAnalysis(binder: Binder): Unit = with(binder) { - bind() toType descriptorSignatureProvider - bind() toType packageDocumentationBuilderClass - bind() toType javaDocumentationBuilderClass - bind() toType sampleProcessingService - } -} -abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider { +abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor { override fun configureOutput(binder: Binder): Unit = with(binder) { bind() toOptional (outlineServiceClass) bind() toOptional formatServiceClass - bind() toType generatorServiceClass + bind() toType generatorServiceClass //bind() toType generatorServiceClass bind() toOptional packageListServiceClass } diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt index 8fd53cdd..208756c8 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt @@ -7,7 +7,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty import java.nio.file.Path -private object EmptyHtmlTemplateService : HtmlTemplateService { +object EmptyHtmlTemplateService : HtmlTemplateService { override fun appendFooter(to: StringBuilder) {} override fun appendHeader(to: StringBuilder, title: String?, basePath: Path) {} @@ -20,8 +20,9 @@ open class KotlinWebsiteHtmlOutputBuilder( generator: NodeLocationAwareGenerator, languageService: LanguageService, extension: String, - impliedPlatforms: List -) : HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, EmptyHtmlTemplateService) { + impliedPlatforms: List, + templateService: HtmlTemplateService +) : HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService) { private var needHardLineBreaks = false private var insideDiv = 0 @@ -173,12 +174,13 @@ open class KotlinWebsiteHtmlOutputBuilder( class KotlinWebsiteHtmlFormatService @Inject constructor( generator: NodeLocationAwareGenerator, signatureGenerator: LanguageService, - @Named(impliedPlatformsName) impliedPlatforms: List -) : HtmlFormatService(generator, signatureGenerator, EmptyHtmlTemplateService, impliedPlatforms) { + @Named(impliedPlatformsName) impliedPlatforms: List, + templateService: HtmlTemplateService +) : HtmlFormatService(generator, signatureGenerator, templateService, impliedPlatforms) { override fun enumerateSupportFiles(callback: (String, String) -> Unit) {} override fun createOutputBuilder(to: StringBuilder, location: Location) = - KotlinWebsiteHtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms) + KotlinWebsiteHtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService) } diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt index 54544ebc..9de667ab 100644 --- a/core/src/main/kotlin/Formats/StandardFormats.kt +++ b/core/src/main/kotlin/Formats/StandardFormats.kt @@ -1,41 +1,34 @@ package org.jetbrains.dokka.Formats +import com.google.inject.Binder +import com.google.inject.Provider import org.jetbrains.dokka.* -import org.jetbrains.dokka.Kotlin.KotlinAsJavaDescriptorSignatureProvider -import org.jetbrains.dokka.Kotlin.KotlinDescriptorSignatureProvider -import org.jetbrains.dokka.Samples.DefaultSampleProcessingService import org.jetbrains.dokka.Samples.KotlinWebsiteSampleProcessingService -import org.jetbrains.dokka.Samples.SampleProcessingService +import org.jetbrains.dokka.Utilities.bind import kotlin.reflect.KClass -abstract class KotlinFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() { - - override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class - override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class - +abstract class KotlinFormatDescriptorBase : FileGeneratorBasedFormatDescriptor(), FormatDescriptorAnalysisComponentProvider by KotlinAsKotlin { override val generatorServiceClass = FileGenerator::class override val outlineServiceClass: KClass? = null - override val sampleProcessingService: KClass = DefaultSampleProcessingService::class override val packageListServiceClass: KClass? = DefaultPackageListService::class - override val descriptorSignatureProvider = KotlinDescriptorSignatureProvider::class -} - -class HtmlFormatDescriptor : KotlinFormatDescriptorBase() { - override val formatServiceClass = HtmlFormatService::class - override val outlineServiceClass = HtmlFormatService::class } -class HtmlAsJavaFormatDescriptor : FileGeneratorBasedFormatDescriptor() { +abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() { override val formatServiceClass = HtmlFormatService::class override val outlineServiceClass = HtmlFormatService::class override val generatorServiceClass = FileGenerator::class - override val packageDocumentationBuilderClass = KotlinAsJavaDocumentationBuilder::class - override val javaDocumentationBuilderClass = JavaPsiDocumentationBuilder::class - override val sampleProcessingService: KClass = DefaultSampleProcessingService::class - override val packageListServiceClass: KClass? = DefaultPackageListService::class - override val descriptorSignatureProvider = KotlinAsJavaDescriptorSignatureProvider::class + override val packageListServiceClass = DefaultPackageListService::class + + override fun configureOutput(binder: Binder): Unit = with(binder) { + super.configureOutput(binder) + bind().toProvider(Provider { HtmlTemplateService.default("style.css") }) + } } +class HtmlFormatDescriptor : HtmlFormatDescriptorBase(), FormatDescriptorAnalysisComponent by KotlinAsKotlin + +class HtmlAsJavaFormatDescriptor : HtmlFormatDescriptorBase(), FormatDescriptorAnalysisComponent by KotlinAsJava + class KotlinWebsiteFormatDescriptor : KotlinFormatDescriptorBase() { override val formatServiceClass = KotlinWebsiteFormatService::class override val outlineServiceClass = YamlOutlineService::class @@ -51,6 +44,11 @@ class KotlinWebsiteHtmlFormatDescriptor : KotlinFormatDescriptorBase() { override val formatServiceClass = KotlinWebsiteHtmlFormatService::class override val sampleProcessingService = KotlinWebsiteSampleProcessingService::class override val outlineServiceClass = YamlOutlineService::class + + override fun configureOutput(binder: Binder) = with(binder) { + super.configureOutput(binder) + bind().toInstance(EmptyHtmlTemplateService) + } } class JekyllFormatDescriptor : KotlinFormatDescriptorBase() { diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index 9db08010..a2d720ef 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -49,11 +49,6 @@ class DokkaOutputModule(val options: DocumentationOptions, val logger: DokkaLogger) : Module { override fun configure(binder: Binder) { binder.bind(LanguageService::class.java).to(KotlinLanguageService::class.java) - - binder.bind(HtmlTemplateService::class.java).toProvider(object : Provider { - override fun get(): HtmlTemplateService = HtmlTemplateService.default("style.css") - }) - binder.bind(File::class.java).annotatedWith(Names.named("outputDir")).toInstance(File(options.outputDir)) // binder.bindNameAnnotated("singleFolder") diff --git a/core/src/main/kotlin/javadoc/dokka-adapters.kt b/core/src/main/kotlin/javadoc/dokka-adapters.kt index 84dff8f0..bed211f6 100644 --- a/core/src/main/kotlin/javadoc/dokka-adapters.kt +++ b/core/src/main/kotlin/javadoc/dokka-adapters.kt @@ -5,13 +5,10 @@ import com.google.inject.Inject import com.sun.tools.doclets.formats.html.HtmlDoclet import org.jetbrains.dokka.* import org.jetbrains.dokka.Formats.FormatDescriptor -import org.jetbrains.dokka.Formats.FormatDescriptorAnalysisComponentProvider -import org.jetbrains.dokka.Kotlin.KotlinAsJavaDescriptorSignatureProvider -import org.jetbrains.dokka.Model.DescriptorSignatureProvider -import org.jetbrains.dokka.Samples.DefaultSampleProcessingService +import org.jetbrains.dokka.Formats.FormatDescriptorAnalysisComponent +import org.jetbrains.dokka.Formats.KotlinAsJava import org.jetbrains.dokka.Utilities.bind import org.jetbrains.dokka.Utilities.toType -import kotlin.reflect.KClass class JavadocGenerator @Inject constructor(val options: DocumentationOptions, val logger: DokkaLogger) : Generator { @@ -34,11 +31,7 @@ class JavadocGenerator @Inject constructor(val options: DocumentationOptions, va } } -class JavadocFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider { - override val packageDocumentationBuilderClass = KotlinAsJavaDocumentationBuilder::class - override val javaDocumentationBuilderClass = JavaPsiDocumentationBuilder::class - override val sampleProcessingService = DefaultSampleProcessingService::class - override val descriptorSignatureProvider = KotlinAsJavaDescriptorSignatureProvider::class +class JavadocFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponent by KotlinAsJava { override fun configureOutput(binder: Binder): Unit = with(binder) { bind() toType JavadocGenerator::class -- cgit From c7523225200a3e24d24fb3b0492d5c377246fc69 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 04:57:45 +0300 Subject: Make possible to calculate path to root --- core/src/main/kotlin/Formats/HtmlFormatService.kt | 9 ++------- core/src/main/kotlin/Formats/HtmlTemplateService.kt | 6 +++--- core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt | 4 ++-- core/src/main/kotlin/Generation/FileGenerator.kt | 2 ++ core/src/main/kotlin/Generation/Generator.kt | 3 +++ core/src/main/kotlin/Locations/LocationService.kt | 6 ++++++ 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index 560d8597..0073553c 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -80,7 +80,7 @@ open class HtmlOutputBuilder(to: StringBuilder, } override fun appendNodes(nodes: Iterable) { - templateService.appendHeader(to, getPageTitle(nodes), locationService.calcPathToRoot(location)) + templateService.appendHeader(to, getPageTitle(nodes), generator.relativeToRoot(location)) super.appendNodes(nodes) templateService.appendFooter(to) } @@ -108,7 +108,7 @@ open class HtmlFormatService @Inject constructor(generator: NodeLocationAwareGen HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService) override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable) { - templateService.appendHeader(to, "Module Contents", locationService.calcPathToRoot(location)) + templateService.appendHeader(to, "Module Contents", generator.relativeToRoot(location)) super.appendOutline(location, to, nodes) templateService.appendFooter(to) } @@ -132,11 +132,6 @@ open class HtmlFormatService @Inject constructor(generator: NodeLocationAwareGen } } -private fun LocationService.calcPathToRoot(location: Location): Path { - val path = Paths.get(location.path) - return path.parent?.relativize(Paths.get(root.path + '/')) ?: path -} - fun getPageTitle(nodes: Iterable): String? { val breakdownByLocation = nodes.groupBy { node -> formatPageTitle(node) } return breakdownByLocation.keys.singleOrNull() diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt index 22832e34..84e01910 100644 --- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt +++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt @@ -1,9 +1,9 @@ package org.jetbrains.dokka -import java.nio.file.Path +import java.io.File interface HtmlTemplateService { - fun appendHeader(to: StringBuilder, title: String?, basePath: Path) + fun appendHeader(to: StringBuilder, title: String?, basePath: File) fun appendFooter(to: StringBuilder) companion object { @@ -16,7 +16,7 @@ interface HtmlTemplateService { to.appendln("") to.appendln("") } - override fun appendHeader(to: StringBuilder, title: String?, relativePathToRoot: String) { + override fun appendHeader(to: StringBuilder, title: String?, basePath: File) { to.appendln("") to.appendln("") to.appendln("") diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt index 208756c8..6ced75b5 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt @@ -4,13 +4,13 @@ import com.google.inject.Inject import com.google.inject.name.Named import org.jetbrains.dokka.Utilities.impliedPlatformsName import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty -import java.nio.file.Path +import java.io.File object EmptyHtmlTemplateService : HtmlTemplateService { override fun appendFooter(to: StringBuilder) {} - override fun appendHeader(to: StringBuilder, title: String?, basePath: Path) {} + override fun appendHeader(to: StringBuilder, title: String?, basePath: File) {} } diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index 3193a5bc..9c7c65e6 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -14,6 +14,8 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) @set:Inject(optional = true) lateinit var options: DocumentationOptions @set:Inject(optional = true) var packageListService: PackageListService? = null + override val root: File = rootFile + override fun location(node: DocumentationNode): FileLocation { return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any())).appendExtension(formatService.extension)) } diff --git a/core/src/main/kotlin/Generation/Generator.kt b/core/src/main/kotlin/Generation/Generator.kt index 003386ef..23286e29 100644 --- a/core/src/main/kotlin/Generation/Generator.kt +++ b/core/src/main/kotlin/Generation/Generator.kt @@ -1,5 +1,7 @@ package org.jetbrains.dokka +import java.io.File + interface Generator { fun buildPages(nodes: Iterable) fun buildOutlines(nodes: Iterable) @@ -23,4 +25,5 @@ fun Generator.buildAll(node: DocumentationNode): Unit = buildAll(listOf(node)) interface NodeLocationAwareGenerator: Generator { fun location(node: DocumentationNode): Location + val root: File } \ No newline at end of file diff --git a/core/src/main/kotlin/Locations/LocationService.kt b/core/src/main/kotlin/Locations/LocationService.kt index 6b7e0511..8ea45dae 100644 --- a/core/src/main/kotlin/Locations/LocationService.kt +++ b/core/src/main/kotlin/Locations/LocationService.kt @@ -94,4 +94,10 @@ fun identifierToFilename(path: String): String { fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { return location(owner).relativePathTo(location(node), null) +} + + +fun NodeLocationAwareGenerator.relativeToRoot(from: Location): File { + val file = File(from.path) + return file.relativeTo(root) } \ No newline at end of file -- cgit From 5e9dd421cd323c138486cf8b38b6ce7158bcca8a Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 05:18:41 +0300 Subject: Bind NodeLocationAwareGenerator to Generator --- core/src/main/kotlin/Formats/FormatDescriptor.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/Formats/FormatDescriptor.kt b/core/src/main/kotlin/Formats/FormatDescriptor.kt index d3861b82..aa00df97 100644 --- a/core/src/main/kotlin/Formats/FormatDescriptor.kt +++ b/core/src/main/kotlin/Formats/FormatDescriptor.kt @@ -2,8 +2,6 @@ package org.jetbrains.dokka.Formats import com.google.inject.Binder import org.jetbrains.dokka.* -import org.jetbrains.dokka.Model.DescriptorSignatureProvider -import org.jetbrains.dokka.Samples.SampleProcessingService import org.jetbrains.dokka.Utilities.bind import org.jetbrains.dokka.Utilities.toOptional import org.jetbrains.dokka.Utilities.toType @@ -18,16 +16,17 @@ interface FormatDescriptorOutputComponent { fun configureOutput(binder: Binder) } -interface FormatDescriptor: FormatDescriptorAnalysisComponent, FormatDescriptorOutputComponent +interface FormatDescriptor : FormatDescriptorAnalysisComponent, FormatDescriptorOutputComponent abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor { override fun configureOutput(binder: Binder): Unit = with(binder) { + bind() toType NodeLocationAwareGenerator::class + bind() toOptional (outlineServiceClass) bind() toOptional formatServiceClass - bind() toType generatorServiceClass - //bind() toType generatorServiceClass + bind() toType generatorServiceClass bind() toOptional packageListServiceClass } -- cgit From 1eab9404b8ecbd51e5270af0cc0c9545e68f35f2 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 05:20:21 +0300 Subject: Remove categories to prevent injection errors When not NodeLocationAwareGenerator used --- core/src/main/kotlin/Utilities/DokkaModules.kt | 13 ------------- core/src/main/resources/dokka/generator/default.properties | 2 -- core/src/main/resources/dokka/generator/javadoc.properties | 2 -- core/src/main/resources/dokka/language/java.properties | 1 - core/src/main/resources/dokka/language/kotlin.properties | 1 - core/src/main/resources/dokka/outline/yaml.properties | 1 - 6 files changed, 20 deletions(-) delete mode 100644 core/src/main/resources/dokka/generator/default.properties delete mode 100644 core/src/main/resources/dokka/generator/javadoc.properties delete mode 100644 core/src/main/resources/dokka/language/java.properties delete mode 100644 core/src/main/resources/dokka/language/kotlin.properties delete mode 100644 core/src/main/resources/dokka/outline/yaml.properties diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index a2d720ef..fcc2f692 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -51,19 +51,6 @@ class DokkaOutputModule(val options: DocumentationOptions, binder.bind(LanguageService::class.java).to(KotlinLanguageService::class.java) binder.bind(File::class.java).annotatedWith(Names.named("outputDir")).toInstance(File(options.outputDir)) -// binder.bindNameAnnotated("singleFolder") -// binder.bindNameAnnotated("singleFolder") -// binder.bindNameAnnotated("folders") -// binder.bindNameAnnotated("folders") - - // defaults -// binder.bind(LocationService::class.java).to(FoldersLocationService::class.java) -// binder.bind(FileLocationService::class.java).to(FoldersLocationService::class.java) - - binder.registerCategory("outline") - binder.registerCategory("format") - binder.registerCategory("generator") - binder.bind().toInstance(options) binder.bind().toInstance(logger) binder.bind(StringListType).annotatedWith(Names.named(impliedPlatformsName)).toInstance(options.impliedPlatforms) diff --git a/core/src/main/resources/dokka/generator/default.properties b/core/src/main/resources/dokka/generator/default.properties deleted file mode 100644 index a4a16200..00000000 --- a/core/src/main/resources/dokka/generator/default.properties +++ /dev/null @@ -1,2 +0,0 @@ -class=org.jetbrains.dokka.FileGenerator -description=Default documentation generator \ No newline at end of file diff --git a/core/src/main/resources/dokka/generator/javadoc.properties b/core/src/main/resources/dokka/generator/javadoc.properties deleted file mode 100644 index 4075704f..00000000 --- a/core/src/main/resources/dokka/generator/javadoc.properties +++ /dev/null @@ -1,2 +0,0 @@ -class=org.jetbrains.dokka.javadoc.JavadocGenerator -description=Produces output via JDK javadoc tool \ No newline at end of file diff --git a/core/src/main/resources/dokka/language/java.properties b/core/src/main/resources/dokka/language/java.properties deleted file mode 100644 index ab42f532..00000000 --- a/core/src/main/resources/dokka/language/java.properties +++ /dev/null @@ -1 +0,0 @@ -class=org.jetbrains.dokka.JavaLanguageService \ No newline at end of file diff --git a/core/src/main/resources/dokka/language/kotlin.properties b/core/src/main/resources/dokka/language/kotlin.properties deleted file mode 100644 index 16092007..00000000 --- a/core/src/main/resources/dokka/language/kotlin.properties +++ /dev/null @@ -1 +0,0 @@ -class=org.jetbrains.dokka.KotlinLanguageService \ No newline at end of file diff --git a/core/src/main/resources/dokka/outline/yaml.properties b/core/src/main/resources/dokka/outline/yaml.properties deleted file mode 100644 index 7268af37..00000000 --- a/core/src/main/resources/dokka/outline/yaml.properties +++ /dev/null @@ -1 +0,0 @@ -class=org.jetbrains.dokka.YamlOutlineService \ No newline at end of file -- cgit From ff8948350406b085ca7feeb5d8aabd74b9eadf83 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 05:21:10 +0300 Subject: Fix outline file names, fix incorrect placement of support files --- core/src/main/kotlin/Generation/FileGenerator.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index 9c7c65e6..ea34a269 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -17,11 +17,14 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override val root: File = rootFile override fun location(node: DocumentationNode): FileLocation { - return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any())).appendExtension(formatService.extension)) + return locationWithoutExtension(node).let { it.copy(file = it.file.appendExtension(formatService.linkExtension)) } + } + + fun locationWithoutExtension(node: DocumentationNode): FileLocation { + return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any()))) } override fun buildPages(nodes: Iterable) { - //val specificLocationService = locationService.withExtension(formatService.extension) for ((location, items) in nodes.groupBy { location(it) }) { val file = location.file @@ -41,7 +44,7 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override fun buildOutlines(nodes: Iterable) { val outlineService = this.outlineService ?: return - for ((location, items) in nodes.groupBy { location(it) }) { + for ((location, items) in nodes.groupBy { locationWithoutExtension(it) }) { val file = outlineService.getOutlineFileName(location) file.parentFile?.mkdirsOrFail() FileOutputStream(file).use { @@ -54,7 +57,7 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override fun buildSupportFiles() { formatService.enumerateSupportFiles { resource, targetPath -> - FileOutputStream(relativePathToNode(listOf(targetPath), false)).use { + FileOutputStream(File(root, relativePathToNode(listOf(targetPath), false))).use { javaClass.getResourceAsStream(resource).copyTo(it) } } -- cgit From 54191cc5ff055942426e888a5a71f7bcf29c75f9 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 05:57:57 +0300 Subject: Revert Guice version to 3.0, to fix problems with Guava? --- core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.gradle b/core/build.gradle index b089dc07..d37b98b3 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -22,7 +22,7 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$bundled_kotlin_compiler_version" compile "org.jetbrains.kotlin:kotlin-reflect:$bundled_kotlin_compiler_version" - compile group: 'com.google.inject', name: 'guice', version: '4.1.0' + compile group: 'com.google.inject', name: 'guice', version: '3.0' compile "org.jsoup:jsoup:1.8.3" compile "org.jetbrains.kotlin:kotlin-compiler:$bundled_kotlin_compiler_version" -- cgit From d6d5df5bc04be5274446e9f37a3e52672083da36 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 05:58:30 +0300 Subject: Add actual relativePathToNode function --- core/src/main/kotlin/Generation/FileGenerator.kt | 2 +- core/src/main/kotlin/Locations/LocationService.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index ea34a269..3d25e932 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -21,7 +21,7 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) } fun locationWithoutExtension(node: DocumentationNode): FileLocation { - return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any()))) + return FileLocation(File(rootFile, relativePathToNode(node))) } override fun buildPages(nodes: Iterable) { diff --git a/core/src/main/kotlin/Locations/LocationService.kt b/core/src/main/kotlin/Locations/LocationService.kt index 8ea45dae..e453baca 100644 --- a/core/src/main/kotlin/Locations/LocationService.kt +++ b/core/src/main/kotlin/Locations/LocationService.kt @@ -44,6 +44,7 @@ fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String } } +fun relativePathToNode(node: DocumentationNode) = relativePathToNode(node.path.map { it.name }, node.members.any()) // -- cgit From e126ff625eba33d91b3242a4e6e951d1e9f94080 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Sat, 2 Dec 2017 05:59:01 +0300 Subject: Update tests to new reality --- core/src/test/kotlin/TestAPI.kt | 11 +++++ core/src/test/kotlin/format/GFMFormatTest.kt | 19 ++++++-- core/src/test/kotlin/format/HtmlFormatTest.kt | 21 +++++--- .../test/kotlin/format/KotlinWebSiteFormatTest.kt | 21 ++++++-- .../kotlin/format/KotlinWebSiteHtmlFormatTest.kt | 16 +++++-- .../KotlinWebSiteRunnableSamplesFormatTest.kt | 56 +++++++++++----------- core/src/test/kotlin/format/MarkdownFormatTest.kt | 52 ++++++++++++-------- core/src/test/kotlin/format/PackageDocsTest.kt | 13 +++-- 8 files changed, 140 insertions(+), 69 deletions(-) diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index aa3eff48..4cd11390 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -276,3 +276,14 @@ val ContentRoot.path: String is JavaSourceRoot -> file.path else -> throw UnsupportedOperationException() } + + +val TestFileGenerator = FileGenerator(createTempDir()) + +fun FileGenerator.buildPagesAndReadInto(nodes: List, sb: StringBuilder) { + buildPages(nodes) + nodes.forEach { + val fileForNode = TestFileGenerator.location(it).file + sb.append(fileForNode.readText()) + } +} \ No newline at end of file diff --git a/core/src/test/kotlin/format/GFMFormatTest.kt b/core/src/test/kotlin/format/GFMFormatTest.kt index c097c5c8..f5b833f6 100644 --- a/core/src/test/kotlin/format/GFMFormatTest.kt +++ b/core/src/test/kotlin/format/GFMFormatTest.kt @@ -2,22 +2,33 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.GFMFormatService import org.jetbrains.dokka.KotlinLanguageService +import org.junit.Before import org.junit.Test class GFMFormatTest { - private val gfmService = GFMFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) + private val gfmService = GFMFormatService(TestFileGenerator, KotlinLanguageService(), listOf()) - @Test fun sample() { + @Before + fun prepareFileGenerator() { + TestFileGenerator.formatService = gfmService + } + + @Test + fun sample() { verifyGFMNodeByName("sample", "Foo") } - @Test fun listInTableCell() { + @Test + fun listInTableCell() { verifyGFMNodeByName("listInTableCell", "Foo") } private fun verifyGFMNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/gfm/$fileName.kt", ".md") { model, output -> - gfmService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) + TestFileGenerator.buildPagesAndReadInto( + model.members.single().members.filter { it.name == name }, + output + ) } } } diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt index 01e4559e..4906fbfa 100644 --- a/core/src/test/kotlin/format/HtmlFormatTest.kt +++ b/core/src/test/kotlin/format/HtmlFormatTest.kt @@ -3,11 +3,17 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot import org.jetbrains.kotlin.config.KotlinSourceRoot +import org.junit.Before import org.junit.Test import java.io.File class HtmlFormatTest { - private val htmlService = HtmlFormatService(InMemoryLocationService, KotlinLanguageService(), HtmlTemplateService.default(), listOf()) + private val htmlService = HtmlFormatService(TestFileGenerator, KotlinLanguageService(), HtmlTemplateService.default(), listOf()) + + @Before + fun prepareFileGenerator() { + TestFileGenerator.formatService = htmlService + } @Test fun classWithCompanionObject() { verifyHtmlNode("classWithCompanionObject") @@ -31,10 +37,10 @@ class HtmlFormatTest { @Test fun deprecated() { verifyOutput("testdata/format/deprecated.kt", ".package.html") { model, output -> - htmlService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + TestFileGenerator.buildPagesAndReadInto(model.members, output) } verifyOutput("testdata/format/deprecated.kt", ".class.html") { model, output -> - htmlService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) } } @@ -102,7 +108,10 @@ class HtmlFormatTest { verifyOutput(arrayOf(KotlinSourceRoot("testdata/format/crossLanguage/kotlinExtendsJava/Bar.kt"), JavaSourceRoot(File("testdata/format/crossLanguage/kotlinExtendsJava"), null)), ".html") { model, output -> - htmlService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == "Bar" }) + TestFileGenerator.buildPagesAndReadInto( + model.members.single().members.filter { it.name == "Bar" }, + output + ) } } @@ -158,7 +167,7 @@ class HtmlFormatTest { withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List) { verifyOutput("testdata/format/$fileName.kt", ".html", withKotlinRuntime = withKotlinRuntime) { model, output -> - htmlService.createOutputBuilder(output, tempLocation).appendNodes(nodeFilter(model)) + TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) } } @@ -170,7 +179,7 @@ class HtmlFormatTest { withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List) { verifyJavaOutput("testdata/format/$fileName.java", ".html", withKotlinRuntime = withKotlinRuntime) { model, output -> - htmlService.createOutputBuilder(output, tempLocation).appendNodes(nodeFilter(model)) + TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) } } } diff --git a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt index af44b048..b3ea82b7 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt @@ -1,12 +1,19 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* +import org.junit.Before import org.junit.Ignore import org.junit.Test @Ignore class KotlinWebSiteFormatTest { - private val kwsService = KotlinWebsiteFormatService(InMemoryLocationService, KotlinLanguageService(), listOf(), DokkaConsoleLogger) + private val kwsService = KotlinWebsiteFormatService(TestFileGenerator, KotlinLanguageService(), listOf(), DokkaConsoleLogger) + + @Before + fun prepareFileGenerator() { + TestFileGenerator.formatService = kwsService + } + @Test fun sample() { verifyKWSNodeByName("sample", "foo") @@ -29,14 +36,20 @@ class KotlinWebSiteFormatTest { val path = "dataTagsInGroupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".md", "testdata/format/website/$path/multiplatform.kt") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode })) + TestFileGenerator.buildPagesAndReadInto( + listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), + output + ) } verifyMultiplatformPackage(module, path) } private fun verifyKWSNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/website/$fileName.kt", ".md", format = "kotlin-website") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) + TestFileGenerator.buildPagesAndReadInto( + model.members.single().members.filter { it.name == name }, + output + ) } } @@ -58,7 +71,7 @@ class KotlinWebSiteFormatTest { private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { verifyModelOutput(module, ".package.md", "testdata/format/website/$path/multiplatform.kt") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + TestFileGenerator.buildPagesAndReadInto(model.members, output) } } diff --git a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt index 433c9c13..8c94fdcb 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt @@ -1,11 +1,16 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* +import org.junit.Before import org.junit.Test class KotlinWebSiteHtmlFormatTest { - private val kwsService = KotlinWebsiteHtmlFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) + private val kwsService = KotlinWebsiteHtmlFormatService(TestFileGenerator, KotlinLanguageService(), listOf(), EmptyHtmlTemplateService) + @Before + fun prepareFileGenerator() { + TestFileGenerator.formatService = kwsService + } @Test fun dropImport() { verifyKWSNodeByName("dropImport", "foo") @@ -44,14 +49,17 @@ class KotlinWebSiteHtmlFormatTest { val path = "dataTagsInGroupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".html", "testdata/format/website-html/$path/multiplatform.kt") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode })) + TestFileGenerator.buildPagesAndReadInto( + listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), + output + ) } verifyMultiplatformPackage(module, path) } private fun verifyKWSNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/website-html/$fileName.kt", ".html", format = "kotlin-website-html") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) + TestFileGenerator.buildPagesAndReadInto(model.members.single().members.filter { it.name == name }, output) } } @@ -73,7 +81,7 @@ class KotlinWebSiteHtmlFormatTest { private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { verifyModelOutput(module, ".package.html", "testdata/format/website-html/$path/multiplatform.kt") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + TestFileGenerator.buildPagesAndReadInto(model.members, output) } } diff --git a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt index 44155004..453b1de8 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt @@ -8,32 +8,32 @@ import org.junit.Test @Ignore class KotlinWebSiteRunnableSamplesFormatTest { - private val kwsService = KotlinWebsiteRunnableSamplesFormatService(InMemoryLocationService, KotlinLanguageService(), listOf(), DokkaConsoleLogger) - - - @Test fun dropImport() { - verifyKWSNodeByName("dropImport", "foo") - } - - @Test fun sample() { - verifyKWSNodeByName("sample", "foo") - } - - @Test fun sampleWithAsserts() { - verifyKWSNodeByName("sampleWithAsserts", "a") - } - - @Test fun newLinesInSamples() { - verifyKWSNodeByName("newLinesInSamples", "foo") - } - - @Test fun newLinesInImportList() { - verifyKWSNodeByName("newLinesInImportList", "foo") - } - - private fun verifyKWSNodeByName(fileName: String, name: String) { - verifyOutput("testdata/format/website-samples/$fileName.kt", ".md", format = "kotlin-website-samples") { model, output -> - kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) - } - } +// private val kwsService = KotlinWebsiteRunnableSamplesFormatService(InMemoryLocationService, KotlinLanguageService(), listOf(), DokkaConsoleLogger) +// +// +// @Test fun dropImport() { +// verifyKWSNodeByName("dropImport", "foo") +// } +// +// @Test fun sample() { +// verifyKWSNodeByName("sample", "foo") +// } +// +// @Test fun sampleWithAsserts() { +// verifyKWSNodeByName("sampleWithAsserts", "a") +// } +// +// @Test fun newLinesInSamples() { +// verifyKWSNodeByName("newLinesInSamples", "foo") +// } +// +// @Test fun newLinesInImportList() { +// verifyKWSNodeByName("newLinesInImportList", "foo") +// } +// +// private fun verifyKWSNodeByName(fileName: String, name: String) { +// verifyOutput("testdata/format/website-samples/$fileName.kt", ".md", format = "kotlin-website-samples") { model, output -> +// kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) +// } +// } } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index 820af361..e273f6c1 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -1,10 +1,16 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* +import org.junit.Before import org.junit.Test class MarkdownFormatTest { - private val markdownService = MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) + private val markdownService = MarkdownFormatService(TestFileGenerator, KotlinLanguageService(), listOf()) + + @Before + fun prepareFileGenerator() { + TestFileGenerator.formatService = markdownService + } @Test fun emptyDescription() { verifyMarkdownNode("emptyDescription") @@ -34,21 +40,23 @@ class MarkdownFormatTest { @Test fun extensions() { verifyOutput("testdata/format/extensions.kt", ".package.md") { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + TestFileGenerator.buildPagesAndReadInto(model.members, output) } verifyOutput("testdata/format/extensions.kt", ".class.md") { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) } } @Test fun enumClass() { verifyOutput("testdata/format/enumClass.kt", ".md") { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) } verifyOutput("testdata/format/enumClass.kt", ".value.md") { model, output -> val enumClassNode = model.members.single().members[0] - markdownService.createOutputBuilder(output, tempLocation).appendNodes( - enumClassNode.members.filter { it.name == "LOCAL_CONTINUE_AND_BREAK" }) + TestFileGenerator.buildPagesAndReadInto( + enumClassNode.members.filter { it.name == "LOCAL_CONTINUE_AND_BREAK" }, + output + ) } } @@ -282,22 +290,22 @@ class MarkdownFormatTest { @Test fun multiplePlatformsMergeMembers() { val module = buildMultiplePlatforms("multiplatform/mergeMembers") verifyModelOutput(module, ".md", "testdata/format/multiplatform/mergeMembers/foo.kt") { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) } } @Test fun multiplePlatformsOmitRedundant() { val module = buildMultiplePlatforms("multiplatform/omitRedundant") verifyModelOutput(module, ".md", "testdata/format/multiplatform/omitRedundant/foo.kt") { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) } } @Test fun multiplePlatformsImplied() { val module = buildMultiplePlatforms("multiplatform/implied") verifyModelOutput(module, ".md", "testdata/format/multiplatform/implied/foo.kt") { model, output -> - MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf("JVM", "JS")) - .createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) +// MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf("JVM", "JS")) +// .createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) } } @@ -328,8 +336,10 @@ class MarkdownFormatTest { val path = "multiplatform/groupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".md", "testdata/format/$path/multiplatform.kt") { model, output -> - markdownService.createOutputBuilder(output, tempLocation) - .appendNodes(listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode })) + TestFileGenerator.buildPagesAndReadInto( + listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), + output + ) } verifyMultiplatformPackage(module, path) } @@ -338,8 +348,10 @@ class MarkdownFormatTest { val path = "multiplatform/breadcrumbsInMemberOfMemberOfGroupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".md", "testdata/format/$path/multiplatform.kt") { model, output -> - markdownService.createOutputBuilder(output, tempLocation) - .appendNodes(listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }?.member(NodeKind.Class)?.member(NodeKind.Function))) + TestFileGenerator.buildPagesAndReadInto( + listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }?.member(NodeKind.Class)?.member(NodeKind.Function)), + output + ) } } @@ -428,15 +440,15 @@ class MarkdownFormatTest { private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { verifyModelOutput(module, ".package.md", "testdata/format/$path/multiplatform.kt") { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + TestFileGenerator.buildPagesAndReadInto(model.members, output) } } private fun verifyMultiplatformIndex(module: DocumentationModule, path: String) { verifyModelOutput(module, ".md", "testdata/format/$path/multiplatform.index.kt") { model, output -> - MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) - .createOutputBuilder(output, tempLocation).appendNodes(listOf(model)) +// MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) +// .createOutputBuilder(output, tempLocation).appendNodes(listOf(model)) } } @@ -446,7 +458,7 @@ class MarkdownFormatTest { private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) { verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + TestFileGenerator.buildPagesAndReadInto(model.members, output) } } @@ -466,7 +478,7 @@ class MarkdownFormatTest { withKotlinRuntime = withKotlinRuntime, includeNonPublic = includeNonPublic ) { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(nodeFilter(model)) + TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) } } @@ -476,7 +488,7 @@ class MarkdownFormatTest { private fun verifyJavaMarkdownNodes(fileName: String, withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List) { verifyJavaOutput("testdata/format/$fileName.java", ".md", withKotlinRuntime = withKotlinRuntime) { model, output -> - markdownService.createOutputBuilder(output, tempLocation).appendNodes(nodeFilter(model)) + TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) } } diff --git a/core/src/test/kotlin/format/PackageDocsTest.kt b/core/src/test/kotlin/format/PackageDocsTest.kt index a5547025..067ff775 100644 --- a/core/src/test/kotlin/format/PackageDocsTest.kt +++ b/core/src/test/kotlin/format/PackageDocsTest.kt @@ -5,14 +5,14 @@ import com.nhaarman.mockito_kotlin.doAnswer import com.nhaarman.mockito_kotlin.eq import com.nhaarman.mockito_kotlin.mock import org.jetbrains.dokka.* -import org.jetbrains.dokka.tests.InMemoryLocationService +import org.jetbrains.dokka.tests.TestFileGenerator import org.jetbrains.dokka.tests.assertEqualsIgnoringSeparators import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.junit.Assert.assertEquals import org.junit.Test import java.io.File -public class PackageDocsTest { +class PackageDocsTest { @Test fun verifyParse() { val docs = PackageDocs(null, DokkaConsoleLogger) docs.parse("testdata/packagedocs/stdlib.md", emptyList()) @@ -38,7 +38,14 @@ public class PackageDocsTest { fun checkMarkdownOutput(docs: PackageDocs, expectedFilePrefix: String) { val out = StringBuilder() - val outputBuilder = MarkdownOutputBuilder(out, InMemoryLocationService.root, InMemoryLocationService, KotlinLanguageService(), ".md", emptyList()) + val outputBuilder = MarkdownOutputBuilder( + out, + FileLocation(TestFileGenerator.root), + TestFileGenerator, + KotlinLanguageService(), + ".md", + emptyList() + ) fun checkOutput(content: Content, filePostfix: String) { outputBuilder.appendContent(content) val expectedFile = File(expectedFilePrefix + filePostfix) -- cgit From 3098b8e7665bcda25f8ead2496c161e10512d7b3 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 4 Dec 2017 18:12:01 +0300 Subject: Introduce test case with preset FileGenerator --- core/src/test/kotlin/TestAPI.kt | 11 -------- .../test/kotlin/format/FileGeneratorTestCase.kt | 31 ++++++++++++++++++++ core/src/test/kotlin/format/GFMFormatTest.kt | 12 ++------ core/src/test/kotlin/format/HtmlFormatTest.kt | 19 +++++-------- .../test/kotlin/format/KotlinWebSiteFormatTest.kt | 16 ++++------- .../kotlin/format/KotlinWebSiteHtmlFormatTest.kt | 15 ++++------ core/src/test/kotlin/format/MarkdownFormatTest.kt | 33 +++++++++------------- core/src/test/kotlin/format/PackageDocsTest.kt | 7 +++-- 8 files changed, 69 insertions(+), 75 deletions(-) create mode 100644 core/src/test/kotlin/format/FileGeneratorTestCase.kt diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index 4cd11390..aa3eff48 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -276,14 +276,3 @@ val ContentRoot.path: String is JavaSourceRoot -> file.path else -> throw UnsupportedOperationException() } - - -val TestFileGenerator = FileGenerator(createTempDir()) - -fun FileGenerator.buildPagesAndReadInto(nodes: List, sb: StringBuilder) { - buildPages(nodes) - nodes.forEach { - val fileForNode = TestFileGenerator.location(it).file - sb.append(fileForNode.readText()) - } -} \ No newline at end of file diff --git a/core/src/test/kotlin/format/FileGeneratorTestCase.kt b/core/src/test/kotlin/format/FileGeneratorTestCase.kt new file mode 100644 index 00000000..7f6d6f3f --- /dev/null +++ b/core/src/test/kotlin/format/FileGeneratorTestCase.kt @@ -0,0 +1,31 @@ +package org.jetbrains.dokka.tests + +import org.jetbrains.dokka.DocumentationNode +import org.jetbrains.dokka.FileGenerator +import org.jetbrains.dokka.FormatService +import org.junit.Before +import org.junit.Rule +import org.junit.rules.TemporaryFolder + + +abstract class FileGeneratorTestCase { + abstract val formatService: FormatService + + @get:Rule + var folder = TemporaryFolder() + + val fileGenerator = FileGenerator(folder.apply { create() }.root) + + @Before + fun bindGenerator() { + fileGenerator.formatService = formatService + } + + fun buildPagesAndReadInto(nodes: List, sb: StringBuilder) = with(fileGenerator) { + buildPages(nodes) + nodes.forEach { + val fileForNode = location(it).file + sb.append(fileForNode.readText()) + } + } +} \ No newline at end of file diff --git a/core/src/test/kotlin/format/GFMFormatTest.kt b/core/src/test/kotlin/format/GFMFormatTest.kt index f5b833f6..b90ab2bf 100644 --- a/core/src/test/kotlin/format/GFMFormatTest.kt +++ b/core/src/test/kotlin/format/GFMFormatTest.kt @@ -2,16 +2,10 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.GFMFormatService import org.jetbrains.dokka.KotlinLanguageService -import org.junit.Before import org.junit.Test -class GFMFormatTest { - private val gfmService = GFMFormatService(TestFileGenerator, KotlinLanguageService(), listOf()) - - @Before - fun prepareFileGenerator() { - TestFileGenerator.formatService = gfmService - } +class GFMFormatTest : FileGeneratorTestCase() { + override val formatService = GFMFormatService(fileGenerator, KotlinLanguageService(), listOf()) @Test fun sample() { @@ -25,7 +19,7 @@ class GFMFormatTest { private fun verifyGFMNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/gfm/$fileName.kt", ".md") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( model.members.single().members.filter { it.name == name }, output ) diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt index 4906fbfa..54c367fd 100644 --- a/core/src/test/kotlin/format/HtmlFormatTest.kt +++ b/core/src/test/kotlin/format/HtmlFormatTest.kt @@ -7,13 +7,8 @@ import org.junit.Before import org.junit.Test import java.io.File -class HtmlFormatTest { - private val htmlService = HtmlFormatService(TestFileGenerator, KotlinLanguageService(), HtmlTemplateService.default(), listOf()) - - @Before - fun prepareFileGenerator() { - TestFileGenerator.formatService = htmlService - } +class HtmlFormatTest: FileGeneratorTestCase() { + override val formatService = HtmlFormatService(fileGenerator, KotlinLanguageService(), HtmlTemplateService.default(), listOf()) @Test fun classWithCompanionObject() { verifyHtmlNode("classWithCompanionObject") @@ -37,10 +32,10 @@ class HtmlFormatTest { @Test fun deprecated() { verifyOutput("testdata/format/deprecated.kt", ".package.html") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members, output) + buildPagesAndReadInto(model.members, output) } verifyOutput("testdata/format/deprecated.kt", ".class.html") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) + buildPagesAndReadInto(model.members.single().members, output) } } @@ -108,7 +103,7 @@ class HtmlFormatTest { verifyOutput(arrayOf(KotlinSourceRoot("testdata/format/crossLanguage/kotlinExtendsJava/Bar.kt"), JavaSourceRoot(File("testdata/format/crossLanguage/kotlinExtendsJava"), null)), ".html") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( model.members.single().members.filter { it.name == "Bar" }, output ) @@ -167,7 +162,7 @@ class HtmlFormatTest { withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List) { verifyOutput("testdata/format/$fileName.kt", ".html", withKotlinRuntime = withKotlinRuntime) { model, output -> - TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) + buildPagesAndReadInto(nodeFilter(model), output) } } @@ -179,7 +174,7 @@ class HtmlFormatTest { withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List) { verifyJavaOutput("testdata/format/$fileName.java", ".html", withKotlinRuntime = withKotlinRuntime) { model, output -> - TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) + buildPagesAndReadInto(nodeFilter(model), output) } } } diff --git a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt index b3ea82b7..b971b54d 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt @@ -6,14 +6,8 @@ import org.junit.Ignore import org.junit.Test @Ignore -class KotlinWebSiteFormatTest { - private val kwsService = KotlinWebsiteFormatService(TestFileGenerator, KotlinLanguageService(), listOf(), DokkaConsoleLogger) - - @Before - fun prepareFileGenerator() { - TestFileGenerator.formatService = kwsService - } - +class KotlinWebSiteFormatTest: FileGeneratorTestCase() { + override val formatService = KotlinWebsiteFormatService(fileGenerator, KotlinLanguageService(), listOf(), DokkaConsoleLogger) @Test fun sample() { verifyKWSNodeByName("sample", "foo") @@ -36,7 +30,7 @@ class KotlinWebSiteFormatTest { val path = "dataTagsInGroupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".md", "testdata/format/website/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), output ) @@ -46,7 +40,7 @@ class KotlinWebSiteFormatTest { private fun verifyKWSNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/website/$fileName.kt", ".md", format = "kotlin-website") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( model.members.single().members.filter { it.name == name }, output ) @@ -71,7 +65,7 @@ class KotlinWebSiteFormatTest { private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { verifyModelOutput(module, ".package.md", "testdata/format/website/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members, output) + buildPagesAndReadInto(model.members, output) } } diff --git a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt index 8c94fdcb..49fa6d2f 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt @@ -4,13 +4,8 @@ import org.jetbrains.dokka.* import org.junit.Before import org.junit.Test -class KotlinWebSiteHtmlFormatTest { - private val kwsService = KotlinWebsiteHtmlFormatService(TestFileGenerator, KotlinLanguageService(), listOf(), EmptyHtmlTemplateService) - - @Before - fun prepareFileGenerator() { - TestFileGenerator.formatService = kwsService - } +class KotlinWebSiteHtmlFormatTest: FileGeneratorTestCase() { + override val formatService = KotlinWebsiteHtmlFormatService(fileGenerator, KotlinLanguageService(), listOf(), EmptyHtmlTemplateService) @Test fun dropImport() { verifyKWSNodeByName("dropImport", "foo") @@ -49,7 +44,7 @@ class KotlinWebSiteHtmlFormatTest { val path = "dataTagsInGroupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".html", "testdata/format/website-html/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), output ) @@ -59,7 +54,7 @@ class KotlinWebSiteHtmlFormatTest { private fun verifyKWSNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/website-html/$fileName.kt", ".html", format = "kotlin-website-html") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members.single().members.filter { it.name == name }, output) + buildPagesAndReadInto(model.members.single().members.filter { it.name == name }, output) } } @@ -81,7 +76,7 @@ class KotlinWebSiteHtmlFormatTest { private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { verifyModelOutput(module, ".package.html", "testdata/format/website-html/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members, output) + buildPagesAndReadInto(model.members, output) } } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index e273f6c1..b0e2a985 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -4,13 +4,8 @@ import org.jetbrains.dokka.* import org.junit.Before import org.junit.Test -class MarkdownFormatTest { - private val markdownService = MarkdownFormatService(TestFileGenerator, KotlinLanguageService(), listOf()) - - @Before - fun prepareFileGenerator() { - TestFileGenerator.formatService = markdownService - } +class MarkdownFormatTest: FileGeneratorTestCase() { + override val formatService = MarkdownFormatService(fileGenerator, KotlinLanguageService(), listOf()) @Test fun emptyDescription() { verifyMarkdownNode("emptyDescription") @@ -40,20 +35,20 @@ class MarkdownFormatTest { @Test fun extensions() { verifyOutput("testdata/format/extensions.kt", ".package.md") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members, output) + buildPagesAndReadInto(model.members, output) } verifyOutput("testdata/format/extensions.kt", ".class.md") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) + buildPagesAndReadInto(model.members.single().members, output) } } @Test fun enumClass() { verifyOutput("testdata/format/enumClass.kt", ".md") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) + buildPagesAndReadInto(model.members.single().members, output) } verifyOutput("testdata/format/enumClass.kt", ".value.md") { model, output -> val enumClassNode = model.members.single().members[0] - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( enumClassNode.members.filter { it.name == "LOCAL_CONTINUE_AND_BREAK" }, output ) @@ -290,14 +285,14 @@ class MarkdownFormatTest { @Test fun multiplePlatformsMergeMembers() { val module = buildMultiplePlatforms("multiplatform/mergeMembers") verifyModelOutput(module, ".md", "testdata/format/multiplatform/mergeMembers/foo.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) + buildPagesAndReadInto(model.members.single().members, output) } } @Test fun multiplePlatformsOmitRedundant() { val module = buildMultiplePlatforms("multiplatform/omitRedundant") verifyModelOutput(module, ".md", "testdata/format/multiplatform/omitRedundant/foo.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members.single().members, output) + buildPagesAndReadInto(model.members.single().members, output) } } @@ -336,7 +331,7 @@ class MarkdownFormatTest { val path = "multiplatform/groupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".md", "testdata/format/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }), output ) @@ -348,7 +343,7 @@ class MarkdownFormatTest { val path = "multiplatform/breadcrumbsInMemberOfMemberOfGroupNode" val module = buildMultiplePlatforms(path) verifyModelOutput(module, ".md", "testdata/format/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto( + buildPagesAndReadInto( listOfNotNull(model.members.single().members.find { it.kind == NodeKind.GroupNode }?.member(NodeKind.Class)?.member(NodeKind.Function)), output ) @@ -440,7 +435,7 @@ class MarkdownFormatTest { private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { verifyModelOutput(module, ".package.md", "testdata/format/$path/multiplatform.kt") { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members, output) + buildPagesAndReadInto(model.members, output) } } @@ -458,7 +453,7 @@ class MarkdownFormatTest { private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) { verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output -> - TestFileGenerator.buildPagesAndReadInto(model.members, output) + buildPagesAndReadInto(model.members, output) } } @@ -478,7 +473,7 @@ class MarkdownFormatTest { withKotlinRuntime = withKotlinRuntime, includeNonPublic = includeNonPublic ) { model, output -> - TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) + buildPagesAndReadInto(nodeFilter(model), output) } } @@ -488,7 +483,7 @@ class MarkdownFormatTest { private fun verifyJavaMarkdownNodes(fileName: String, withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List) { verifyJavaOutput("testdata/format/$fileName.java", ".md", withKotlinRuntime = withKotlinRuntime) { model, output -> - TestFileGenerator.buildPagesAndReadInto(nodeFilter(model), output) + buildPagesAndReadInto(nodeFilter(model), output) } } diff --git a/core/src/test/kotlin/format/PackageDocsTest.kt b/core/src/test/kotlin/format/PackageDocsTest.kt index 067ff775..704f7b99 100644 --- a/core/src/test/kotlin/format/PackageDocsTest.kt +++ b/core/src/test/kotlin/format/PackageDocsTest.kt @@ -5,7 +5,6 @@ import com.nhaarman.mockito_kotlin.doAnswer import com.nhaarman.mockito_kotlin.eq import com.nhaarman.mockito_kotlin.mock import org.jetbrains.dokka.* -import org.jetbrains.dokka.tests.TestFileGenerator import org.jetbrains.dokka.tests.assertEqualsIgnoringSeparators import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.junit.Assert.assertEquals @@ -37,11 +36,13 @@ class PackageDocsTest { fun checkMarkdownOutput(docs: PackageDocs, expectedFilePrefix: String) { + val generator = FileGenerator(File("")) + val out = StringBuilder() val outputBuilder = MarkdownOutputBuilder( out, - FileLocation(TestFileGenerator.root), - TestFileGenerator, + FileLocation(generator.root), + generator, KotlinLanguageService(), ".md", emptyList() -- cgit From 14ba5834fa3fff98672166dd24c05bd7aa13dc2a Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 15:42:20 +0300 Subject: Fix overriding of default analysis services --- core/src/main/kotlin/Formats/AnalysisComponents.kt | 10 +++++----- core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt | 2 +- core/src/main/kotlin/Formats/StandardFormats.kt | 18 ++++++++++++------ core/src/main/kotlin/javadoc/dokka-adapters.kt | 9 +++++---- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/core/src/main/kotlin/Formats/AnalysisComponents.kt b/core/src/main/kotlin/Formats/AnalysisComponents.kt index 97e1311e..c4d97dbb 100644 --- a/core/src/main/kotlin/Formats/AnalysisComponents.kt +++ b/core/src/main/kotlin/Formats/AnalysisComponents.kt @@ -12,14 +12,14 @@ import org.jetbrains.dokka.Utilities.toType import kotlin.reflect.KClass -interface FormatDescriptorAnalysisComponentProvider : FormatDescriptorAnalysisComponent { - +interface DefaultAnalysisComponentServices { val packageDocumentationBuilderClass: KClass val javaDocumentationBuilderClass: KClass val sampleProcessingService: KClass val descriptorSignatureProvider: KClass +} - +interface DefaultAnalysisComponent : FormatDescriptorAnalysisComponent, DefaultAnalysisComponentServices { override fun configureAnalysis(binder: Binder): Unit = with(binder) { bind() toType descriptorSignatureProvider bind() toType packageDocumentationBuilderClass @@ -29,7 +29,7 @@ interface FormatDescriptorAnalysisComponentProvider : FormatDescriptorAnalysisCo } -object KotlinAsJava: FormatDescriptorAnalysisComponentProvider { +object KotlinAsJava : DefaultAnalysisComponentServices { override val packageDocumentationBuilderClass = KotlinAsJavaDocumentationBuilder::class override val javaDocumentationBuilderClass = JavaPsiDocumentationBuilder::class override val sampleProcessingService = DefaultSampleProcessingService::class @@ -37,7 +37,7 @@ object KotlinAsJava: FormatDescriptorAnalysisComponentProvider { } -object KotlinAsKotlin: FormatDescriptorAnalysisComponentProvider { +object KotlinAsKotlin : DefaultAnalysisComponentServices { override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class override val sampleProcessingService = DefaultSampleProcessingService::class diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt index 9fb72e37..f73cd23e 100644 --- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt +++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt @@ -13,7 +13,7 @@ import org.jetbrains.dokka.Utilities.toType import java.io.File -class JavaLayoutHtmlFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider { +class JavaLayoutHtmlFormatDescriptor : FormatDescriptor, DefaultAnalysisComponent { override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class override val sampleProcessingService = DefaultSampleProcessingService::class diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt index 9de667ab..71af1991 100644 --- a/core/src/main/kotlin/Formats/StandardFormats.kt +++ b/core/src/main/kotlin/Formats/StandardFormats.kt @@ -1,19 +1,21 @@ package org.jetbrains.dokka.Formats import com.google.inject.Binder -import com.google.inject.Provider import org.jetbrains.dokka.* import org.jetbrains.dokka.Samples.KotlinWebsiteSampleProcessingService import org.jetbrains.dokka.Utilities.bind import kotlin.reflect.KClass -abstract class KotlinFormatDescriptorBase : FileGeneratorBasedFormatDescriptor(), FormatDescriptorAnalysisComponentProvider by KotlinAsKotlin { +abstract class KotlinFormatDescriptorBase + : FileGeneratorBasedFormatDescriptor(), + DefaultAnalysisComponent, + DefaultAnalysisComponentServices by KotlinAsKotlin { override val generatorServiceClass = FileGenerator::class override val outlineServiceClass: KClass? = null override val packageListServiceClass: KClass? = DefaultPackageListService::class } -abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() { +abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor(), DefaultAnalysisComponent { override val formatServiceClass = HtmlFormatService::class override val outlineServiceClass = HtmlFormatService::class override val generatorServiceClass = FileGenerator::class @@ -21,13 +23,13 @@ abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() { override fun configureOutput(binder: Binder): Unit = with(binder) { super.configureOutput(binder) - bind().toProvider(Provider { HtmlTemplateService.default("style.css") }) + bind().toProvider { HtmlTemplateService.default("style.css") } } } -class HtmlFormatDescriptor : HtmlFormatDescriptorBase(), FormatDescriptorAnalysisComponent by KotlinAsKotlin +class HtmlFormatDescriptor : HtmlFormatDescriptorBase(), DefaultAnalysisComponentServices by KotlinAsKotlin -class HtmlAsJavaFormatDescriptor : HtmlFormatDescriptorBase(), FormatDescriptorAnalysisComponent by KotlinAsJava +class HtmlAsJavaFormatDescriptor : HtmlFormatDescriptorBase(), DefaultAnalysisComponentServices by KotlinAsJava class KotlinWebsiteFormatDescriptor : KotlinFormatDescriptorBase() { override val formatServiceClass = KotlinWebsiteFormatService::class @@ -45,6 +47,10 @@ class KotlinWebsiteHtmlFormatDescriptor : KotlinFormatDescriptorBase() { override val sampleProcessingService = KotlinWebsiteSampleProcessingService::class override val outlineServiceClass = YamlOutlineService::class + override fun configureAnalysis(binder: Binder) { + super.configureAnalysis(binder) + } + override fun configureOutput(binder: Binder) = with(binder) { super.configureOutput(binder) bind().toInstance(EmptyHtmlTemplateService) diff --git a/core/src/main/kotlin/javadoc/dokka-adapters.kt b/core/src/main/kotlin/javadoc/dokka-adapters.kt index bed211f6..4676db18 100644 --- a/core/src/main/kotlin/javadoc/dokka-adapters.kt +++ b/core/src/main/kotlin/javadoc/dokka-adapters.kt @@ -4,9 +4,7 @@ import com.google.inject.Binder import com.google.inject.Inject import com.sun.tools.doclets.formats.html.HtmlDoclet import org.jetbrains.dokka.* -import org.jetbrains.dokka.Formats.FormatDescriptor -import org.jetbrains.dokka.Formats.FormatDescriptorAnalysisComponent -import org.jetbrains.dokka.Formats.KotlinAsJava +import org.jetbrains.dokka.Formats.* import org.jetbrains.dokka.Utilities.bind import org.jetbrains.dokka.Utilities.toType @@ -31,7 +29,10 @@ class JavadocGenerator @Inject constructor(val options: DocumentationOptions, va } } -class JavadocFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponent by KotlinAsJava { +class JavadocFormatDescriptor : + FormatDescriptor, + DefaultAnalysisComponent, + DefaultAnalysisComponentServices by KotlinAsJava { override fun configureOutput(binder: Binder): Unit = with(binder) { bind() toType JavadocGenerator::class -- cgit From 7aa5b52a7e8cd69a384ef29aeeb199061b92584f Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 16:01:39 +0300 Subject: Check file path in testData, when more then one node --- core/src/test/kotlin/format/FileGeneratorTestCase.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/test/kotlin/format/FileGeneratorTestCase.kt b/core/src/test/kotlin/format/FileGeneratorTestCase.kt index 7f6d6f3f..6d70292f 100644 --- a/core/src/test/kotlin/format/FileGeneratorTestCase.kt +++ b/core/src/test/kotlin/format/FileGeneratorTestCase.kt @@ -3,6 +3,7 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.DocumentationNode import org.jetbrains.dokka.FileGenerator import org.jetbrains.dokka.FormatService +import org.jetbrains.dokka.relativeToRoot import org.junit.Before import org.junit.Rule import org.junit.rules.TemporaryFolder @@ -23,9 +24,12 @@ abstract class FileGeneratorTestCase { fun buildPagesAndReadInto(nodes: List, sb: StringBuilder) = with(fileGenerator) { buildPages(nodes) - nodes.forEach { - val fileForNode = location(it).file - sb.append(fileForNode.readText()) + val byLocations = nodes.groupBy { location(it) } + byLocations.forEach { (loc, _) -> + if (byLocations.size > 1) { + sb.appendln("") + } + sb.append(loc.file.readText()) } } } \ No newline at end of file -- cgit From b209ddcfc2d532f4dc5e508e00d89335fdb15caa Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 18:16:04 +0300 Subject: Append line before file path in testData --- core/src/test/kotlin/format/FileGeneratorTestCase.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/test/kotlin/format/FileGeneratorTestCase.kt b/core/src/test/kotlin/format/FileGeneratorTestCase.kt index 6d70292f..644d5baa 100644 --- a/core/src/test/kotlin/format/FileGeneratorTestCase.kt +++ b/core/src/test/kotlin/format/FileGeneratorTestCase.kt @@ -27,6 +27,9 @@ abstract class FileGeneratorTestCase { val byLocations = nodes.groupBy { location(it) } byLocations.forEach { (loc, _) -> if (byLocations.size > 1) { + if (sb.isNotBlank() && !sb.endsWith('\n')) { + sb.appendln() + } sb.appendln("") } sb.append(loc.file.readText()) -- cgit From 1bd0f642248e09cfa95fa19bf5a38316606401a2 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 18:16:40 +0300 Subject: Uncomment and fix some special case tests --- core/src/test/kotlin/format/MarkdownFormatTest.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index b0e2a985..f60969fc 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -299,8 +299,9 @@ class MarkdownFormatTest: FileGeneratorTestCase() { @Test fun multiplePlatformsImplied() { val module = buildMultiplePlatforms("multiplatform/implied") verifyModelOutput(module, ".md", "testdata/format/multiplatform/implied/foo.kt") { model, output -> -// MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf("JVM", "JS")) -// .createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members) + val service = MarkdownFormatService(fileGenerator, KotlinLanguageService(), listOf("JVM", "JS")) + fileGenerator.formatService = service + buildPagesAndReadInto(model.members.single().members, output) } } @@ -442,8 +443,9 @@ class MarkdownFormatTest: FileGeneratorTestCase() { private fun verifyMultiplatformIndex(module: DocumentationModule, path: String) { verifyModelOutput(module, ".md", "testdata/format/$path/multiplatform.index.kt") { model, output -> -// MarkdownFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) -// .createOutputBuilder(output, tempLocation).appendNodes(listOf(model)) + val service = MarkdownFormatService(fileGenerator, KotlinLanguageService(), listOf()) + fileGenerator.formatService = service + buildPagesAndReadInto(listOf(model), output) } } -- cgit From 3683c18f3ca302d7afb8f5076290c6bd44f91ce5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 18:17:23 +0300 Subject: Fix PackageListService to use NodeLocationAwareGenerator for links --- core/src/main/kotlin/Formats/PackageListService.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/Formats/PackageListService.kt b/core/src/main/kotlin/Formats/PackageListService.kt index be50fac4..7b68098e 100644 --- a/core/src/main/kotlin/Formats/PackageListService.kt +++ b/core/src/main/kotlin/Formats/PackageListService.kt @@ -8,8 +8,9 @@ interface PackageListService { } class DefaultPackageListService @Inject constructor( - val generator: FileGenerator, - val formatService: FormatService) : PackageListService { + val generator: NodeLocationAwareGenerator, + val formatService: FormatService +) : PackageListService { override fun formatPackageList(module: DocumentationModule): String { val packages = mutableSetOf() -- cgit From 955a4f706c54a271473424c817daaeb02bea5cc5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 18:17:52 +0300 Subject: Update testData --- core/testdata/format/JavaSupertype.html | 10 +-- core/testdata/format/accessor.md | 2 +- core/testdata/format/annotatedTypeParameter.md | 4 +- core/testdata/format/annotationClass.md | 4 +- core/testdata/format/annotationClass.package.md | 4 +- core/testdata/format/annotationParams.md | 2 +- core/testdata/format/annotations.md | 8 +- core/testdata/format/arrayAverage.md | 6 +- core/testdata/format/backtickInCodeBlock.md | 2 +- core/testdata/format/blankLineInsideCodeBlock.html | 2 +- core/testdata/format/blankLineInsideCodeBlock.md | 2 +- core/testdata/format/bracket.html | 2 +- core/testdata/format/brokenLink.html | 2 +- core/testdata/format/classWithCompanionObject.html | 8 +- core/testdata/format/classWithCompanionObject.md | 8 +- core/testdata/format/codeBlock.html | 44 ++++++++++- core/testdata/format/codeBlock.md | 14 +++- core/testdata/format/codeBlockNoHtmlEscape.md | 2 +- core/testdata/format/codeSpan.html | 2 +- core/testdata/format/companionImplements.md | 8 +- core/testdata/format/companionObjectExtension.md | 6 +- .../crossLanguage/kotlinExtendsJava/Bar.html | 12 +-- core/testdata/format/deprecated.class.html | 38 ++++++++- core/testdata/format/deprecated.package.html | 8 +- core/testdata/format/dynamicExtension.md | 4 +- core/testdata/format/dynamicType.md | 2 +- core/testdata/format/emptyDescription.md | 2 +- core/testdata/format/entity.html | 4 +- core/testdata/format/enumClass.md | 6 +- core/testdata/format/enumClass.value.md | 2 +- core/testdata/format/exceptionClass.md | 4 +- core/testdata/format/exceptionClass.package.md | 4 +- core/testdata/format/exclInCodeBlock.md | 2 +- core/testdata/format/extensionFunctionParameter.md | 4 +- core/testdata/format/extensionScope.md | 4 +- .../format/extensionWithDocumentedReceiver.md | 2 +- core/testdata/format/extensions.class.md | 6 +- core/testdata/format/extensions.package.md | 4 +- core/testdata/format/externalReferenceLink.md | 2 +- .../format/functionWithDefaultParameter.md | 2 +- .../format/functionalTypeWithNamedParameters.html | 90 ++++++++++++++++++++-- .../format/functionalTypeWithNamedParameters.md | 36 +++++++-- core/testdata/format/genericInheritedExtensions.md | 10 +-- core/testdata/format/gfm/listInTableCell.md | 6 +- core/testdata/format/gfm/sample.md | 8 +- core/testdata/format/htmlEscaping.html | 4 +- .../format/inapplicableExtensionFunctions.md | 8 +- core/testdata/format/indentedCodeBlock.html | 2 +- core/testdata/format/indentedCodeBlock.md | 2 +- .../format/inheritedCompanionObjectProperties.md | 16 ++-- core/testdata/format/inheritedExtensions.md | 10 +-- core/testdata/format/inheritedMembers.md | 14 ++-- core/testdata/format/javaCodeInParam.md | 4 +- core/testdata/format/javaCodeLiteralTags.md | 4 +- core/testdata/format/javaDeprecated.html | 4 +- core/testdata/format/javaLinkTag.html | 10 +-- core/testdata/format/javaLinkTagWithLabel.html | 10 +-- core/testdata/format/javaSeeTag.html | 8 +- core/testdata/format/javaSpaceInAuthor.md | 4 +- core/testdata/format/javadocHtml.md | 4 +- core/testdata/format/javadocOrderedList.md | 4 +- core/testdata/format/jdkLinks.md | 4 +- core/testdata/format/linkWithLabel.html | 10 +-- core/testdata/format/linkWithStarProjection.html | 4 +- core/testdata/format/linksInEmphasis.md | 14 ++-- core/testdata/format/linksInHeaders.md | 28 +++---- core/testdata/format/linksInStrong.md | 14 ++-- core/testdata/format/markdownInLinks.html | 2 +- core/testdata/format/memberExtension.md | 6 +- .../multiplatform.md | 2 +- .../multiplatform/groupNode/multiplatform.md | 6 +- .../groupNode/multiplatform.package.md | 8 +- core/testdata/format/multiplatform/implied/foo.md | 16 ++-- .../multiplatform/merge/multiplatform.package.md | 4 +- .../format/multiplatform/mergeMembers/foo.md | 16 ++-- .../format/multiplatform/omitRedundant/foo.md | 8 +- .../multiplatform.index.md | 4 +- .../multiplatform.package.md | 4 +- .../multiplatform.index.md | 4 +- .../multiplatform.package.md | 4 +- .../multiplatform/simple/multiplatform.package.md | 6 +- .../format/multipleTypeParameterConstraints.md | 13 +++- core/testdata/format/nestedLists.md | 30 ++++---- core/testdata/format/newlineInTableCell.package.md | 4 +- .../format/notPublishedTypeAliasAutoExpansion.md | 6 +- core/testdata/format/nullability.md | 6 +- core/testdata/format/operatorOverloading.md | 4 +- core/testdata/format/orderedList.html | 4 +- core/testdata/format/overloads.html | 4 +- core/testdata/format/overloadsWithDescription.html | 4 +- .../format/overloadsWithDifferentDescriptions.html | 2 +- core/testdata/format/overridingFunction.md | 4 +- core/testdata/format/paramTag.md | 2 +- core/testdata/format/parameterAnchor.html | 6 +- core/testdata/format/parenthesis.html | 2 +- core/testdata/format/propertyVar.md | 2 +- core/testdata/format/qualifiedNameLink.md | 2 +- core/testdata/format/receiverParameterTypeBound.md | 6 +- core/testdata/format/receiverReference.md | 4 +- core/testdata/format/referenceLink.md | 10 ++- core/testdata/format/reifiedTypeParameter.md | 2 +- ...rFunctionalTypeInParenthesisWhenItIsReceiver.md | 4 +- core/testdata/format/returnWithLink.html | 4 +- core/testdata/format/sampleByFQName.md | 7 +- core/testdata/format/sampleByShortName.md | 7 +- core/testdata/format/see.html | 31 ++++++-- core/testdata/format/shadowedExtensionFunctions.md | 10 +-- core/testdata/format/sinceKotlin.html | 4 +- core/testdata/format/sinceKotlin.md | 4 +- core/testdata/format/sinceKotlin.package.md | 4 +- core/testdata/format/sinceKotlinWide.package.md | 6 +- core/testdata/format/starProjection.md | 4 +- core/testdata/format/summarizeSignatures.md | 10 +-- .../testdata/format/summarizeSignaturesProperty.md | 10 +-- core/testdata/format/suspendParam.md | 2 +- core/testdata/format/suspendParam.package.md | 4 +- core/testdata/format/throwsTag.md | 2 +- core/testdata/format/tokensInEmphasis.md | 10 +-- core/testdata/format/tokensInHeaders.md | 26 +++---- core/testdata/format/tokensInStrong.md | 12 +-- core/testdata/format/tripleBackticks.html | 2 +- core/testdata/format/typeAliases.md | 73 ++++++++++++++---- core/testdata/format/typeAliases.package.md | 30 ++++---- core/testdata/format/typeLink.html | 6 +- core/testdata/format/typeParameterBounds.md | 4 +- core/testdata/format/typeParameterReference.md | 6 +- core/testdata/format/typeParameterVariance.md | 4 +- core/testdata/format/typeProjectionVariance.md | 4 +- .../format/uninterpretedEmphasisCharacters.html | 2 +- core/testdata/format/unorderedLists.md | 24 +++--- core/testdata/format/varargsFunction.md | 2 +- .../dataTags/multiplatform.package.html | 18 ++--- .../dataTagsInGroupNode/multiplatform.html | 6 +- .../dataTagsInGroupNode/multiplatform.package.html | 8 +- core/testdata/format/website-html/dropImport.html | 2 +- .../format/website-html/newLinesInImportList.html | 2 +- .../format/website-html/newLinesInSamples.html | 2 +- .../format/website-html/overloadGroup.html | 2 +- core/testdata/format/website-html/returnTag.html | 8 +- core/testdata/format/website-html/sample.html | 2 +- .../format/website-html/sampleWithAsserts.html | 2 +- 141 files changed, 711 insertions(+), 452 deletions(-) diff --git a/core/testdata/format/JavaSupertype.html b/core/testdata/format/JavaSupertype.html index 3e5e273a..27b8e5d0 100644 --- a/core/testdata/format/JavaSupertype.html +++ b/core/testdata/format/JavaSupertype.html @@ -4,16 +4,16 @@ JavaSupertype.Bar - test -test / JavaSupertype / Bar
+test / JavaSupertype / Bar

Bar

-open class Bar : Foo +open class Bar : Foo

Constructors

@@ -25,10 +25,10 @@ +open fun returnFoo(foo: Foo): Foo
-

<init>

+

<init>

Bar()
-

returnFoo

+

returnFoo

-open fun returnFoo(foo: Foo): Foo
diff --git a/core/testdata/format/accessor.md b/core/testdata/format/accessor.md index dcdef0f8..190e8538 100644 --- a/core/testdata/format/accessor.md +++ b/core/testdata/format/accessor.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) / [x](test/-c/x) +[test](../index.md) / [C](index.md) / [x](./x.md) # x diff --git a/core/testdata/format/annotatedTypeParameter.md b/core/testdata/format/annotatedTypeParameter.md index aa8b8592..aa622eac 100644 --- a/core/testdata/format/annotatedTypeParameter.md +++ b/core/testdata/format/annotatedTypeParameter.md @@ -1,5 +1,5 @@ -[test](test/index) / [containsAll](test/contains-all) +[test](index.md) / [containsAll](./contains-all.md) # containsAll -`fun containsAll(elements: Collection<@UnsafeVariance `[`E`](test/contains-all#E)`>): @UnsafeVariance `[`E`](test/contains-all#E) \ No newline at end of file +`fun containsAll(elements: Collection<@UnsafeVariance `[`E`](contains-all.md#E)`>): @UnsafeVariance `[`E`](contains-all.md#E) \ No newline at end of file diff --git a/core/testdata/format/annotationClass.md b/core/testdata/format/annotationClass.md index 2f4da736..55fda40c 100644 --- a/core/testdata/format/annotationClass.md +++ b/core/testdata/format/annotationClass.md @@ -1,4 +1,4 @@ -[test](test/index) / [fancy](test/fancy/index) +[test](../index.md) / [fancy](./index.md) # fancy @@ -6,5 +6,5 @@ ### Constructors -| [<init>](test/fancy/-init-) | `fancy()` | +| [<init>](-init-.md) | `fancy()` | diff --git a/core/testdata/format/annotationClass.package.md b/core/testdata/format/annotationClass.package.md index f52b28b6..c8aff7a3 100644 --- a/core/testdata/format/annotationClass.package.md +++ b/core/testdata/format/annotationClass.package.md @@ -1,8 +1,8 @@ -[test](test/index) +[test](./index.md) ## Package <root> ### Annotations -| [fancy](test/fancy/index) | `annotation class fancy` | +| [fancy](fancy/index.md) | `annotation class fancy` | diff --git a/core/testdata/format/annotationParams.md b/core/testdata/format/annotationParams.md index 132078ce..cfa3b822 100644 --- a/core/testdata/format/annotationParams.md +++ b/core/testdata/format/annotationParams.md @@ -1,4 +1,4 @@ -[test](test/index) / [f](test/f) +[test](index.md) / [f](./f.md) # f diff --git a/core/testdata/format/annotations.md b/core/testdata/format/annotations.md index cc27d5af..2e1604d0 100644 --- a/core/testdata/format/annotations.md +++ b/core/testdata/format/annotations.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -6,13 +6,13 @@ ### Constructors -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | ### Properties -| [x](test/-foo/x) | `val x: Int` | +| [x](x.md) | `val x: Int` | ### Functions -| [bar](test/-foo/bar) | `fun bar(notInlined: () -> Unit): Unit` | +| [bar](bar.md) | `fun bar(notInlined: () -> Unit): Unit` | diff --git a/core/testdata/format/arrayAverage.md b/core/testdata/format/arrayAverage.md index 7cc31c47..2c6927d6 100644 --- a/core/testdata/format/arrayAverage.md +++ b/core/testdata/format/arrayAverage.md @@ -1,4 +1,4 @@ -[test](test/index) / [XArray](test/-x-array/index) +[test](../index.md) / [XArray](./index.md) # XArray @@ -6,9 +6,9 @@ ### Constructors -| [<init>](test/-x-array/-init-) | `XArray()` | +| [<init>](-init-.md) | `XArray()` | ### Extension Functions -| [average](test/average) | `fun `[`XArray`](test/-x-array/index)`.average(): Double`
`fun `[`XArray`](test/-x-array/index)`.average(): Double`
`fun `[`XArray`](test/-x-array/index)`.average(): Double`
`fun `[`XArray`](test/-x-array/index)`.average(): Double`
`fun `[`XArray`](test/-x-array/index)`.average(): Double`
`fun `[`XArray`](test/-x-array/index)`.average(): Double` | +| [average](../average.md) | `fun `[`XArray`](./index.md)`.average(): Double`
`fun `[`XArray`](./index.md)`.average(): Double`
`fun `[`XArray`](./index.md)`.average(): Double`
`fun `[`XArray`](./index.md)`.average(): Double`
`fun `[`XArray`](./index.md)`.average(): Double`
`fun `[`XArray`](./index.md)`.average(): Double` | diff --git a/core/testdata/format/backtickInCodeBlock.md b/core/testdata/format/backtickInCodeBlock.md index fc244630..830539ac 100644 --- a/core/testdata/format/backtickInCodeBlock.md +++ b/core/testdata/format/backtickInCodeBlock.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo) +[test](index.md) / [foo](./foo.md) # foo diff --git a/core/testdata/format/blankLineInsideCodeBlock.html b/core/testdata/format/blankLineInsideCodeBlock.html index 168dd0dd..f0351d72 100644 --- a/core/testdata/format/blankLineInsideCodeBlock.html +++ b/core/testdata/format/blankLineInsideCodeBlock.html @@ -4,7 +4,7 @@ u - test -test / u
+test / u

u

diff --git a/core/testdata/format/blankLineInsideCodeBlock.md b/core/testdata/format/blankLineInsideCodeBlock.md index 66f4d65f..956f8954 100644 --- a/core/testdata/format/blankLineInsideCodeBlock.md +++ b/core/testdata/format/blankLineInsideCodeBlock.md @@ -1,4 +1,4 @@ -[test](test/index) / [u](test/u) +[test](index.md) / [u](./u.md) # u diff --git a/core/testdata/format/bracket.html b/core/testdata/format/bracket.html index a76ff885..01aaaf04 100644 --- a/core/testdata/format/bracket.html +++ b/core/testdata/format/bracket.html @@ -4,7 +4,7 @@ foo - test -test / foo
+test / foo

foo

diff --git a/core/testdata/format/brokenLink.html b/core/testdata/format/brokenLink.html index d1b8ccb0..c598a73e 100644 --- a/core/testdata/format/brokenLink.html +++ b/core/testdata/format/brokenLink.html @@ -4,7 +4,7 @@ f - test -test / f
+test / f

f

diff --git a/core/testdata/format/classWithCompanionObject.html b/core/testdata/format/classWithCompanionObject.html index 2954d5a7..88feea5e 100644 --- a/core/testdata/format/classWithCompanionObject.html +++ b/core/testdata/format/classWithCompanionObject.html @@ -4,7 +4,7 @@ Klass - test -test / Klass
+test / Klass

Klass

class Klass @@ -13,7 +13,7 @@ -

<init>

+

<init>

Klass() @@ -25,7 +25,7 @@ -

x

+

x

val x: Int @@ -37,7 +37,7 @@ -

foo

+

foo

fun foo(): Unit diff --git a/core/testdata/format/classWithCompanionObject.md b/core/testdata/format/classWithCompanionObject.md index 45684c0e..40f605be 100644 --- a/core/testdata/format/classWithCompanionObject.md +++ b/core/testdata/format/classWithCompanionObject.md @@ -1,4 +1,4 @@ -[test](test/index) / [Klass](test/-klass/index) +[test](../index.md) / [Klass](./index.md) # Klass @@ -6,13 +6,13 @@ ### Constructors -| [<init>](test/-klass/-init-) | `Klass()` | +| [<init>](-init-.md) | `Klass()` | ### Companion Object Properties -| [x](test/-klass/x) | `val x: Int` | +| [x](x.md) | `val x: Int` | ### Companion Object Functions -| [foo](test/-klass/foo) | `fun foo(): Unit` | +| [foo](foo.md) | `fun foo(): Unit` | diff --git a/core/testdata/format/codeBlock.html b/core/testdata/format/codeBlock.html index 48c2ffd2..1e07ff09 100644 --- a/core/testdata/format/codeBlock.html +++ b/core/testdata/format/codeBlock.html @@ -1,9 +1,11 @@ + +Throws - test -test / Throws
+test / Throws

Throws

class Throws @@ -11,12 +13,50 @@

Example:

Throws(IOException::class)
 fun readFile(name: String): String {...}
-
test / ItDoesSomeObfuscatedThing
+ +

Constructors

+ + + + + + + +
+

<init>

+
+Throws() +

This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.

+
+ + + + + + +ItDoesSomeObfuscatedThing - test + + +test / ItDoesSomeObfuscatedThing

ItDoesSomeObfuscatedThing

class ItDoesSomeObfuscatedThing

Check output of

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
 
+

Constructors

+ + + + + + + +
+

<init>

+
+ItDoesSomeObfuscatedThing() +

Check output of

+
diff --git a/core/testdata/format/codeBlock.md b/core/testdata/format/codeBlock.md index d64fb9fd..d183a8ba 100644 --- a/core/testdata/format/codeBlock.md +++ b/core/testdata/format/codeBlock.md @@ -1,4 +1,5 @@ -[test](test/index) / [Throws](test/-throws/index) + +[test](../index.md) / [Throws](./index.md) # Throws @@ -13,7 +14,12 @@ Throws(IOException::class) fun readFile(name: String): String {...} ``` -[test](test/index) / [ItDoesSomeObfuscatedThing](test/-it-does-some-obfuscated-thing/index) +### Constructors + +| [<init>](-init-.md) | `Throws()`
This annotation indicates what exceptions should be declared by a function when compiled to a JVM method. | + + +[test](../index.md) / [ItDoesSomeObfuscatedThing](./index.md) # ItDoesSomeObfuscatedThing @@ -25,3 +31,7 @@ Check output of ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. ``` +### Constructors + +| [<init>](-init-.md) | `ItDoesSomeObfuscatedThing()`
Check output of | + diff --git a/core/testdata/format/codeBlockNoHtmlEscape.md b/core/testdata/format/codeBlockNoHtmlEscape.md index 2622ef38..548dac4f 100644 --- a/core/testdata/format/codeBlockNoHtmlEscape.md +++ b/core/testdata/format/codeBlockNoHtmlEscape.md @@ -1,4 +1,4 @@ -[test](test/index) / [hackTheArithmetic](test/hack-the-arithmetic) +[test](index.md) / [hackTheArithmetic](./hack-the-arithmetic.md) # hackTheArithmetic diff --git a/core/testdata/format/codeSpan.html b/core/testdata/format/codeSpan.html index 33cbdba3..bfe93f36 100644 --- a/core/testdata/format/codeSpan.html +++ b/core/testdata/format/codeSpan.html @@ -4,7 +4,7 @@ foo - test -test / foo
+test / foo

foo

diff --git a/core/testdata/format/companionImplements.md b/core/testdata/format/companionImplements.md index 8a93ed6b..aac7b3e6 100644 --- a/core/testdata/format/companionImplements.md +++ b/core/testdata/format/companionImplements.md @@ -1,16 +1,16 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo `class Foo` -Correct ref [Foo.Companion](test/-foo/-companion) +Correct ref [Foo.Companion](-companion.md) ### Types -| [Companion](test/-foo/-companion) | `companion object Companion : `[`Bar`](test/-bar) | +| [Companion](-companion.md) | `companion object Companion : `[`Bar`](../-bar.md) | ### Constructors -| [<init>](test/-foo/-init-) | `Foo()`
Correct ref [Foo.Companion](test/-foo/-companion) | +| [<init>](-init-.md) | `Foo()`
Correct ref [Foo.Companion](-companion.md) | diff --git a/core/testdata/format/companionObjectExtension.md b/core/testdata/format/companionObjectExtension.md index e019c184..c0e268e6 100644 --- a/core/testdata/format/companionObjectExtension.md +++ b/core/testdata/format/companionObjectExtension.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -6,9 +6,9 @@ ### Constructors -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | ### Companion Object Extension Properties -| [x](test/x) | `val Foo.Default.x: Int`
The default object property. | +| [x](../x.md) | `val Foo.Default.x: Int`
The default object property. | diff --git a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html index 42f21d3c..8842969e 100644 --- a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html +++ b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html @@ -4,21 +4,21 @@ Bar - test -test / test / Bar
+test / test / Bar

Bar

-class Bar : Foo -

See xyzzy

+class Bar : Foo +

See xyzzy

Constructors

@@ -28,7 +28,7 @@ diff --git a/core/testdata/format/deprecated.class.html b/core/testdata/format/deprecated.class.html index 66eb9ff1..540060d1 100644 --- a/core/testdata/format/deprecated.class.html +++ b/core/testdata/format/deprecated.class.html @@ -1,22 +1,54 @@ + +C - test -test / C
+test / C

C

class C
Deprecated: This class sucks

-test / f
+

Constructors

+
-

<init>

+

<init>

Bar() -

See xyzzy

+

See xyzzy

-

xyzzy

+

xyzzy

open fun xyzzy(): Unit
+ + + + + + +
+

<init>

+
+C()
+ + + + + + +f - test + + +test / f

f

fun f(): Unit
Deprecated: This function sucks

-test / p
+ + + + + + +p - test + + +test / p

p

diff --git a/core/testdata/format/deprecated.package.html b/core/testdata/format/deprecated.package.html index b85e53bd..3506de61 100644 --- a/core/testdata/format/deprecated.package.html +++ b/core/testdata/format/deprecated.package.html @@ -4,7 +4,7 @@ root package - test -test
+test

Package <root>

Types

@@ -12,7 +12,7 @@ -

C

+

C

class C @@ -24,7 +24,7 @@ -

p

+

p

val p: Int @@ -36,7 +36,7 @@ -

f

+

f

fun f(): Unit diff --git a/core/testdata/format/dynamicExtension.md b/core/testdata/format/dynamicExtension.md index 2fd928f6..382cf973 100644 --- a/core/testdata/format/dynamicExtension.md +++ b/core/testdata/format/dynamicExtension.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -6,5 +6,5 @@ ### Constructors -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | diff --git a/core/testdata/format/dynamicType.md b/core/testdata/format/dynamicType.md index a3d6696b..07a1d103 100644 --- a/core/testdata/format/dynamicType.md +++ b/core/testdata/format/dynamicType.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo) +[test](index.md) / [foo](./foo.md) # foo diff --git a/core/testdata/format/emptyDescription.md b/core/testdata/format/emptyDescription.md index 8c0fe109..5d56d968 100644 --- a/core/testdata/format/emptyDescription.md +++ b/core/testdata/format/emptyDescription.md @@ -1,4 +1,4 @@ -[test](test/index) / [fn](test/fn) +[test](index.md) / [fn](./fn.md) # fn diff --git a/core/testdata/format/entity.html b/core/testdata/format/entity.html index abe89502..639f2903 100644 --- a/core/testdata/format/entity.html +++ b/core/testdata/format/entity.html @@ -4,7 +4,7 @@ Bar - test -test / Bar
+test / Bar

Bar

class Bar @@ -14,7 +14,7 @@ -

<init>

+

<init>

Bar() diff --git a/core/testdata/format/enumClass.md b/core/testdata/format/enumClass.md index d3a6f186..50cccfbb 100644 --- a/core/testdata/format/enumClass.md +++ b/core/testdata/format/enumClass.md @@ -1,4 +1,4 @@ -[test](test/index) / [InlineOption](test/-inline-option/index) +[test](../index.md) / [InlineOption](./index.md) # InlineOption @@ -6,6 +6,6 @@ ### Enum Values -| [ONLY_LOCAL_RETURN](test/-inline-option/-o-n-l-y_-l-o-c-a-l_-r-e-t-u-r-n) | | -| [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) | | +| [ONLY_LOCAL_RETURN](-o-n-l-y_-l-o-c-a-l_-r-e-t-u-r-n.md) | | +| [LOCAL_CONTINUE_AND_BREAK](-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k.md) | | diff --git a/core/testdata/format/enumClass.value.md b/core/testdata/format/enumClass.value.md index feed2fe5..150016cc 100644 --- a/core/testdata/format/enumClass.value.md +++ b/core/testdata/format/enumClass.value.md @@ -1,4 +1,4 @@ -[test](test/index) / [InlineOption](test/-inline-option/index) / [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) +[test](../index.md) / [InlineOption](index.md) / [LOCAL_CONTINUE_AND_BREAK](./-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k.md) # LOCAL_CONTINUE_AND_BREAK diff --git a/core/testdata/format/exceptionClass.md b/core/testdata/format/exceptionClass.md index e3714ecc..1e928bb6 100644 --- a/core/testdata/format/exceptionClass.md +++ b/core/testdata/format/exceptionClass.md @@ -1,4 +1,4 @@ -[test](test/index) / [MyException](test/-my-exception/index) +[test](../index.md) / [MyException](./index.md) # MyException @@ -6,5 +6,5 @@ ### Constructors -| [<init>](test/-my-exception/-init-) | `MyException()` | +| [<init>](-init-.md) | `MyException()` | diff --git a/core/testdata/format/exceptionClass.package.md b/core/testdata/format/exceptionClass.package.md index e10478e4..8716df0a 100644 --- a/core/testdata/format/exceptionClass.package.md +++ b/core/testdata/format/exceptionClass.package.md @@ -1,8 +1,8 @@ -[test](test/index) +[test](./index.md) ## Package <root> ### Exceptions -| [MyException](test/-my-exception/index) | `class MyException : Exception` | +| [MyException](-my-exception/index.md) | `class MyException : Exception` | diff --git a/core/testdata/format/exclInCodeBlock.md b/core/testdata/format/exclInCodeBlock.md index 9c9e424a..d665c415 100644 --- a/core/testdata/format/exclInCodeBlock.md +++ b/core/testdata/format/exclInCodeBlock.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo) +[test](index.md) / [foo](./foo.md) # foo diff --git a/core/testdata/format/extensionFunctionParameter.md b/core/testdata/format/extensionFunctionParameter.md index 501d731d..e1e85824 100644 --- a/core/testdata/format/extensionFunctionParameter.md +++ b/core/testdata/format/extensionFunctionParameter.md @@ -1,5 +1,5 @@ -[test](test/index) / [apply](test/apply) +[test](index.md) / [apply](./apply.md) # apply -`inline fun `[`T`](test/apply#T)`.apply(f: `[`T`](test/apply#T)`.() -> Unit): `[`T`](test/apply#T) \ No newline at end of file +`inline fun `[`T`](apply.md#T)`.apply(f: `[`T`](apply.md#T)`.() -> Unit): `[`T`](apply.md#T) \ No newline at end of file diff --git a/core/testdata/format/extensionScope.md b/core/testdata/format/extensionScope.md index 3515ed84..ea765bd5 100644 --- a/core/testdata/format/extensionScope.md +++ b/core/testdata/format/extensionScope.md @@ -1,8 +1,8 @@ -[test](test/index) / [test](test/test) +[test](index.md) / [test](./test.md) # test `fun test(): Unit` -Correct link: [Foo.ext](test/ext) +Correct link: [Foo.ext](ext.md) diff --git a/core/testdata/format/extensionWithDocumentedReceiver.md b/core/testdata/format/extensionWithDocumentedReceiver.md index 125da37e..0679ac8f 100644 --- a/core/testdata/format/extensionWithDocumentedReceiver.md +++ b/core/testdata/format/extensionWithDocumentedReceiver.md @@ -1,4 +1,4 @@ -[test](test/index) / [kotlin.String](test/kotlin.-string/index) / [fn](test/kotlin.-string/fn) +[test](../index.md) / [kotlin.String](index.md) / [fn](./fn.md) # fn diff --git a/core/testdata/format/extensions.class.md b/core/testdata/format/extensions.class.md index f75b4dc8..b8fa200a 100644 --- a/core/testdata/format/extensions.class.md +++ b/core/testdata/format/extensions.class.md @@ -1,7 +1,7 @@ -[test](test/index) / [foo](test/foo/index) / [kotlin.String](test/foo/kotlin.-string/index) +[test](../../index.md) / [foo](../index.md) / [kotlin.String](./index.md) ### Extensions for kotlin.String -| [fn](test/foo/kotlin.-string/fn) | `fun String.fn(): Unit`
`fun String.fn(x: Int): Unit`
Function with receiver | -| [foobar](test/foo/kotlin.-string/foobar) | `val String.foobar: Int`
Property with receiver. | +| [fn](fn.md) | `fun String.fn(): Unit`
`fun String.fn(x: Int): Unit`
Function with receiver | +| [foobar](foobar.md) | `val String.foobar: Int`
Property with receiver. | diff --git a/core/testdata/format/extensions.package.md b/core/testdata/format/extensions.package.md index 4dc0cfab..ad895116 100644 --- a/core/testdata/format/extensions.package.md +++ b/core/testdata/format/extensions.package.md @@ -1,8 +1,8 @@ -[test](test/index) / [foo](test/foo/index) +[test](../index.md) / [foo](./index.md) ## Package foo ### Extensions for External Classes -| [kotlin.String](test/foo/kotlin.-string/index) | | +| [kotlin.String](kotlin.-string/index.md) | | diff --git a/core/testdata/format/externalReferenceLink.md b/core/testdata/format/externalReferenceLink.md index 29d64afe..38ffde78 100644 --- a/core/testdata/format/externalReferenceLink.md +++ b/core/testdata/format/externalReferenceLink.md @@ -1,4 +1,4 @@ -[test](test/index) / [a](test/a) +[test](index.md) / [a](./a.md) # a diff --git a/core/testdata/format/functionWithDefaultParameter.md b/core/testdata/format/functionWithDefaultParameter.md index 568c106c..05f7fbe6 100644 --- a/core/testdata/format/functionWithDefaultParameter.md +++ b/core/testdata/format/functionWithDefaultParameter.md @@ -1,4 +1,4 @@ -[test](test/index) / [f](test/f) +[test](index.md) / [f](./f.md) # f diff --git a/core/testdata/format/functionalTypeWithNamedParameters.html b/core/testdata/format/functionalTypeWithNamedParameters.html index 84a489ff..83d03d8f 100644 --- a/core/testdata/format/functionalTypeWithNamedParameters.html +++ b/core/testdata/format/functionalTypeWithNamedParameters.html @@ -1,25 +1,103 @@ + +A - test -test / A
+test / A

A

-class Atest / B
+class A +

Constructors

+ + + + + + + +
+

<init>

+
+A()
+ + + + + + +B - test + + +test / B

B

-class Btest / C
+class B +

Constructors

+ + + + + + + +
+

<init>

+
+B()
+ + + + + + +C - test + + +test / C

C

-class Ctest / f
+class C +

Constructors

+ + + + + + + +
+

<init>

+
+C()
+ + + + + + +f - test + + +test / f

f

-val f: (a: A, b: B) -> Ctest / acceptFunctionTypeWithNamedArguments
+val f: (a: A, b: B) -> C + + + + + + +acceptFunctionTypeWithNamedArguments - test + + +test / acceptFunctionTypeWithNamedArguments

acceptFunctionTypeWithNamedArguments

-fun acceptFunctionTypeWithNamedArguments(f: (bb: B, aa: A) -> C): Unit +fun acceptFunctionTypeWithNamedArguments(f: (bb: B, aa: A) -> C): Unit diff --git a/core/testdata/format/functionalTypeWithNamedParameters.md b/core/testdata/format/functionalTypeWithNamedParameters.md index 317fa6af..4e78694c 100644 --- a/core/testdata/format/functionalTypeWithNamedParameters.md +++ b/core/testdata/format/functionalTypeWithNamedParameters.md @@ -1,21 +1,45 @@ -[test](test/index) / [A](test/-a/index) + +[test](../index.md) / [A](./index.md) # A -`class A`[test](test/index) / [B](test/-b/index) +`class A` + +### Constructors + +| [<init>](-init-.md) | `A()` | + + +[test](../index.md) / [B](./index.md) # B -`class B`[test](test/index) / [C](test/-c/index) +`class B` + +### Constructors + +| [<init>](-init-.md) | `B()` | + + +[test](../index.md) / [C](./index.md) # C -`class C`[test](test/index) / [f](test/f) +`class C` + +### Constructors + +| [<init>](-init-.md) | `C()` | + + +[test](index.md) / [f](./f.md) # f -`val f: (a: `[`A`](test/-a/index)`, b: `[`B`](test/-b/index)`) -> `[`C`](test/-c/index)[test](test/index) / [acceptFunctionTypeWithNamedArguments](test/accept-function-type-with-named-arguments) +`val f: (a: `[`A`](-a/index.md)`, b: `[`B`](-b/index.md)`) -> `[`C`](-c/index.md) + +[test](index.md) / [acceptFunctionTypeWithNamedArguments](./accept-function-type-with-named-arguments.md) # acceptFunctionTypeWithNamedArguments -`fun acceptFunctionTypeWithNamedArguments(f: (bb: `[`B`](test/-b/index)`, aa: `[`A`](test/-a/index)`) -> `[`C`](test/-c/index)`): Unit` \ No newline at end of file +`fun acceptFunctionTypeWithNamedArguments(f: (bb: `[`B`](-b/index.md)`, aa: `[`A`](-a/index.md)`) -> `[`C`](-c/index.md)`): Unit` \ No newline at end of file diff --git a/core/testdata/format/genericInheritedExtensions.md b/core/testdata/format/genericInheritedExtensions.md index 163ff0c9..8d0e316f 100644 --- a/core/testdata/format/genericInheritedExtensions.md +++ b/core/testdata/format/genericInheritedExtensions.md @@ -1,15 +1,15 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar -`class Bar : `[`Foo`](test/-foo/index)`<`[`T`](test/-bar/index#T)`>` +`class Bar : `[`Foo`](../-foo/index.md)`<`[`T`](index.md#T)`>` ### Constructors -| [<init>](test/-bar/-init-) | `Bar()` | +| [<init>](-init-.md) | `Bar()` | ### Extension Functions -| [first](test/first) | `fun `[`Foo`](test/-foo/index)`<`[`T`](test/first#T)`>.first(): Unit` | -| [second](test/second) | `fun `[`Bar`](test/-bar/index)`<`[`T`](test/second#T)`>.second(): Unit` | +| [first](../first.md) | `fun `[`Foo`](../-foo/index.md)`<`[`T`](../first.md#T)`>.first(): Unit` | +| [second](../second.md) | `fun `[`Bar`](./index.md)`<`[`T`](../second.md#T)`>.second(): Unit` | diff --git a/core/testdata/format/gfm/listInTableCell.md b/core/testdata/format/gfm/listInTableCell.md index 73152ac9..359ad916 100644 --- a/core/testdata/format/gfm/listInTableCell.md +++ b/core/testdata/format/gfm/listInTableCell.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -8,10 +8,10 @@ | Name | Summary | |---|---| -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | ### Functions | Name | Summary | |---|---| -| [foo](test/-foo/foo) | `fun foo(): Unit`
  1. Foo
  2. Bar
| +| [foo](foo.md) | `fun foo(): Unit`
  1. Foo
  2. Bar
| diff --git a/core/testdata/format/gfm/sample.md b/core/testdata/format/gfm/sample.md index c2af1c1e..2b082296 100644 --- a/core/testdata/format/gfm/sample.md +++ b/core/testdata/format/gfm/sample.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -10,11 +10,11 @@ The class Foo. | Name | Summary | |---|---| -| [<init>](test/-foo/-init-) | `Foo()`
The class Foo. | +| [<init>](-init-.md) | `Foo()`
The class Foo. | ### Functions | Name | Summary | |---|---| -| [bar](test/-foo/bar) | `fun bar(): Unit`
The method bar. | -| [baz](test/-foo/baz) | `fun baz(): Unit`
The method baz. | +| [bar](bar.md) | `fun bar(): Unit`
The method bar. | +| [baz](baz.md) | `fun baz(): Unit`
The method baz. | diff --git a/core/testdata/format/htmlEscaping.html b/core/testdata/format/htmlEscaping.html index 17d48161..bd64454d 100644 --- a/core/testdata/format/htmlEscaping.html +++ b/core/testdata/format/htmlEscaping.html @@ -4,11 +4,11 @@ x - test -test / x
+test / x

x

-fun <T> x(): T? +fun <T> x(): T?

Special characters: < is "less than", > is "greater than", & is "ampersand"

diff --git a/core/testdata/format/inapplicableExtensionFunctions.md b/core/testdata/format/inapplicableExtensionFunctions.md index 30246faa..08fc2739 100644 --- a/core/testdata/format/inapplicableExtensionFunctions.md +++ b/core/testdata/format/inapplicableExtensionFunctions.md @@ -1,14 +1,14 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar -`class Bar : `[`Foo`](test/-foo/index)`` +`class Bar : `[`Foo`](../-foo/index.md)`` ### Constructors -| [<init>](test/-bar/-init-) | `Bar()` | +| [<init>](-init-.md) | `Bar()` | ### Extension Functions -| [xyzzy](test/xyzzy) | `fun `[`Bar`](test/-bar/index)`.xyzzy(): Unit` | +| [xyzzy](../xyzzy.md) | `fun `[`Bar`](./index.md)`.xyzzy(): Unit` | diff --git a/core/testdata/format/indentedCodeBlock.html b/core/testdata/format/indentedCodeBlock.html index 1ccf800a..86c129fb 100644 --- a/core/testdata/format/indentedCodeBlock.html +++ b/core/testdata/format/indentedCodeBlock.html @@ -4,7 +4,7 @@ foo - test -test / foo
+test / foo

foo

diff --git a/core/testdata/format/indentedCodeBlock.md b/core/testdata/format/indentedCodeBlock.md index 515bfee3..77b0630a 100644 --- a/core/testdata/format/indentedCodeBlock.md +++ b/core/testdata/format/indentedCodeBlock.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo) +[test](index.md) / [foo](./foo.md) # foo diff --git a/core/testdata/format/inheritedCompanionObjectProperties.md b/core/testdata/format/inheritedCompanionObjectProperties.md index db764ff0..ab8f0aa5 100644 --- a/core/testdata/format/inheritedCompanionObjectProperties.md +++ b/core/testdata/format/inheritedCompanionObjectProperties.md @@ -1,30 +1,30 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C -`class C : `[`A`](test/-a/index) +`class C : `[`A`](../-a/index.md) ### Types -| [Companion](test/-c/-companion/index) | `companion object Companion : `[`B`](test/-b/index) | +| [Companion](-companion/index.md) | `companion object Companion : `[`B`](../-b/index.md) | ### Constructors -| [<init>](test/-c/-init-) | `C()` | +| [<init>](-init-.md) | `C()` | ### Functions -| [xyzzy](test/-c/xyzzy) | `fun xyzzy(): Unit` | +| [xyzzy](xyzzy.md) | `fun xyzzy(): Unit` | ### Inherited Functions -| [foo](test/-a/foo) | `fun foo(): Unit` | +| [foo](../-a/foo.md) | `fun foo(): Unit` | ### Companion Object Functions -| [shazam](test/-c/shazam) | `fun shazam(): Unit` | +| [shazam](shazam.md) | `fun shazam(): Unit` | ### Inherited Companion Object Functions -| [bar](test/-b/bar) | `fun bar(): Unit` | +| [bar](../-b/bar.md) | `fun bar(): Unit` | diff --git a/core/testdata/format/inheritedExtensions.md b/core/testdata/format/inheritedExtensions.md index 611b4f6a..97a73666 100644 --- a/core/testdata/format/inheritedExtensions.md +++ b/core/testdata/format/inheritedExtensions.md @@ -1,15 +1,15 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar -`class Bar : `[`Foo`](test/-foo/index) +`class Bar : `[`Foo`](../-foo/index.md) ### Constructors -| [<init>](test/-bar/-init-) | `Bar()` | +| [<init>](-init-.md) | `Bar()` | ### Extension Functions -| [first](test/first) | `fun `[`Foo`](test/-foo/index)`.first(): Unit` | -| [second](test/second) | `fun `[`Bar`](test/-bar/index)`.second(): Unit` | +| [first](../first.md) | `fun `[`Foo`](../-foo/index.md)`.first(): Unit` | +| [second](../second.md) | `fun `[`Bar`](./index.md)`.second(): Unit` | diff --git a/core/testdata/format/inheritedMembers.md b/core/testdata/format/inheritedMembers.md index bed5bd44..334df360 100644 --- a/core/testdata/format/inheritedMembers.md +++ b/core/testdata/format/inheritedMembers.md @@ -1,26 +1,26 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar -`class Bar : `[`Foo`](test/-foo/index) +`class Bar : `[`Foo`](../-foo/index.md) ### Constructors -| [<init>](test/-bar/-init-) | `Bar()` | +| [<init>](-init-.md) | `Bar()` | ### Properties -| [secondProp](test/-bar/second-prop) | `val secondProp: Int` | +| [secondProp](second-prop.md) | `val secondProp: Int` | ### Inherited Properties -| [firstProp](test/-foo/first-prop) | `val firstProp: Int` | +| [firstProp](../-foo/first-prop.md) | `val firstProp: Int` | ### Functions -| [second](test/-bar/second) | `fun second(): Unit` | +| [second](second.md) | `fun second(): Unit` | ### Inherited Functions -| [first](test/-foo/first) | `fun first(): Unit` | +| [first](../-foo/first.md) | `fun first(): Unit` | diff --git a/core/testdata/format/javaCodeInParam.md b/core/testdata/format/javaCodeInParam.md index 696abdc4..319c6d87 100644 --- a/core/testdata/format/javaCodeInParam.md +++ b/core/testdata/format/javaCodeInParam.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C @@ -10,5 +10,5 @@ ### Constructors -| [<init>](test/-c/-init-) | `C()` | +| [<init>](-init-.md) | `C()` | diff --git a/core/testdata/format/javaCodeLiteralTags.md b/core/testdata/format/javaCodeLiteralTags.md index 99dbccfd..b36be04d 100644 --- a/core/testdata/format/javaCodeLiteralTags.md +++ b/core/testdata/format/javaCodeLiteralTags.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C @@ -12,5 +12,5 @@ A<B>C ### Constructors -| [<init>](test/-c/-init-) | `C()`
`AC`
A<B>C | +| [<init>](-init-.md) | `C()`
`AC`
A<B>C | diff --git a/core/testdata/format/javaDeprecated.html b/core/testdata/format/javaDeprecated.html index 67c5fd8f..d938fb9d 100644 --- a/core/testdata/format/javaDeprecated.html +++ b/core/testdata/format/javaDeprecated.html @@ -4,11 +4,11 @@ Foo.foo - test -test / Foo / foo
+test / Foo / foo

foo

open fun foo(): Unit
-Deprecated: use #bar instead +Deprecated: use #bar instead diff --git a/core/testdata/format/javaLinkTag.html b/core/testdata/format/javaLinkTag.html index 035bdd06..f90a58df 100644 --- a/core/testdata/format/javaLinkTag.html +++ b/core/testdata/format/javaLinkTag.html @@ -4,21 +4,21 @@ Foo - test -test / Foo
+test / Foo

Foo

protected open class Foo -

Call #bar() to do the job.

+

Call #bar() to do the job.

Constructors

@@ -28,7 +28,7 @@ diff --git a/core/testdata/format/javaLinkTagWithLabel.html b/core/testdata/format/javaLinkTagWithLabel.html index 69a15bc7..51917f7a 100644 --- a/core/testdata/format/javaLinkTagWithLabel.html +++ b/core/testdata/format/javaLinkTagWithLabel.html @@ -4,21 +4,21 @@ Foo - test -test / Foo
+test / Foo

Foo

protected open class Foo -

Call this wonderful method to do the job.

+

Call this wonderful method to do the job.

Constructors

-

<init>

+

<init>

Foo() -

Call #bar() to do the job.

+

Call #bar() to do the job.

-

bar

+

bar

open fun bar(): Unit
@@ -28,7 +28,7 @@ diff --git a/core/testdata/format/javaSeeTag.html b/core/testdata/format/javaSeeTag.html index c81eec31..f8866dc2 100644 --- a/core/testdata/format/javaSeeTag.html +++ b/core/testdata/format/javaSeeTag.html @@ -4,18 +4,18 @@ Foo - test -test / Foo
+test / Foo

Foo

open class Foo

See Also
-#bar

+#bar

Constructors

-

<init>

+

<init>

Foo() -

Call this wonderful method to do the job.

+

Call this wonderful method to do the job.

-

bar

+

bar

open fun bar(): Unit
@@ -27,7 +27,7 @@ diff --git a/core/testdata/format/javaSpaceInAuthor.md b/core/testdata/format/javaSpaceInAuthor.md index 6d738087..1d2251d0 100644 --- a/core/testdata/format/javaSpaceInAuthor.md +++ b/core/testdata/format/javaSpaceInAuthor.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C @@ -9,5 +9,5 @@ Dmitry Jemerov ### Constructors -| [<init>](test/-c/-init-) | `C()` | +| [<init>](-init-.md) | `C()` | diff --git a/core/testdata/format/javadocHtml.md b/core/testdata/format/javadocHtml.md index 8aba2059..a3c1baff 100644 --- a/core/testdata/format/javadocHtml.md +++ b/core/testdata/format/javadocHtml.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C @@ -18,7 +18,7 @@ Block code ### Constructors -| [<init>](test/-c/-init-) | `C()`
**Bold** **Strong** *Italic* *Emphasized*
Paragraph ~~Strikethrough~~ ~~Deleted~~ `Code` +| [<init>](-init-.md) | `C()`
**Bold** **Strong** *Italic* *Emphasized*
Paragraph ~~Strikethrough~~ ~~Deleted~~ `Code` ``` Block code
``` diff --git a/core/testdata/format/javadocOrderedList.md b/core/testdata/format/javadocOrderedList.md index f18ee96a..88d5f5b6 100644 --- a/core/testdata/format/javadocOrderedList.md +++ b/core/testdata/format/javadocOrderedList.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -10,7 +10,7 @@ ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
+| [<init>](-init-.md) | `Bar()`
1. Rinse 2. Repeat
| diff --git a/core/testdata/format/jdkLinks.md b/core/testdata/format/jdkLinks.md index 607d63e5..7498171d 100644 --- a/core/testdata/format/jdkLinks.md +++ b/core/testdata/format/jdkLinks.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C @@ -10,5 +10,5 @@ You can print something to [java.lang.System.out](http://docs.oracle.com/javase/ ### Constructors -| [<init>](test/-c/-init-) | `C()`
This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)) | +| [<init>](-init-.md) | `C()`
This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)) | diff --git a/core/testdata/format/linkWithLabel.html b/core/testdata/format/linkWithLabel.html index b8fe2228..59bc6ddf 100644 --- a/core/testdata/format/linkWithLabel.html +++ b/core/testdata/format/linkWithLabel.html @@ -4,21 +4,21 @@ Bar - test -test / Bar
+test / Bar

Bar

class Bar -

Use this method for best results.

+

Use this method for best results.

Constructors

-

<init>

+

<init>

Foo()
-

bar

+

bar

open fun bar(): Unit
@@ -28,7 +28,7 @@ diff --git a/core/testdata/format/linkWithStarProjection.html b/core/testdata/format/linkWithStarProjection.html index bb9ce43c..e1b6e098 100644 --- a/core/testdata/format/linkWithStarProjection.html +++ b/core/testdata/format/linkWithStarProjection.html @@ -4,7 +4,7 @@ KClassLoader - test -test / KClassLoader
+test / KClassLoader

KClassLoader

object KClassLoader @@ -13,7 +13,7 @@ diff --git a/core/testdata/format/linksInEmphasis.md b/core/testdata/format/linksInEmphasis.md index 9441ef6a..d0ae70c8 100644 --- a/core/testdata/format/linksInEmphasis.md +++ b/core/testdata/format/linksInEmphasis.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -6,18 +6,18 @@ An emphasised class. -*This class [Bar](test/-bar/index) is awesome.* +*This class [Bar](./index.md) is awesome.* -*Even more awesomer is the function [Bar.foo](test/-bar/foo)* +*Even more awesomer is the function [Bar.foo](foo.md)* -*[Bar.hello](test/-bar/hello) is also OK* +*[Bar.hello](hello.md) is also OK* ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
An emphasised class. | +| [<init>](-init-.md) | `Bar()`
An emphasised class. | ### Functions -| [foo](test/-bar/foo) | `fun foo(): Unit` | -| [hello](test/-bar/hello) | `fun hello(): Unit` | +| [foo](foo.md) | `fun foo(): Unit` | +| [hello](hello.md) | `fun hello(): Unit` | diff --git a/core/testdata/format/linksInHeaders.md b/core/testdata/format/linksInHeaders.md index 85d51356..1dc7d18b 100644 --- a/core/testdata/format/linksInHeaders.md +++ b/core/testdata/format/linksInHeaders.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -6,29 +6,29 @@ Some class with really useless documentation. -# Beer o'clock - time to go to the [Bar](test/-bar/index) +# Beer o'clock - time to go to the [Bar](./index.md) ## But **is [it](isitbeeroclock.com)** really? -### [Bar.hello](test/-bar/hello) to the [Bar.world](test/-bar/world)! +### [Bar.hello](hello.md) to the [Bar.world](world.md)! -#### *Kotlin is amazing, [Bar.none](test/-bar/none)* +#### *Kotlin is amazing, [Bar.none](none.md)* -##### We need to go [Bar.deeper](test/-bar/deeper) +##### We need to go [Bar.deeper](deeper.md) -###### End of the [Bar.line](test/-bar/line) - we need to go back! +###### End of the [Bar.line](line.md) - we need to go back! ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
Some class with really useless documentation. | +| [<init>](-init-.md) | `Bar()`
Some class with really useless documentation. | ### Functions -| [deeper](test/-bar/deeper) | `fun deeper(): Unit` | -| [foo](test/-bar/foo) | `fun foo(): Unit` | -| [hello](test/-bar/hello) | `fun hello(): Unit` | -| [kotlin](test/-bar/kotlin) | `fun kotlin(): Unit` | -| [line](test/-bar/line) | `fun line(): Unit` | -| [none](test/-bar/none) | `fun none(): Unit` | -| [world](test/-bar/world) | `fun world(): Unit` | +| [deeper](deeper.md) | `fun deeper(): Unit` | +| [foo](foo.md) | `fun foo(): Unit` | +| [hello](hello.md) | `fun hello(): Unit` | +| [kotlin](kotlin.md) | `fun kotlin(): Unit` | +| [line](line.md) | `fun line(): Unit` | +| [none](none.md) | `fun none(): Unit` | +| [world](world.md) | `fun world(): Unit` | diff --git a/core/testdata/format/linksInStrong.md b/core/testdata/format/linksInStrong.md index e98d31cc..5b44112d 100644 --- a/core/testdata/format/linksInStrong.md +++ b/core/testdata/format/linksInStrong.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -6,18 +6,18 @@ A strong class. -**This class [Bar](test/-bar/index) is awesome.** +**This class [Bar](./index.md) is awesome.** -**Even more awesomer is the function [Bar.foo](test/-bar/foo)** +**Even more awesomer is the function [Bar.foo](foo.md)** -**[Bar.hello](test/-bar/hello) is also OK** +**[Bar.hello](hello.md) is also OK** ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
A strong class. | +| [<init>](-init-.md) | `Bar()`
A strong class. | ### Functions -| [foo](test/-bar/foo) | `fun foo(): Unit` | -| [hello](test/-bar/hello) | `fun hello(): Unit` | +| [foo](foo.md) | `fun foo(): Unit` | +| [hello](hello.md) | `fun hello(): Unit` | diff --git a/core/testdata/format/markdownInLinks.html b/core/testdata/format/markdownInLinks.html index 6d2327be..596cca73 100644 --- a/core/testdata/format/markdownInLinks.html +++ b/core/testdata/format/markdownInLinks.html @@ -4,7 +4,7 @@ foo - test -test / foo
+test / foo

foo

diff --git a/core/testdata/format/memberExtension.md b/core/testdata/format/memberExtension.md index b9db4e3d..0ec1fda3 100644 --- a/core/testdata/format/memberExtension.md +++ b/core/testdata/format/memberExtension.md @@ -1,10 +1,10 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo -`class Foo : `[`X`](test/-x/index) +`class Foo : `[`X`](../-x/index.md) ### Constructors -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | diff --git a/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md b/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md index e3d4c070..37e943ad 100644 --- a/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md +++ b/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md @@ -1,4 +1,4 @@ -[test](test/index) / [pack](test/pack/index) / [Some](test/pack/-some/index) / [magic](test/pack/-some/-some/magic) +[test](../../../index.md) / [pack](../../index.md) / [Some](../index.md) / [magic](./magic.md) # magic diff --git a/core/testdata/format/multiplatform/groupNode/multiplatform.md b/core/testdata/format/multiplatform/groupNode/multiplatform.md index c0ef14b1..74d464c9 100644 --- a/core/testdata/format/multiplatform/groupNode/multiplatform.md +++ b/core/testdata/format/multiplatform/groupNode/multiplatform.md @@ -1,4 +1,4 @@ -[test](test/index) / [pack](test/pack/index) / [Some](test/pack/-some/index) +[test](../../index.md) / [pack](../index.md) / [Some](./index.md) # Some @@ -12,9 +12,9 @@ ### Constructors -| [<init>](test/pack/-some/-some/-init-) | `Some()` | +| [<init>](-some/-init-.md) | `Some()` | ### Functions -| [magic](test/pack/-some/-some/magic) | `fun magic(): Unit` | +| [magic](-some/magic.md) | `fun magic(): Unit` | diff --git a/core/testdata/format/multiplatform/groupNode/multiplatform.package.md b/core/testdata/format/multiplatform/groupNode/multiplatform.package.md index a9e2e404..5708795e 100644 --- a/core/testdata/format/multiplatform/groupNode/multiplatform.package.md +++ b/core/testdata/format/multiplatform/groupNode/multiplatform.package.md @@ -1,13 +1,13 @@ -[test](test/index) / [pack](test/pack/index) +[test](../index.md) / [pack](./index.md) ## Package pack ### Types -| [Some](test/pack/-some/index)
(JS) | `class Some` | -| [SomeCoolJvmClass](test/pack/-some-cool-jvm-class/index)
(JVM) | `class SomeCoolJvmClass` | +| [Some](-some/index.md)
(JS) | `class Some` | +| [SomeCoolJvmClass](-some-cool-jvm-class/index.md)
(JVM) | `class SomeCoolJvmClass` | ### Type Aliases -| [Some](test/pack/-some/index)
(JVM) | `typealias Some = SomeCoolJvmClass` | +| [Some](-some/index.md)
(JVM) | `typealias Some = SomeCoolJvmClass` | diff --git a/core/testdata/format/multiplatform/implied/foo.md b/core/testdata/format/multiplatform/implied/foo.md index c615dd8e..fca2aff4 100644 --- a/core/testdata/format/multiplatform/implied/foo.md +++ b/core/testdata/format/multiplatform/implied/foo.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo/index) / [Foo](test/foo/-foo/index) +[test](../../index.md) / [foo](../index.md) / [Foo](./index.md) # Foo @@ -8,17 +8,17 @@ This is a foo. ### Constructors -| [<init>](test/foo/-foo/-init-) | `Foo()`
This is a foo. | +| [<init>](-init-.md) | `Foo()`
This is a foo. | ### Properties -| [propJs](test/foo/-foo/prop-js)
(JS) | `val propJs: String` | -| [propJvm](test/foo/-foo/prop-jvm)
(JVM) | `val propJvm: String` | -| [propJvmAndJs](test/foo/-foo/prop-jvm-and-js) | `val propJvmAndJs: Int` | +| [propJs](prop-js.md)
(JS) | `val propJs: String` | +| [propJvm](prop-jvm.md)
(JVM) | `val propJvm: String` | +| [propJvmAndJs](prop-jvm-and-js.md) | `val propJvmAndJs: Int` | ### Functions -| [bothJvmAndJs](test/foo/-foo/both-jvm-and-js) | `fun bothJvmAndJs(): Unit` | -| [js](test/foo/-foo/js)
(JS) | `fun js(): Unit` | -| [jvm](test/foo/-foo/jvm)
(JVM) | `fun jvm(): Unit` | +| [bothJvmAndJs](both-jvm-and-js.md) | `fun bothJvmAndJs(): Unit` | +| [js](js.md)
(JS) | `fun js(): Unit` | +| [jvm](jvm.md)
(JVM) | `fun jvm(): Unit` | diff --git a/core/testdata/format/multiplatform/merge/multiplatform.package.md b/core/testdata/format/multiplatform/merge/multiplatform.package.md index 8e463327..ea78b5a3 100644 --- a/core/testdata/format/multiplatform/merge/multiplatform.package.md +++ b/core/testdata/format/multiplatform/merge/multiplatform.package.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo/index) +[test](../index.md) / [foo](./index.md) ## Package foo @@ -6,5 +6,5 @@ ### Types -| [Foo](test/foo/-foo/index)
(JVM, JS) | `class Foo`
This is a foo. | +| [Foo](-foo/index.md)
(JVM, JS) | `class Foo`
This is a foo. | diff --git a/core/testdata/format/multiplatform/mergeMembers/foo.md b/core/testdata/format/multiplatform/mergeMembers/foo.md index 7490c878..7f41b7d1 100644 --- a/core/testdata/format/multiplatform/mergeMembers/foo.md +++ b/core/testdata/format/multiplatform/mergeMembers/foo.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo/index) / [Foo](test/foo/-foo/index) +[test](../../index.md) / [foo](../index.md) / [Foo](./index.md) # Foo @@ -10,17 +10,17 @@ This is a foo. ### Constructors -| [<init>](test/foo/-foo/-init-) | `Foo()`
This is a foo. | +| [<init>](-init-.md) | `Foo()`
This is a foo. | ### Properties -| [propJs](test/foo/-foo/prop-js)
(JS) | `val propJs: String` | -| [propJvm](test/foo/-foo/prop-jvm)
(JVM) | `val propJvm: String` | -| [propJvmAndJs](test/foo/-foo/prop-jvm-and-js) | `val propJvmAndJs: Int` | +| [propJs](prop-js.md)
(JS) | `val propJs: String` | +| [propJvm](prop-jvm.md)
(JVM) | `val propJvm: String` | +| [propJvmAndJs](prop-jvm-and-js.md) | `val propJvmAndJs: Int` | ### Functions -| [bothJvmAndJs](test/foo/-foo/both-jvm-and-js) | `fun bothJvmAndJs(): Unit` | -| [js](test/foo/-foo/js)
(JS) | `fun js(): Unit` | -| [jvm](test/foo/-foo/jvm)
(JVM) | `fun jvm(): Unit` | +| [bothJvmAndJs](both-jvm-and-js.md) | `fun bothJvmAndJs(): Unit` | +| [js](js.md)
(JS) | `fun js(): Unit` | +| [jvm](jvm.md)
(JVM) | `fun jvm(): Unit` | diff --git a/core/testdata/format/multiplatform/omitRedundant/foo.md b/core/testdata/format/multiplatform/omitRedundant/foo.md index 088ced2c..a20b14cf 100644 --- a/core/testdata/format/multiplatform/omitRedundant/foo.md +++ b/core/testdata/format/multiplatform/omitRedundant/foo.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo/index) / [Foo](test/foo/-foo/index) +[test](../../index.md) / [foo](../index.md) / [Foo](./index.md) # Foo @@ -10,13 +10,13 @@ This is a foo. ### Constructors -| [<init>](test/foo/-foo/-init-) | `Foo()`
This is a foo. | +| [<init>](-init-.md) | `Foo()`
This is a foo. | ### Properties -| [propJvm](test/foo/-foo/prop-jvm) | `val propJvm: String` | +| [propJvm](prop-jvm.md) | `val propJvm: String` | ### Functions -| [jvm](test/foo/-foo/jvm) | `fun jvm(): Unit` | +| [jvm](jvm.md) | `fun jvm(): Unit` | diff --git a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md index 1dda25d4..6f45342b 100644 --- a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md +++ b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md @@ -1,10 +1,10 @@ -[test](test/index) +[test](./index.md) **Platform and version requirements:** JVM, JS ### Packages -| [foo.bar](test/foo.bar/index)
(JVM, JS) | | +| [foo.bar](foo.bar/index.md)
(JVM, JS) | | ### Index diff --git a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md index 2921cdd1..4ddfe2e3 100644 --- a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md +++ b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo.bar](test/foo.bar/index) +[test](../index.md) / [foo.bar](./index.md) ## Package foo.bar @@ -6,5 +6,5 @@ ### Functions -| [buz](test/foo.bar/buz)
(JVM, JS) | `fun buz(): Unit` | +| [buz](buz.md)
(JVM, JS) | `fun buz(): Unit` | diff --git a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md index f6e770b2..f4186b6e 100644 --- a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md +++ b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md @@ -1,10 +1,10 @@ -[test](test/index) +[test](./index.md) **Platform and version requirements:** JVM ### Packages -| [some](test/some/index)
(JVM) | | +| [some](some/index.md)
(JVM) | | ### Index diff --git a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md index 22f778d6..ff480b5a 100644 --- a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md +++ b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md @@ -1,4 +1,4 @@ -[test](test/index) / [some](test/some/index) +[test](../index.md) / [some](./index.md) ## Package some @@ -6,5 +6,5 @@ ### Extensions for External Classes -| [kotlin.String](test/some/kotlin.-string/index) | | +| [kotlin.String](kotlin.-string/index.md) | | diff --git a/core/testdata/format/multiplatform/simple/multiplatform.package.md b/core/testdata/format/multiplatform/simple/multiplatform.package.md index 3574942c..fad7e90d 100644 --- a/core/testdata/format/multiplatform/simple/multiplatform.package.md +++ b/core/testdata/format/multiplatform/simple/multiplatform.package.md @@ -1,9 +1,9 @@ -[test](test/index) / [foo](test/foo/index) +[test](../index.md) / [foo](./index.md) ## Package foo ### Types -| [Bar](test/foo/-bar/index)
(JS) | `class Bar`
This is a bar. | -| [Foo](test/foo/-foo/index)
(JVM) | `class Foo`
This is a foo. | +| [Bar](-bar/index.md)
(JS) | `class Bar`
This is a bar. | +| [Foo](-foo/index.md)
(JVM) | `class Foo`
This is a foo. | diff --git a/core/testdata/format/multipleTypeParameterConstraints.md b/core/testdata/format/multipleTypeParameterConstraints.md index 5dd45e4e..78586aca 100644 --- a/core/testdata/format/multipleTypeParameterConstraints.md +++ b/core/testdata/format/multipleTypeParameterConstraints.md @@ -1,13 +1,18 @@ -[test](test/index) / [A](test/-a) + +[test](index.md) / [A](./-a.md) # A -`interface A`[test](test/index) / [B](test/-b) +`interface A` + +[test](index.md) / [B](./-b.md) # B -`interface B`[test](test/index) / [f](test/f) +`interface B` + +[test](index.md) / [f](./f.md) # f -`fun f(): Unit where T : `[`A`](test/-a)`, T : `[`B`](test/-b) \ No newline at end of file +`fun f(): Unit where T : `[`A`](-a.md)`, T : `[`B`](-b.md) \ No newline at end of file diff --git a/core/testdata/format/nestedLists.md b/core/testdata/format/nestedLists.md index dd151944..fb25bc32 100644 --- a/core/testdata/format/nestedLists.md +++ b/core/testdata/format/nestedLists.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -8,36 +8,36 @@ Usage instructions: * **Rinse** 1. Alter any rinse options *(optional)* - * Recommended to [Bar.useSoap](test/-bar/use-soap) + * Recommended to [Bar.useSoap](use-soap.md) * Optionally apply [Bar.elbowGrease](#) for best results - 2. [Bar.rinse](test/-bar/rinse) to begin rinse - 1. Thus you should call [Bar.rinse](test/-bar/rinse) - 2. *Then* call [Bar.repeat](test/-bar/repeat) + 2. [Bar.rinse](rinse.md) to begin rinse + 1. Thus you should call [Bar.rinse](rinse.md) + 2. *Then* call [Bar.repeat](repeat.md) * Don't forget to use: * Soap * Elbow Grease - 3. Finally, adjust soap usage [Bar.useSoap](test/-bar/use-soap) as needed - 3. Repeat with [Bar.repeat](test/-bar/repeat) + 3. Finally, adjust soap usage [Bar.useSoap](use-soap.md) as needed + 3. Repeat with [Bar.repeat](repeat.md) * **Repeat** * Will use previously used rinse options - * [Bar.rinse](test/-bar/rinse) must have been called once before + * [Bar.rinse](rinse.md) must have been called once before * Can be repeated any number of times * Options include: - * [Bar.useSoap](test/-bar/use-soap) - * [Bar.useElbowGrease](test/-bar/use-elbow-grease) + * [Bar.useSoap](use-soap.md) + * [Bar.useElbowGrease](use-elbow-grease.md) ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
Usage instructions: | +| [<init>](-init-.md) | `Bar()`
Usage instructions: | ### Properties -| [useElbowGrease](test/-bar/use-elbow-grease) | `var useElbowGrease: Boolean` | -| [useSoap](test/-bar/use-soap) | `var useSoap: Boolean` | +| [useElbowGrease](use-elbow-grease.md) | `var useElbowGrease: Boolean` | +| [useSoap](use-soap.md) | `var useSoap: Boolean` | ### Functions -| [repeat](test/-bar/repeat) | `fun repeat(): Unit` | -| [rinse](test/-bar/rinse) | `fun rinse(): Unit` | +| [repeat](repeat.md) | `fun repeat(): Unit` | +| [rinse](rinse.md) | `fun rinse(): Unit` | diff --git a/core/testdata/format/newlineInTableCell.package.md b/core/testdata/format/newlineInTableCell.package.md index 4b3875ba..53716db3 100644 --- a/core/testdata/format/newlineInTableCell.package.md +++ b/core/testdata/format/newlineInTableCell.package.md @@ -1,8 +1,8 @@ -[test](test/index) +[test](./index.md) ## Package <root> ### Types -| [A](test/-a/index) | `class A`
There is `long long int` story full of new lines | +| [A](-a/index.md) | `class A`
There is `long long int` story full of new lines | diff --git a/core/testdata/format/notPublishedTypeAliasAutoExpansion.md b/core/testdata/format/notPublishedTypeAliasAutoExpansion.md index 9e0f1560..ca95093c 100644 --- a/core/testdata/format/notPublishedTypeAliasAutoExpansion.md +++ b/core/testdata/format/notPublishedTypeAliasAutoExpansion.md @@ -1,9 +1,9 @@ -[test](test/index) / [foo](test/foo) +[test](index.md) / [foo](./foo.md) # foo `fun foo(): Unit` -Correct ref [TA](test/-a/index) -Correct ref [TB](test/-b/index) +Correct ref [TA](-a/index.md) +Correct ref [TB](-b/index.md) diff --git a/core/testdata/format/nullability.md b/core/testdata/format/nullability.md index 014eb485..7b81c255 100644 --- a/core/testdata/format/nullability.md +++ b/core/testdata/format/nullability.md @@ -1,4 +1,4 @@ -[test](test/index) / [C](test/-c/index) +[test](../index.md) / [C](./index.md) # C @@ -6,9 +6,9 @@ ### Constructors -| [<init>](test/-c/-init-) | `C()` | +| [<init>](-init-.md) | `C()` | ### Functions -| [foo](test/-c/foo) | `fun foo(): Comparable<`[`T`](test/-c/index#T)`>?` | +| [foo](foo.md) | `fun foo(): Comparable<`[`T`](index.md#T)`>?` | diff --git a/core/testdata/format/operatorOverloading.md b/core/testdata/format/operatorOverloading.md index 8e8d36eb..0a4c87b6 100644 --- a/core/testdata/format/operatorOverloading.md +++ b/core/testdata/format/operatorOverloading.md @@ -1,5 +1,5 @@ -[test](test/index) / [C](test/-c/index) / [plus](test/-c/plus) +[test](../index.md) / [C](index.md) / [plus](./plus.md) # plus -`fun plus(other: `[`C`](test/-c/index)`): `[`C`](test/-c/index) \ No newline at end of file +`fun plus(other: `[`C`](index.md)`): `[`C`](index.md) \ No newline at end of file diff --git a/core/testdata/format/orderedList.html b/core/testdata/format/orderedList.html index 66f37876..6f735bfd 100644 --- a/core/testdata/format/orderedList.html +++ b/core/testdata/format/orderedList.html @@ -4,7 +4,7 @@ Bar - test -test / Bar
+test / Bar

Bar

class Bar @@ -17,7 +17,7 @@
-

<init>

+

<init>

Bar() -

Use this method for best results.

+

Use this method for best results.

-

foo

+

foo

fun foo(): Unit
-

foo

+

foo

fun foo(c: Enum<*>): Unit
-

<init>

+

<init>

Bar() diff --git a/core/testdata/format/overloads.html b/core/testdata/format/overloads.html index d0f7f37d..feda82e4 100644 --- a/core/testdata/format/overloads.html +++ b/core/testdata/format/overloads.html @@ -4,7 +4,7 @@ root package - test -test
+test

Package <root>

Functions

@@ -12,7 +12,7 @@
-

f

+

f

fun f(x: Int): Unit
diff --git a/core/testdata/format/overloadsWithDescription.html b/core/testdata/format/overloadsWithDescription.html index fe98b8fe..16b03f7e 100644 --- a/core/testdata/format/overloadsWithDescription.html +++ b/core/testdata/format/overloadsWithDescription.html @@ -4,14 +4,14 @@ f - test -test / f
+test / f

f

fun f(x: Int): Unit
fun f(x: String): Unit -

Performs an action on x.

+

Performs an action on x.

This is a long description.

Parameters

diff --git a/core/testdata/format/overloadsWithDifferentDescriptions.html b/core/testdata/format/overloadsWithDifferentDescriptions.html index 1f086039..4c4f7f74 100644 --- a/core/testdata/format/overloadsWithDifferentDescriptions.html +++ b/core/testdata/format/overloadsWithDifferentDescriptions.html @@ -4,7 +4,7 @@ f - test -test / f
+test / f

f

diff --git a/core/testdata/format/overridingFunction.md b/core/testdata/format/overridingFunction.md index dcc1c426..d0ec82fa 100644 --- a/core/testdata/format/overridingFunction.md +++ b/core/testdata/format/overridingFunction.md @@ -1,8 +1,8 @@ -[test](test/index) / [D](test/-d/index) / [f](test/-d/f) +[test](../index.md) / [D](index.md) / [f](./f.md) # f `fun f(): Unit` -Overrides [C.f](test/-c/f) +Overrides [C.f](../-c/f.md) diff --git a/core/testdata/format/paramTag.md b/core/testdata/format/paramTag.md index d3e948ae..7cc33d21 100644 --- a/core/testdata/format/paramTag.md +++ b/core/testdata/format/paramTag.md @@ -1,4 +1,4 @@ -[test](test/index) / [f](test/f) +[test](index.md) / [f](./f.md) # f diff --git a/core/testdata/format/parameterAnchor.html b/core/testdata/format/parameterAnchor.html index 3ffcf595..a4ae0997 100644 --- a/core/testdata/format/parameterAnchor.html +++ b/core/testdata/format/parameterAnchor.html @@ -4,12 +4,12 @@ processFiles - test -test / processFiles
+test / processFiles

processFiles

-fun <T> processFiles(processor: () -> T): List<T> -

Runs processor for each file and collects its results into single list

+fun <T> processFiles(processor: () -> T): List<T> +

Runs processor for each file and collects its results into single list

Parameters

processor - function to receive context for symbol resolution and file for processing

diff --git a/core/testdata/format/parenthesis.html b/core/testdata/format/parenthesis.html index 6f3c1d6b..c63154c1 100644 --- a/core/testdata/format/parenthesis.html +++ b/core/testdata/format/parenthesis.html @@ -4,7 +4,7 @@ foo - test -test / foo
+test / foo

foo

diff --git a/core/testdata/format/propertyVar.md b/core/testdata/format/propertyVar.md index 8232dff4..887d25a5 100644 --- a/core/testdata/format/propertyVar.md +++ b/core/testdata/format/propertyVar.md @@ -1,4 +1,4 @@ -[test](test/index) / [x](test/x) +[test](index.md) / [x](./x.md) # x diff --git a/core/testdata/format/qualifiedNameLink.md b/core/testdata/format/qualifiedNameLink.md index 590bb435..92fa8f7a 100644 --- a/core/testdata/format/qualifiedNameLink.md +++ b/core/testdata/format/qualifiedNameLink.md @@ -1,4 +1,4 @@ -[test](test/index) / [foo](test/foo) +[test](index.md) / [foo](./foo.md) # foo diff --git a/core/testdata/format/receiverParameterTypeBound.md b/core/testdata/format/receiverParameterTypeBound.md index 9c767449..978dc0f8 100644 --- a/core/testdata/format/receiverParameterTypeBound.md +++ b/core/testdata/format/receiverParameterTypeBound.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -6,9 +6,9 @@ ### Constructors -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | ### Extension Functions -| [xyzzy](test/xyzzy) | `fun `[`T`](test/xyzzy#T)`.xyzzy(): Unit` | +| [xyzzy](../xyzzy.md) | `fun `[`T`](../xyzzy.md#T)`.xyzzy(): Unit` | diff --git a/core/testdata/format/receiverReference.md b/core/testdata/format/receiverReference.md index 1584b2b1..bdcce322 100644 --- a/core/testdata/format/receiverReference.md +++ b/core/testdata/format/receiverReference.md @@ -1,6 +1,6 @@ -[test](test/index) / [kotlin.String](test/kotlin.-string/index) +[test](../index.md) / [kotlin.String](./index.md) ### Extensions for kotlin.String -| [some](test/kotlin.-string/some) | `fun String.some(): Unit`
Prints [this](test/kotlin.-string/some/-this-) | +| [some](some.md) | `fun String.some(): Unit`
Prints [this](some/-this-.md) | diff --git a/core/testdata/format/referenceLink.md b/core/testdata/format/referenceLink.md index b3d89e0d..ee910cbf 100644 --- a/core/testdata/format/referenceLink.md +++ b/core/testdata/format/referenceLink.md @@ -1,14 +1,16 @@ -[test](test/index) / [example](test/example/index) / [a](test/example/a) + +[test](../index.md) / [example](index.md) / [a](./a.md) # a `fun a(): Unit` -It is link to [example other func](test/example/some-other-func) +It is link to [example other func](some-other-func.md) -Sure, it is [example](test/example/some-other-func) +Sure, it is [example](some-other-func.md) -[test](test/index) / [example](test/example/index) / [someOtherFunc](test/example/some-other-func) + +[test](../index.md) / [example](index.md) / [someOtherFunc](./some-other-func.md) # someOtherFunc diff --git a/core/testdata/format/reifiedTypeParameter.md b/core/testdata/format/reifiedTypeParameter.md index 253f2438..40dbed7b 100644 --- a/core/testdata/format/reifiedTypeParameter.md +++ b/core/testdata/format/reifiedTypeParameter.md @@ -1,4 +1,4 @@ -[test](test/index) / [f](test/f) +[test](index.md) / [f](./f.md) # f diff --git a/core/testdata/format/renderFunctionalTypeInParenthesisWhenItIsReceiver.md b/core/testdata/format/renderFunctionalTypeInParenthesisWhenItIsReceiver.md index c9856976..ad632fef 100644 --- a/core/testdata/format/renderFunctionalTypeInParenthesisWhenItIsReceiver.md +++ b/core/testdata/format/renderFunctionalTypeInParenthesisWhenItIsReceiver.md @@ -1,6 +1,6 @@ -[test](test/index) / [kotlin.SuspendFunction0](test/kotlin.-suspend-function0/index) +[test](../index.md) / [kotlin.SuspendFunction0](./index.md) ### Extensions for kotlin.SuspendFunction0 -| [foo](test/kotlin.-suspend-function0/foo) | `fun (suspend () -> Unit).foo(): Unit` | +| [foo](foo.md) | `fun (suspend () -> Unit).foo(): Unit` | diff --git a/core/testdata/format/returnWithLink.html b/core/testdata/format/returnWithLink.html index f6e918dd..fe1d031b 100644 --- a/core/testdata/format/returnWithLink.html +++ b/core/testdata/format/returnWithLink.html @@ -4,12 +4,12 @@ foo - test -test / foo
+test / foo

foo

fun foo(s1: String): String

Return
-Returns s1 and does nothing else.

+Returns s1 and does nothing else.

diff --git a/core/testdata/format/sampleByFQName.md b/core/testdata/format/sampleByFQName.md index 06333e13..7093179d 100644 --- a/core/testdata/format/sampleByFQName.md +++ b/core/testdata/format/sampleByFQName.md @@ -1,8 +1,11 @@ -[test](test/index) / [test](test/test/index) / [sample](test/test/sample) + +[test](../index.md) / [test](index.md) / [sample](./sample.md) # sample -`fun sample(): Unit`[test](test/index) / [test](test/test/index) / [use](test/test/use) +`fun sample(): Unit` + +[test](../index.md) / [test](index.md) / [use](./use.md) # use diff --git a/core/testdata/format/sampleByShortName.md b/core/testdata/format/sampleByShortName.md index 06333e13..7093179d 100644 --- a/core/testdata/format/sampleByShortName.md +++ b/core/testdata/format/sampleByShortName.md @@ -1,8 +1,11 @@ -[test](test/index) / [test](test/test/index) / [sample](test/test/sample) + +[test](../index.md) / [test](index.md) / [sample](./sample.md) # sample -`fun sample(): Unit`[test](test/index) / [test](test/test/index) / [use](test/test/use) +`fun sample(): Unit` + +[test](../index.md) / [test](index.md) / [use](./use.md) # use diff --git a/core/testdata/format/see.html b/core/testdata/format/see.html index d350d6b7..74773951 100644 --- a/core/testdata/format/see.html +++ b/core/testdata/format/see.html @@ -1,22 +1,43 @@ + +quux - test -test / quux
+test / quux

quux

fun quux(): Unit

See Also
-

foo

-

bar

+

foo

+

bar

-test / foo
+ + + + + + +foo - test + + +test / foo

foo

-fun foo(): Unittest / bar
+fun foo(): Unit + + + + + + +bar - test + + +test / bar

bar

diff --git a/core/testdata/format/shadowedExtensionFunctions.md b/core/testdata/format/shadowedExtensionFunctions.md index 3b0a9dc9..f900ecb2 100644 --- a/core/testdata/format/shadowedExtensionFunctions.md +++ b/core/testdata/format/shadowedExtensionFunctions.md @@ -1,15 +1,15 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar -`class Bar : `[`Foo`](test/-foo/index) +`class Bar : `[`Foo`](../-foo/index.md) ### Constructors -| [<init>](test/-bar/-init-) | `Bar()` | +| [<init>](-init-.md) | `Bar()` | ### Extension Functions -| [shazam](test/shazam) | `fun `[`Bar`](test/-bar/index)`.shazam(i: Int): Unit`
`fun `[`Foo`](test/-foo/index)`.shazam(): Unit` | -| [xyzzy](test/xyzzy) | `fun `[`Bar`](test/-bar/index)`.xyzzy(): Unit` | +| [shazam](../shazam.md) | `fun `[`Bar`](./index.md)`.shazam(i: Int): Unit`
`fun `[`Foo`](../-foo/index.md)`.shazam(): Unit` | +| [xyzzy](../xyzzy.md) | `fun `[`Bar`](./index.md)`.xyzzy(): Unit` | diff --git a/core/testdata/format/sinceKotlin.html b/core/testdata/format/sinceKotlin.html index ab25a002..32988de2 100644 --- a/core/testdata/format/sinceKotlin.html +++ b/core/testdata/format/sinceKotlin.html @@ -4,7 +4,7 @@ Since1.1 - test -test / Since1.1
+test / Since1.1

Since1.1

class Since1.1 @@ -15,7 +15,7 @@
-

<init>

+

<init>

Since1.1() diff --git a/core/testdata/format/sinceKotlin.md b/core/testdata/format/sinceKotlin.md index a1abe5fd..df96db0a 100644 --- a/core/testdata/format/sinceKotlin.md +++ b/core/testdata/format/sinceKotlin.md @@ -1,4 +1,4 @@ -[test](test/index) / [Since1.1](test/-since1.1/index) +[test](../index.md) / [Since1.1](./index.md) # Since1.1 @@ -10,5 +10,5 @@ Useful ### Constructors -| [<init>](test/-since1.1/-init-) | `Since1.1()`
Useful | +| [<init>](-init-.md) | `Since1.1()`
Useful | diff --git a/core/testdata/format/sinceKotlin.package.md b/core/testdata/format/sinceKotlin.package.md index c811749c..eabf88d5 100644 --- a/core/testdata/format/sinceKotlin.package.md +++ b/core/testdata/format/sinceKotlin.package.md @@ -1,4 +1,4 @@ -[test](test/index) +[test](./index.md) ## Package <root> @@ -6,5 +6,5 @@ ### Types -| [Since1.1](test/-since1.1/index)
(Kotlin 1.1) | `class Since1.1`
Useful | +| [Since1.1](-since1.1/index.md)
(Kotlin 1.1) | `class Since1.1`
Useful | diff --git a/core/testdata/format/sinceKotlinWide.package.md b/core/testdata/format/sinceKotlinWide.package.md index f683b178..58a5045e 100644 --- a/core/testdata/format/sinceKotlinWide.package.md +++ b/core/testdata/format/sinceKotlinWide.package.md @@ -1,4 +1,4 @@ -[test](test/index) +[test](./index.md) ## Package <root> @@ -6,6 +6,6 @@ ### Types -| [Since1.1](test/-since1.1/index)
(Kotlin 1.1) | `class Since1.1`
Useful | -| [Since1.2](test/-since1.2/index)
(Kotlin 1.2) | `class Since1.2`
Useful also | +| [Since1.1](-since1.1/index.md)
(Kotlin 1.1) | `class Since1.1`
Useful | +| [Since1.2](-since1.2/index.md)
(Kotlin 1.2) | `class Since1.2`
Useful also | diff --git a/core/testdata/format/starProjection.md b/core/testdata/format/starProjection.md index 6f796e77..5a53e5b9 100644 --- a/core/testdata/format/starProjection.md +++ b/core/testdata/format/starProjection.md @@ -1,6 +1,6 @@ -[test](test/index) / [kotlin.collections.Iterable](test/kotlin.collections.-iterable/index) +[test](../index.md) / [kotlin.collections.Iterable](./index.md) ### Extensions for kotlin.collections.Iterable -| [containsFoo](test/kotlin.collections.-iterable/contains-foo) | `fun Iterable<*>.containsFoo(element: Any?): Boolean` | +| [containsFoo](contains-foo.md) | `fun Iterable<*>.containsFoo(element: Any?): Boolean` | diff --git a/core/testdata/format/summarizeSignatures.md b/core/testdata/format/summarizeSignatures.md index c1830fb5..4f494166 100644 --- a/core/testdata/format/summarizeSignatures.md +++ b/core/testdata/format/summarizeSignatures.md @@ -1,14 +1,14 @@ -[test](test/index) / [kotlin](test/kotlin/index) +[test](../index.md) / [kotlin](./index.md) ## Package kotlin ### Types -| [Array](test/kotlin/-array/index) | `class Array` | -| [CharArray](test/kotlin/-char-array/index) | `class CharArray` | -| [IntArray](test/kotlin/-int-array/index) | `class IntArray` | +| [Array](-array/index.md) | `class Array` | +| [CharArray](-char-array/index.md) | `class CharArray` | +| [IntArray](-int-array/index.md) | `class IntArray` | ### Functions -| [foo](test/kotlin/foo) | `fun any_array.foo(predicate: (`[`T`](test/kotlin/foo#T)`) -> Boolean): Boolean`
Returns true if foo. | +| [foo](foo.md) | `fun any_array.foo(predicate: (`[`T`](foo.md#T)`) -> Boolean): Boolean`
Returns true if foo. | diff --git a/core/testdata/format/summarizeSignaturesProperty.md b/core/testdata/format/summarizeSignaturesProperty.md index 712aebd4..507ad6a5 100644 --- a/core/testdata/format/summarizeSignaturesProperty.md +++ b/core/testdata/format/summarizeSignaturesProperty.md @@ -1,14 +1,14 @@ -[test](test/index) / [kotlin](test/kotlin/index) +[test](../index.md) / [kotlin](./index.md) ## Package kotlin ### Types -| [Array](test/kotlin/-array/index) | `class Array` | -| [CharArray](test/kotlin/-char-array/index) | `class CharArray` | -| [IntArray](test/kotlin/-int-array/index) | `class IntArray` | +| [Array](-array/index.md) | `class Array` | +| [CharArray](-char-array/index.md) | `class CharArray` | +| [IntArray](-int-array/index.md) | `class IntArray` | ### Properties -| [foo](test/kotlin/foo) | `val any_array.foo: Int`
Returns true if foo. | +| [foo](foo.md) | `val any_array.foo: Int`
Returns true if foo. | diff --git a/core/testdata/format/suspendParam.md b/core/testdata/format/suspendParam.md index cf11f57b..ab116140 100644 --- a/core/testdata/format/suspendParam.md +++ b/core/testdata/format/suspendParam.md @@ -1,4 +1,4 @@ -[test](test/index) / [takesSuspendParam](test/takes-suspend-param) +[test](index.md) / [takesSuspendParam](./takes-suspend-param.md) # takesSuspendParam diff --git a/core/testdata/format/suspendParam.package.md b/core/testdata/format/suspendParam.package.md index 463ba356..92bd7ee7 100644 --- a/core/testdata/format/suspendParam.package.md +++ b/core/testdata/format/suspendParam.package.md @@ -1,8 +1,8 @@ -[test](test/index) +[test](./index.md) ## Package <root> ### Functions -| [takesSuspendParam](test/takes-suspend-param) | `fun takesSuspendParam(func: suspend () -> Unit): Unit` | +| [takesSuspendParam](takes-suspend-param.md) | `fun takesSuspendParam(func: suspend () -> Unit): Unit` | diff --git a/core/testdata/format/throwsTag.md b/core/testdata/format/throwsTag.md index a476fa1b..70fba512 100644 --- a/core/testdata/format/throwsTag.md +++ b/core/testdata/format/throwsTag.md @@ -1,4 +1,4 @@ -[test](test/index) / [f](test/f) +[test](index.md) / [f](./f.md) # f diff --git a/core/testdata/format/tokensInEmphasis.md b/core/testdata/format/tokensInEmphasis.md index 79dde6f0..a68861de 100644 --- a/core/testdata/format/tokensInEmphasis.md +++ b/core/testdata/format/tokensInEmphasis.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -6,15 +6,15 @@ Another emphasised class. -*This class, [Bar](test/-bar/index) is just meh.* +*This class, [Bar](./index.md) is just meh.* -*For a semicolon; [Bar.foo](test/-bar/foo) is for you!.* +*For a semicolon; [Bar.foo](foo.md) is for you!.* ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
Another emphasised class. | +| [<init>](-init-.md) | `Bar()`
Another emphasised class. | ### Functions -| [foo](test/-bar/foo) | `fun foo(): String` | +| [foo](foo.md) | `fun foo(): String` | diff --git a/core/testdata/format/tokensInHeaders.md b/core/testdata/format/tokensInHeaders.md index 46a1e9a5..bd25492e 100644 --- a/core/testdata/format/tokensInHeaders.md +++ b/core/testdata/format/tokensInHeaders.md @@ -1,4 +1,4 @@ -[test](test/index) / [The](test/-the/index) +[test](../index.md) / [The](./index.md) # The @@ -6,32 +6,32 @@ Why did the token cross the road? -# Because it was Beer o'clock @ [The.bar](test/-the/bar) +# Because it was Beer o'clock @ [The.bar](bar.md) ## But **waz *\[sic\]* [it](isitbeeroclock.com)** really? -### [The.bar](test/-the/bar) has? [The.foo](test/-the/foo)est drinks ever! +### [The.bar](bar.md) has? [The.foo](foo.md)est drinks ever! -#### *[The.kotlinz](test/-the/kotlinz) is [The.bestests](test/-the/bestests), [Bar.none](test/-the/-bar/none)* +#### *[The.kotlinz](kotlinz.md) is [The.bestests](bestests.md), [Bar.none](-bar/none.md)* -##### So many lame code "puns" (in) [The.house](test/-the/house) +##### So many lame code "puns" (in) [The.house](house.md) ###### End of the?? [Bar.line](#)! - we need to go back! ### Types -| [Bar](test/-the/-bar/index) | `object Bar` | +| [Bar](-bar/index.md) | `object Bar` | ### Constructors -| [<init>](test/-the/-init-) | `The()`
Why did the token cross the road? | +| [<init>](-init-.md) | `The()`
Why did the token cross the road? | ### Functions -| [bar](test/-the/bar) | `fun bar(): Unit` | -| [bestests](test/-the/bestests) | `fun bestests(): Unit` | -| [foo](test/-the/foo) | `fun foo(): Unit` | -| [house](test/-the/house) | `fun house(): Unit` | -| [kotlinz](test/-the/kotlinz) | `fun kotlinz(): Unit` | -| [line](test/-the/line) | `fun line(): Unit` | +| [bar](bar.md) | `fun bar(): Unit` | +| [bestests](bestests.md) | `fun bestests(): Unit` | +| [foo](foo.md) | `fun foo(): Unit` | +| [house](house.md) | `fun house(): Unit` | +| [kotlinz](kotlinz.md) | `fun kotlinz(): Unit` | +| [line](line.md) | `fun line(): Unit` | diff --git a/core/testdata/format/tokensInStrong.md b/core/testdata/format/tokensInStrong.md index e1abe030..2781656c 100644 --- a/core/testdata/format/tokensInStrong.md +++ b/core/testdata/format/tokensInStrong.md @@ -1,20 +1,20 @@ -[test](test/index) / [Yasc](test/-yasc/index) +[test](../index.md) / [Yasc](./index.md) # Yasc `class Yasc` -**YASC: [Yasc](test/-yasc/index) Yet Another Strong Class** +**YASC: [Yasc](./index.md) Yet Another Strong Class** -**This class, [Yasc](test/-yasc/index) *is* just meh.** +**This class, [Yasc](./index.md) *is* just meh.** -**For a semicolon; [Yasc.foo](test/-yasc/foo) is for you!.** +**For a semicolon; [Yasc.foo](foo.md) is for you!.** ### Constructors -| [<init>](test/-yasc/-init-) | `Yasc()`
**YASC: [Yasc](test/-yasc/index) Yet Another Strong Class** | +| [<init>](-init-.md) | `Yasc()`
**YASC: [Yasc](./index.md) Yet Another Strong Class** | ### Functions -| [foo](test/-yasc/foo) | `fun foo(): String` | +| [foo](foo.md) | `fun foo(): String` | diff --git a/core/testdata/format/tripleBackticks.html b/core/testdata/format/tripleBackticks.html index bac3385c..dacd0567 100644 --- a/core/testdata/format/tripleBackticks.html +++ b/core/testdata/format/tripleBackticks.html @@ -4,7 +4,7 @@ f - test -test / f
+test / f

f

diff --git a/core/testdata/format/typeAliases.md b/core/testdata/format/typeAliases.md index 2a813c32..218c4848 100644 --- a/core/testdata/format/typeAliases.md +++ b/core/testdata/format/typeAliases.md @@ -1,63 +1,104 @@ -[test](test/index) / [A](test/-a/index) + +[test](../index.md) / [A](./index.md) # A -`class A`[test](test/index) / [B](test/-b/index) +`class A` + +### Constructors + +| [<init>](-init-.md) | `A()` | + + +[test](../index.md) / [B](./index.md) # B -`class B`[test](test/index) / [C](test/-c/index) +`class B` + +### Constructors + +| [<init>](-init-.md) | `B()` | + + +[test](../index.md) / [C](./index.md) # C -`class C`[test](test/index) / [D](test/-d) +`class C` + +### Constructors + +| [<init>](-init-.md) | `C()` | + + +[test](index.md) / [D](./-d.md) # D -`typealias D = `[`A`](test/-a/index)[test](test/index) / [E](test/-e) +`typealias D = `[`A`](-a/index.md) + +[test](index.md) / [E](./-e.md) # E -`typealias E = `[`D`](test/-d)[test](test/index) / [F](test/-f) +`typealias E = `[`D`](-d.md) + +[test](index.md) / [F](./-f.md) # F -`typealias F = (`[`A`](test/-a/index)`) -> `[`B`](test/-b/index)[test](test/index) / [G](test/-g) +`typealias F = (`[`A`](-a/index.md)`) -> `[`B`](-b/index.md) + +[test](index.md) / [G](./-g.md) # G -`typealias G = `[`C`](test/-c/index)`<`[`A`](test/-a/index)`>`[test](test/index) / [H](test/-h) +`typealias G = `[`C`](-c/index.md)`<`[`A`](-a/index.md)`>` + +[test](index.md) / [H](./-h.md) # H -`typealias H = `[`C`](test/-c/index)`<`[`T`](test/-h#T)`>`[test](test/index) / [I](test/-i) +`typealias H = `[`C`](-c/index.md)`<`[`T`](-h.md#T)`>` + +[test](index.md) / [I](./-i.md) # I -`typealias I = `[`H`](test/-h)`<`[`T`](test/-i#T)`>`[test](test/index) / [J](test/-j) +`typealias I = `[`H`](-h.md)`<`[`T`](-i.md#T)`>` + +[test](index.md) / [J](./-j.md) # J -`typealias J = `[`H`](test/-h)`<`[`A`](test/-a/index)`>`[test](test/index) / [K](test/-k) +`typealias J = `[`H`](-h.md)`<`[`A`](-a/index.md)`>` + +[test](index.md) / [K](./-k.md) # K -`typealias K = `[`H`](test/-h)`<`[`J`](test/-j)`>`[test](test/index) / [L](test/-l) +`typealias K = `[`H`](-h.md)`<`[`J`](-j.md)`>` + +[test](index.md) / [L](./-l.md) # L -`typealias L = (`[`K`](test/-k)`, `[`B`](test/-b/index)`) -> `[`J`](test/-j)[test](test/index) / [M](test/-m) +`typealias L = (`[`K`](-k.md)`, `[`B`](-b/index.md)`) -> `[`J`](-j.md) + +[test](index.md) / [M](./-m.md) # M -`typealias M = `[`A`](test/-a/index) +`typealias M = `[`A`](-a/index.md) Documented -[test](test/index) / [N](test/-n) + +[test](index.md) / [N](./-n.md) # N -`typealias ~~N~~ = `[`A`](test/-a/index) +`typealias ~~N~~ = `[`A`](-a/index.md) **Deprecated:** !!! diff --git a/core/testdata/format/typeAliases.package.md b/core/testdata/format/typeAliases.package.md index 9407588b..199e91c2 100644 --- a/core/testdata/format/typeAliases.package.md +++ b/core/testdata/format/typeAliases.package.md @@ -1,24 +1,24 @@ -[test](test/index) +[test](./index.md) ## Package <root> ### Types -| [A](test/-a/index) | `class A` | -| [B](test/-b/index) | `class B` | -| [C](test/-c/index) | `class C` | +| [A](-a/index.md) | `class A` | +| [B](-b/index.md) | `class B` | +| [C](-c/index.md) | `class C` | ### Type Aliases -| [D](test/-d) | `typealias D = `[`A`](test/-a/index) | -| [E](test/-e) | `typealias E = `[`D`](test/-d) | -| [F](test/-f) | `typealias F = (`[`A`](test/-a/index)`) -> `[`B`](test/-b/index) | -| [G](test/-g) | `typealias G = `[`C`](test/-c/index)`<`[`A`](test/-a/index)`>` | -| [H](test/-h) | `typealias H = `[`C`](test/-c/index)`<`[`T`](test/-h#T)`>` | -| [I](test/-i) | `typealias I = `[`H`](test/-h)`<`[`T`](test/-i#T)`>` | -| [J](test/-j) | `typealias J = `[`H`](test/-h)`<`[`A`](test/-a/index)`>` | -| [K](test/-k) | `typealias K = `[`H`](test/-h)`<`[`J`](test/-j)`>` | -| [L](test/-l) | `typealias L = (`[`K`](test/-k)`, `[`B`](test/-b/index)`) -> `[`J`](test/-j) | -| [M](test/-m) | `typealias M = `[`A`](test/-a/index)
Documented | -| [N](test/-n) | `typealias ~~N~~ = `[`A`](test/-a/index) | +| [D](-d.md) | `typealias D = `[`A`](-a/index.md) | +| [E](-e.md) | `typealias E = `[`D`](-d.md) | +| [F](-f.md) | `typealias F = (`[`A`](-a/index.md)`) -> `[`B`](-b/index.md) | +| [G](-g.md) | `typealias G = `[`C`](-c/index.md)`<`[`A`](-a/index.md)`>` | +| [H](-h.md) | `typealias H = `[`C`](-c/index.md)`<`[`T`](-h.md#T)`>` | +| [I](-i.md) | `typealias I = `[`H`](-h.md)`<`[`T`](-i.md#T)`>` | +| [J](-j.md) | `typealias J = `[`H`](-h.md)`<`[`A`](-a/index.md)`>` | +| [K](-k.md) | `typealias K = `[`H`](-h.md)`<`[`J`](-j.md)`>` | +| [L](-l.md) | `typealias L = (`[`K`](-k.md)`, `[`B`](-b/index.md)`) -> `[`J`](-j.md) | +| [M](-m.md) | `typealias M = `[`A`](-a/index.md)
Documented | +| [N](-n.md) | `typealias ~~N~~ = `[`A`](-a/index.md) | diff --git a/core/testdata/format/typeLink.html b/core/testdata/format/typeLink.html index 2e51863f..30af8a93 100644 --- a/core/testdata/format/typeLink.html +++ b/core/testdata/format/typeLink.html @@ -4,16 +4,16 @@ Bar - test -test / Bar
+test / Bar

Bar

-class Bar : Foo +class Bar : Foo

Constructors

diff --git a/core/testdata/format/typeParameterBounds.md b/core/testdata/format/typeParameterBounds.md index 8f369ed6..cf03b3a7 100644 --- a/core/testdata/format/typeParameterBounds.md +++ b/core/testdata/format/typeParameterBounds.md @@ -1,8 +1,8 @@ -[test](test/index) / [generic](test/generic) +[test](index.md) / [generic](./generic.md) # generic -`fun generic(): Unit` +`fun generic(): Unit` generic function diff --git a/core/testdata/format/typeParameterReference.md b/core/testdata/format/typeParameterReference.md index ea49d48a..5001d321 100644 --- a/core/testdata/format/typeParameterReference.md +++ b/core/testdata/format/typeParameterReference.md @@ -1,8 +1,8 @@ -[test](test/index) / [tt](test/tt) +[test](index.md) / [tt](./tt.md) # tt -`fun `[`T`](test/tt#T)`.tt(): Unit` +`fun `[`T`](tt.md#T)`.tt(): Unit` -Correct ref to [T](test/tt#T) +Correct ref to [T](tt.md#T) diff --git a/core/testdata/format/typeParameterVariance.md b/core/testdata/format/typeParameterVariance.md index 01f5562c..b0615d43 100644 --- a/core/testdata/format/typeParameterVariance.md +++ b/core/testdata/format/typeParameterVariance.md @@ -1,4 +1,4 @@ -[test](test/index) / [Foo](test/-foo/index) +[test](../index.md) / [Foo](./index.md) # Foo @@ -10,5 +10,5 @@ ### Constructors -| [<init>](test/-foo/-init-) | `Foo()` | +| [<init>](-init-.md) | `Foo()` | diff --git a/core/testdata/format/typeProjectionVariance.md b/core/testdata/format/typeProjectionVariance.md index 072b9fc7..d3a55c58 100644 --- a/core/testdata/format/typeProjectionVariance.md +++ b/core/testdata/format/typeProjectionVariance.md @@ -1,6 +1,6 @@ -[test](test/index) / [kotlin.Array](test/kotlin.-array/index) +[test](../index.md) / [kotlin.Array](./index.md) ### Extensions for kotlin.Array -| [foo](test/kotlin.-array/foo) | `fun Array.foo(): Unit` | +| [foo](foo.md) | `fun Array.foo(): Unit` | diff --git a/core/testdata/format/uninterpretedEmphasisCharacters.html b/core/testdata/format/uninterpretedEmphasisCharacters.html index ced7d0a5..dd338f72 100644 --- a/core/testdata/format/uninterpretedEmphasisCharacters.html +++ b/core/testdata/format/uninterpretedEmphasisCharacters.html @@ -4,7 +4,7 @@ foo - test -test / foo
+test / foo

foo

diff --git a/core/testdata/format/unorderedLists.md b/core/testdata/format/unorderedLists.md index a6b00b34..52ad9a71 100644 --- a/core/testdata/format/unorderedLists.md +++ b/core/testdata/format/unorderedLists.md @@ -1,4 +1,4 @@ -[test](test/index) / [Bar](test/-bar/index) +[test](../index.md) / [Bar](./index.md) # Bar @@ -11,9 +11,9 @@ Usage summary: Usage instructions: -* [Bar.rinse](test/-bar/rinse) to rinse +* [Bar.rinse](rinse.md) to rinse * Alter any rinse options *(optional)* -* To repeat; [Bar.repeat](test/-bar/repeat) +* To repeat; [Bar.repeat](repeat.md) * Can reconfigure options: * Soap * Elbow Grease @@ -21,27 +21,27 @@ Usage instructions: Rinse options: -* [Bar.useSoap](test/-bar/use-soap) +* [Bar.useSoap](use-soap.md) * *recommended* -* [Bar.useElbowGrease](test/-bar/use-elbow-grease) +* [Bar.useElbowGrease](use-elbow-grease.md) * *warning: requires effort* -* [Bar.useBleach](test/-bar/use-bleach) +* [Bar.useBleach](use-bleach.md) * **use with caution** ### Constructors -| [<init>](test/-bar/-init-) | `Bar()`
Usage summary: | +| [<init>](-init-.md) | `Bar()`
Usage summary: | ### Properties -| [useBleach](test/-bar/use-bleach) | `var useBleach: Boolean` | -| [useElbowGrease](test/-bar/use-elbow-grease) | `var useElbowGrease: Boolean` | -| [useSoap](test/-bar/use-soap) | `var useSoap: Boolean` | +| [useBleach](use-bleach.md) | `var useBleach: Boolean` | +| [useElbowGrease](use-elbow-grease.md) | `var useElbowGrease: Boolean` | +| [useSoap](use-soap.md) | `var useSoap: Boolean` | ### Functions -| [repeat](test/-bar/repeat) | `fun repeat(): Unit` | -| [rinse](test/-bar/rinse) | `fun rinse(): Unit` | +| [repeat](repeat.md) | `fun repeat(): Unit` | +| [rinse](rinse.md) | `fun rinse(): Unit` | diff --git a/core/testdata/format/varargsFunction.md b/core/testdata/format/varargsFunction.md index 85ac9c92..550202cc 100644 --- a/core/testdata/format/varargsFunction.md +++ b/core/testdata/format/varargsFunction.md @@ -1,4 +1,4 @@ -[test](test/index) / [f](test/f) +[test](index.md) / [f](./f.md) # f diff --git a/core/testdata/format/website-html/dataTags/multiplatform.package.html b/core/testdata/format/website-html/dataTags/multiplatform.package.html index 15e1fc12..35453ab1 100644 --- a/core/testdata/format/website-html/dataTags/multiplatform.package.html +++ b/core/testdata/format/website-html/dataTags/multiplatform.package.html @@ -1,10 +1,10 @@ - +

Package foo

Functions

-

<init>

+

<init>

Bar()
-

jre7

+

jre7

@@ -12,7 +12,7 @@
-

jre7New

+

jre7New

@@ -20,7 +20,7 @@
-

js

+

js

@@ -28,7 +28,7 @@
-

jsNew

+

jsNew

@@ -36,7 +36,7 @@
-

jvm

+

jvm

@@ -44,7 +44,7 @@
-

jvmNew

+

jvmNew

@@ -52,7 +52,7 @@
-

shared

+

shared

@@ -60,7 +60,7 @@
-

sharedNew

+

sharedNew

diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html index 35773561..3d34fc7e 100644 --- a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html @@ -1,4 +1,4 @@ - +

Some

typealias Some = SomeCoolJvmClass

Platform and version requirements: JVM

@@ -10,7 +10,7 @@
-

<init>

+

<init>

@@ -25,7 +25,7 @@
-

magic

+

magic

diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html index 15ae2a5b..c8926a28 100644 --- a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html @@ -1,10 +1,10 @@ - +

Package pack

Types

-

Some

+

Some

@@ -12,7 +12,7 @@
-

SomeCoolJvmClass

+

SomeCoolJvmClass

@@ -25,7 +25,7 @@
-

Some

+

Some

diff --git a/core/testdata/format/website-html/dropImport.html b/core/testdata/format/website-html/dropImport.html index 97ff4a68..e0fcb12b 100644 --- a/core/testdata/format/website-html/dropImport.html +++ b/core/testdata/format/website-html/dropImport.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Unit
diff --git a/core/testdata/format/website-html/newLinesInImportList.html b/core/testdata/format/website-html/newLinesInImportList.html index 334ed11c..b5a07325 100644 --- a/core/testdata/format/website-html/newLinesInImportList.html +++ b/core/testdata/format/website-html/newLinesInImportList.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Unit
diff --git a/core/testdata/format/website-html/newLinesInSamples.html b/core/testdata/format/website-html/newLinesInSamples.html index ab70140d..50f875da 100644 --- a/core/testdata/format/website-html/newLinesInSamples.html +++ b/core/testdata/format/website-html/newLinesInSamples.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Unit
diff --git a/core/testdata/format/website-html/overloadGroup.html b/core/testdata/format/website-html/overloadGroup.html index 3ea7de94..aaba9c96 100644 --- a/core/testdata/format/website-html/overloadGroup.html +++ b/core/testdata/format/website-html/overloadGroup.html @@ -1,4 +1,4 @@ - +

magic

fun magic(spell: String): Int
diff --git a/core/testdata/format/website-html/returnTag.html b/core/testdata/format/website-html/returnTag.html index d4190fa1..7724eaa7 100644 --- a/core/testdata/format/website-html/returnTag.html +++ b/core/testdata/format/website-html/returnTag.html @@ -1,9 +1,9 @@ - +

indexOf

-
fun Foo.indexOf(
    char: Char,
    startIndex: Int = 0,
    ignoreCase: Boolean = false
): Int
-

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

+
fun Foo.indexOf(
    char: Char,
    startIndex: Int = 0,
    ignoreCase: Boolean = false
): Int
+

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

Parameters

ignoreCase - true to ignore character case when matching a character. By default false.

-

Returns An index of the first occurrence of char or -1 if none is found.

+

Returns An index of the first occurrence of char or -1 if none is found.

diff --git a/core/testdata/format/website-html/sample.html b/core/testdata/format/website-html/sample.html index d709edc4..1fb26e41 100644 --- a/core/testdata/format/website-html/sample.html +++ b/core/testdata/format/website-html/sample.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Int
diff --git a/core/testdata/format/website-html/sampleWithAsserts.html b/core/testdata/format/website-html/sampleWithAsserts.html index 11a3a626..e91232f5 100644 --- a/core/testdata/format/website-html/sampleWithAsserts.html +++ b/core/testdata/format/website-html/sampleWithAsserts.html @@ -1,4 +1,4 @@ - +

a

fun a(): String
-- cgit From 214e16e07d93b3565c433ed67b78796e80f43ec5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 18:25:08 +0300 Subject: Tidy around --- core/src/main/kotlin/Formats/StandardFormats.kt | 4 - .../kotlin/Locations/FoldersLocationService.kt | 20 ---- core/src/main/kotlin/Locations/Location.kt | 59 ++++++++++++ core/src/main/kotlin/Locations/LocationService.kt | 104 --------------------- .../Locations/SingleFolderLocationService.kt | 20 ---- core/src/main/kotlin/Utilities/DokkaModules.kt | 2 - 6 files changed, 59 insertions(+), 150 deletions(-) delete mode 100644 core/src/main/kotlin/Locations/FoldersLocationService.kt create mode 100644 core/src/main/kotlin/Locations/Location.kt delete mode 100644 core/src/main/kotlin/Locations/LocationService.kt delete mode 100644 core/src/main/kotlin/Locations/SingleFolderLocationService.kt diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt index 71af1991..dd67ac97 100644 --- a/core/src/main/kotlin/Formats/StandardFormats.kt +++ b/core/src/main/kotlin/Formats/StandardFormats.kt @@ -47,10 +47,6 @@ class KotlinWebsiteHtmlFormatDescriptor : KotlinFormatDescriptorBase() { override val sampleProcessingService = KotlinWebsiteSampleProcessingService::class override val outlineServiceClass = YamlOutlineService::class - override fun configureAnalysis(binder: Binder) { - super.configureAnalysis(binder) - } - override fun configureOutput(binder: Binder) = with(binder) { super.configureOutput(binder) bind().toInstance(EmptyHtmlTemplateService) diff --git a/core/src/main/kotlin/Locations/FoldersLocationService.kt b/core/src/main/kotlin/Locations/FoldersLocationService.kt deleted file mode 100644 index ae5301e7..00000000 --- a/core/src/main/kotlin/Locations/FoldersLocationService.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.jetbrains.dokka - -import com.google.inject.Inject -import com.google.inject.name.Named -import java.io.File -// -//class FoldersLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { -// constructor(root: String): this(File(root), "") -// -// override val root: Location -// get() = FileLocation(rootFile) -// -// override fun withExtension(newExtension: String): FileLocationService { -// return if (extension.isEmpty()) FoldersLocationService(rootFile, newExtension) else this -// } -// -// override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation { -// return FileLocation(File(rootFile, relativePathToNode(qualifiedName, hasMembers)).appendExtension(extension)) -// } -//} diff --git a/core/src/main/kotlin/Locations/Location.kt b/core/src/main/kotlin/Locations/Location.kt new file mode 100644 index 00000000..17538ff5 --- /dev/null +++ b/core/src/main/kotlin/Locations/Location.kt @@ -0,0 +1,59 @@ +package org.jetbrains.dokka + +import java.io.File + +interface Location { + val path: String get + fun relativePathTo(other: Location, anchor: String? = null): String +} + +/** + * Represents locations in the documentation in the form of [path](File). + * + * $file: [File] for this location + * $path: [String] representing path of this location + */ +data class FileLocation(val file: File): Location { + override val path : String + get() = file.path + + override fun relativePathTo(other: Location, anchor: String?): String { + if (other !is FileLocation) { + throw IllegalArgumentException("$other is not a FileLocation") + } + if (file.path.substringBeforeLast(".") == other.file.path.substringBeforeLast(".") && anchor == null) { + return "./${file.name}" + } + val ownerFolder = file.parentFile!! + val relativePath = ownerFolder.toPath().relativize(other.file.toPath()).toString().replace(File.separatorChar, '/') + return if (anchor == null) relativePath else relativePath + "#" + anchor + } +} + + +fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String { + val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } + return if (!hasMembers) { + // leaf node, use file in owner's folder + parts.joinToString("/") + } else { + parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" + } +} + +fun relativePathToNode(node: DocumentationNode) = relativePathToNode(node.path.map { it.name }, node.members.any()) + +fun identifierToFilename(path: String): String { + val escaped = path.replace('<', '-').replace('>', '-') + val lowercase = escaped.replace("[A-Z]".toRegex()) { matchResult -> "-" + matchResult.value.toLowerCase() } + return if (lowercase == "index") "--index--" else lowercase +} + +fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { + return location(owner).relativePathTo(location(node), null) +} + +fun NodeLocationAwareGenerator.relativeToRoot(from: Location): File { + val file = File(from.path) + return file.relativeTo(root) +} \ No newline at end of file diff --git a/core/src/main/kotlin/Locations/LocationService.kt b/core/src/main/kotlin/Locations/LocationService.kt deleted file mode 100644 index e453baca..00000000 --- a/core/src/main/kotlin/Locations/LocationService.kt +++ /dev/null @@ -1,104 +0,0 @@ -package org.jetbrains.dokka - -import java.io.File - -interface Location { - val path: String get - fun relativePathTo(other: Location, anchor: String? = null): String -} - -/** - * Represents locations in the documentation in the form of [path](File). - * - * Locations are provided by [LocationService.location] function. - * - * $file: [File] for this location - * $path: [String] representing path of this location - */ -data class FileLocation(val file: File): Location { - override val path : String - get() = file.path - - override fun relativePathTo(other: Location, anchor: String?): String { - if (other !is FileLocation) { - throw IllegalArgumentException("$other is not a FileLocation") - } - if (file.path.substringBeforeLast(".") == other.file.path.substringBeforeLast(".") && anchor == null) { - return "./${file.name}" - } - val ownerFolder = file.parentFile!! - val relativePath = ownerFolder.toPath().relativize(other.file.toPath()).toString().replace(File.separatorChar, '/') - return if (anchor == null) relativePath else relativePath + "#" + anchor - } -} - - - -fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String { - val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } - return if (!hasMembers) { - // leaf node, use file in owner's folder - parts.joinToString("/") - } else { - parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" - } -} - -fun relativePathToNode(node: DocumentationNode) = relativePathToNode(node.path.map { it.name }, node.members.any()) - - -// -///** -// * Provides means of retrieving locations for [DocumentationNode](documentation nodes) -// * -// * `LocationService` determines where documentation for particular node should be generated -// * -// * * [FoldersLocationService] – represent packages and types as folders, members as files in those folders. -// * * [SingleFolderLocationService] – all documentation is generated into single folder using fully qualified names -// * for file names. -// */ -//interface LocationService { -// fun withExtension(newExtension: String) = this -// -// fun location(node: DocumentationNode): Location = location(node.path.map { it.name }, node.members.any()) -// -// /** -// * Calculates a location corresponding to the specified [qualifiedName]. -// * @param hasMembers if true, the node for which the location is calculated has member nodes. -// */ -// fun location(qualifiedName: List, hasMembers: Boolean): Location -// -// val root: Location -//} -// -// -//interface FileLocationService: LocationService { -// override fun withExtension(newExtension: String): FileLocationService = this -// -// override fun location(node: DocumentationNode): FileLocation = location(node.path.map { it.name }, node.members.any()) -// override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation -//} - -fun identifierToFilename(path: String): String { - val escaped = path.replace('<', '-').replace('>', '-') - val lowercase = escaped.replace("[A-Z]".toRegex()) { matchResult -> "-" + matchResult.value.toLowerCase() } - return if (lowercase == "index") "--index--" else lowercase -} - -///** -// * Returns relative location between two nodes. Used for relative links in documentation. -// */ -//fun LocationService.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { -// return location(owner).relativePathTo(location(node), null) -//} - - -fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode): String { - return location(owner).relativePathTo(location(node), null) -} - - -fun NodeLocationAwareGenerator.relativeToRoot(from: Location): File { - val file = File(from.path) - return file.relativeTo(root) -} \ No newline at end of file diff --git a/core/src/main/kotlin/Locations/SingleFolderLocationService.kt b/core/src/main/kotlin/Locations/SingleFolderLocationService.kt deleted file mode 100644 index 25cf6f8e..00000000 --- a/core/src/main/kotlin/Locations/SingleFolderLocationService.kt +++ /dev/null @@ -1,20 +0,0 @@ -package org.jetbrains.dokka - -import com.google.inject.Inject -import com.google.inject.name.Named -import java.io.File -// -//class SingleFolderLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { -// constructor(root: String): this(File(root), "") -// -// override fun withExtension(newExtension: String): FileLocationService = -// SingleFolderLocationService(rootFile, newExtension) -// -// override fun location(qualifiedName: List, hasMembers: Boolean): FileLocation { -// val filename = qualifiedName.map { identifierToFilename(it) }.joinToString("-") -// return FileLocation(File(rootFile, filename).appendExtension(extension)) -// } -// -// override val root: Location -// get() = FileLocation(rootFile) -//} \ No newline at end of file diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index fcc2f692..6b5e153e 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -24,8 +24,6 @@ class DokkaAnalysisModule(val environment: AnalysisEnvironment, override fun configure(binder: Binder) { binder.bind().toInstance(logger) - binder.registerCategory("language") - val coreEnvironment = environment.createCoreEnvironment() binder.bind().toInstance(coreEnvironment) -- cgit From 6ef35accd16533c84be5d0164739b146cfb55b73 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 11 Dec 2017 16:01:51 +0300 Subject: Fix optional binding --- core/src/main/kotlin/Formats/FormatDescriptor.kt | 10 ++++++---- core/src/main/kotlin/Utilities/DokkaModules.kt | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/src/main/kotlin/Formats/FormatDescriptor.kt b/core/src/main/kotlin/Formats/FormatDescriptor.kt index aa00df97..a1120c00 100644 --- a/core/src/main/kotlin/Formats/FormatDescriptor.kt +++ b/core/src/main/kotlin/Formats/FormatDescriptor.kt @@ -3,6 +3,7 @@ package org.jetbrains.dokka.Formats import com.google.inject.Binder import org.jetbrains.dokka.* import org.jetbrains.dokka.Utilities.bind +import org.jetbrains.dokka.Utilities.lazyBind import org.jetbrains.dokka.Utilities.toOptional import org.jetbrains.dokka.Utilities.toType import kotlin.reflect.KClass @@ -23,11 +24,12 @@ abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor { override fun configureOutput(binder: Binder): Unit = with(binder) { bind() toType NodeLocationAwareGenerator::class - - bind() toOptional (outlineServiceClass) - bind() toOptional formatServiceClass bind() toType generatorServiceClass - bind() toOptional packageListServiceClass + + + lazyBind() toOptional (outlineServiceClass) + lazyBind() toOptional formatServiceClass + lazyBind() toOptional packageListServiceClass } abstract val formatServiceClass: KClass? diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index 6b5e153e..763e29a9 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -73,7 +73,9 @@ private inline fun Binder.bindNameAnnotat inline fun Binder.bind(): AnnotatedBindingBuilder = bind(T::class.java) -inline infix fun > AnnotatedBindingBuilder.toOptional(kClass: TKClass?) = - kClass?.let { to(it.java) } +inline fun Binder.lazyBind(): Lazy> = lazy { bind(T::class.java) } + +inline infix fun > Lazy>.toOptional(kClass: TKClass?) = + kClass?.let { value toType it } inline infix fun > AnnotatedBindingBuilder.toType(kClass: TKClass) = to(kClass.java) -- cgit From 799e3713f8b6a80b53a1b9f28a86844ed30b71ae Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 11 Dec 2017 18:28:08 +0300 Subject: Fix file extensions when FormatService.extension != linkExtension --- core/src/main/kotlin/Generation/FileGenerator.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index 3d25e932..bc08e180 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -2,6 +2,7 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.name.Named +import org.jetbrains.kotlin.utils.fileUtils.withReplacedExtensionOrNull import java.io.File import java.io.FileOutputStream import java.io.IOException @@ -17,22 +18,26 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override val root: File = rootFile override fun location(node: DocumentationNode): FileLocation { - return locationWithoutExtension(node).let { it.copy(file = it.file.appendExtension(formatService.linkExtension)) } + return FileLocation(fileForNode(node, formatService.linkExtension)) + } + + private fun fileForNode(node: DocumentationNode, extension: String = ""): File { + return File(root, relativePathToNode(node)).appendExtension(extension) } fun locationWithoutExtension(node: DocumentationNode): FileLocation { - return FileLocation(File(rootFile, relativePathToNode(node))) + return FileLocation(fileForNode(node)) } override fun buildPages(nodes: Iterable) { - for ((location, items) in nodes.groupBy { location(it) }) { - val file = location.file + for ((file, items) in nodes.groupBy { fileForNode(it, formatService.extension) }) { + file.parentFile?.mkdirsOrFail() try { FileOutputStream(file).use { OutputStreamWriter(it, Charsets.UTF_8).use { - it.write(formatService.format(location, items)) + it.write(formatService.format(location(items.first()), items)) } } } catch (e: Throwable) { -- cgit From 2de8d15435c1e779a1f97c48330acf5fc9c38670 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 11 Dec 2017 18:30:42 +0300 Subject: Add description for javadoc format --- core/src/main/resources/dokka/format/javadoc.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/resources/dokka/format/javadoc.properties b/core/src/main/resources/dokka/format/javadoc.properties index a58317fc..a0d8a945 100644 --- a/core/src/main/resources/dokka/format/javadoc.properties +++ b/core/src/main/resources/dokka/format/javadoc.properties @@ -1 +1,2 @@ -class=org.jetbrains.dokka.javadoc.JavadocFormatDescriptor \ No newline at end of file +class=org.jetbrains.dokka.javadoc.JavadocFormatDescriptor +description=Produces Javadoc, with Kotlin declarations as Java view \ No newline at end of file -- cgit From dbd4774ffae19ff4d52cd21c7cb3906cdc3e0b5c Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 15 Dec 2017 01:00:32 +0300 Subject: Normalize file path's when using as URI --- core/src/main/kotlin/Formats/HtmlTemplateService.kt | 2 +- core/src/main/kotlin/Locations/Location.kt | 10 ++++++---- core/src/test/kotlin/format/FileGeneratorTestCase.kt | 7 ++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt index 84e01910..a65a7b18 100644 --- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt +++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt @@ -24,7 +24,7 @@ interface HtmlTemplateService { to.appendln("$title") } if (css != null) { - val cssPath = basePath.resolve(css) + val cssPath = basePath.resolve(css).toUnixString() to.appendln("") } to.appendln("") diff --git a/core/src/main/kotlin/Locations/Location.kt b/core/src/main/kotlin/Locations/Location.kt index 17538ff5..0e6572d9 100644 --- a/core/src/main/kotlin/Locations/Location.kt +++ b/core/src/main/kotlin/Locations/Location.kt @@ -13,8 +13,8 @@ interface Location { * $file: [File] for this location * $path: [String] representing path of this location */ -data class FileLocation(val file: File): Location { - override val path : String +data class FileLocation(val file: File) : Location { + override val path: String get() = file.path override fun relativePathTo(other: Location, anchor: String?): String { @@ -30,7 +30,6 @@ data class FileLocation(val file: File): Location { } } - fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String { val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } return if (!hasMembers) { @@ -41,6 +40,7 @@ fun relativePathToNode(qualifiedName: List, hasMembers: Boolean): String } } + fun relativePathToNode(node: DocumentationNode) = relativePathToNode(node.path.map { it.name }, node.members.any()) fun identifierToFilename(path: String): String { @@ -56,4 +56,6 @@ fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, fun NodeLocationAwareGenerator.relativeToRoot(from: Location): File { val file = File(from.path) return file.relativeTo(root) -} \ No newline at end of file +} + +fun File.toUnixString() = toString().replace(File.separatorChar, '/') diff --git a/core/src/test/kotlin/format/FileGeneratorTestCase.kt b/core/src/test/kotlin/format/FileGeneratorTestCase.kt index 644d5baa..948426ea 100644 --- a/core/src/test/kotlin/format/FileGeneratorTestCase.kt +++ b/core/src/test/kotlin/format/FileGeneratorTestCase.kt @@ -1,9 +1,6 @@ package org.jetbrains.dokka.tests -import org.jetbrains.dokka.DocumentationNode -import org.jetbrains.dokka.FileGenerator -import org.jetbrains.dokka.FormatService -import org.jetbrains.dokka.relativeToRoot +import org.jetbrains.dokka.* import org.junit.Before import org.junit.Rule import org.junit.rules.TemporaryFolder @@ -30,7 +27,7 @@ abstract class FileGeneratorTestCase { if (sb.isNotBlank() && !sb.endsWith('\n')) { sb.appendln() } - sb.appendln("") + sb.appendln("") } sb.append(loc.file.readText()) } -- cgit From ec3d364e49268f1dfbc7619245ec36a49e780169 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 15 Dec 2017 22:01:02 +0300 Subject: Don't force bind LanguageService to KotlinLanguageService --- core/src/main/kotlin/Utilities/DokkaModules.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index 763e29a9..36704918 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -46,7 +46,6 @@ object StringListType : TypeLiteral<@JvmSuppressWildcards List>() class DokkaOutputModule(val options: DocumentationOptions, val logger: DokkaLogger) : Module { override fun configure(binder: Binder) { - binder.bind(LanguageService::class.java).to(KotlinLanguageService::class.java) binder.bind(File::class.java).annotatedWith(Names.named("outputDir")).toInstance(File(options.outputDir)) binder.bind().toInstance(options) -- cgit From 56213b9d66a78fdd35c2826c6edc3f36d491ff32 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 29 Jan 2018 19:53:23 +0300 Subject: Update Gradle Kotlin Runtime dependencies version to 1.1 Dokka drops support for Gradle less then 3.5 --- gradle.properties | 2 +- integration/build.gradle | 2 +- integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt | 2 ++ runners/android-gradle-plugin/build.gradle | 2 +- runners/gradle-integration-tests/build.gradle | 3 +-- .../src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt | 5 +++++ .../kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt | 4 ++++ .../src/test/kotlin/org/jetbrains/dokka/gradle/BasicTest.kt | 3 +++ .../kotlin/org/jetbrains/dokka/gradle/JavadocRSuppressionTest.kt | 4 ++++ .../kotlin/org/jetbrains/dokka/gradle/MultiProjectSingleOutTest.kt | 3 +++ .../org/jetbrains/dokka/gradle/RebuildAfterSourceChangeTest.kt | 5 +++++ runners/gradle-plugin/build.gradle | 2 +- 12 files changed, 31 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6b9383bf..4a6475b1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ dokka_publication_channel=dokka #Kotlin compiler and plugin bundled_kotlin_compiler_version=1.2.20-dev-419 kotlin_version=1.2.0 -kotlin_for_gradle_runtime_version=1.0.7 +kotlin_for_gradle_runtime_version=1.1.60 ant_version=1.9.6 diff --git a/integration/build.gradle b/integration/build.gradle index 32ca3454..026cfbc0 100644 --- a/integration/build.gradle +++ b/integration/build.gradle @@ -12,7 +12,7 @@ sourceCompatibility = 1.8 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { languageVersion = "1.2" - apiVersion = "1.0" + apiVersion = "1.1" jvmTarget = "1.8" } } diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt b/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt index 3c9bf156..1984a3e5 100644 --- a/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt +++ b/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt @@ -1,6 +1,8 @@ package org.jetbrains.dokka import kotlin.reflect.* +import kotlin.reflect.full.memberFunctions +import kotlin.reflect.full.memberProperties import kotlin.reflect.jvm.isAccessible object ReflectDsl { diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle index 5050fd87..7d286cc7 100644 --- a/runners/android-gradle-plugin/build.gradle +++ b/runners/android-gradle-plugin/build.gradle @@ -13,7 +13,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { freeCompilerArgs += "-Xjsr305=strict" languageVersion = "1.2" - apiVersion = "1.0" + apiVersion = "1.1" jvmTarget = "1.8" } } diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle index 1809589f..cb734db3 100644 --- a/runners/gradle-integration-tests/build.gradle +++ b/runners/gradle-integration-tests/build.gradle @@ -21,8 +21,7 @@ configurations { dependencies { - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_for_gradle_runtime_version - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version + testCompileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_for_gradle_runtime_version testCompile ideaRT() diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt index ba70479f..bbb63909 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt @@ -17,4 +17,9 @@ class AndroidAppTest : AbstractAndroidAppTest("androidApp") { fun `test kotlin 1_0_7 and gradle 2_14_1 and abt 2_2_3`() { doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24)) } + + @Test + fun `test kotlin 1_2_20 and gradle 4_5 and abt 3_0_1`() { + doTest("4.5", "1.2.20", AndroidPluginParams("3.0.1", "27.0.0", 27)) + } } \ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt index 28328af8..ef1b94d8 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt @@ -53,4 +53,8 @@ class AndroidMultiFlavourAppTest : AbstractDokkaAndroidGradleTest() { doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24)) } + @Test fun `test kotlin 1_2_20 and gradle 4_5 and abt 3_0_1`() { + doTest("4.5", "1.2.20", AndroidPluginParams("3.0.1", "27.0.0", 27)) + } + } \ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/BasicTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/BasicTest.kt index b1364004..ebaf1653 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/BasicTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/BasicTest.kt @@ -49,4 +49,7 @@ class BasicTest : AbstractDokkaGradleTest() { doTest("4.0", "1.1.2") } + @Test fun `test kotlin 1_2_20 and gradle 4_5`() { + doTest("4.5", "1.2.20") + } } \ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/JavadocRSuppressionTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/JavadocRSuppressionTest.kt index 511a033c..3a4d08b8 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/JavadocRSuppressionTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/JavadocRSuppressionTest.kt @@ -17,4 +17,8 @@ class JavadocRSuppressionTest : AbstractAndroidAppTest("androidAppJavadoc") { fun `test kotlin 1_0_7 and gradle 2_14_1 and abt 2_2_3`() { doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24)) } + + @Test fun `test kotlin 1_2_20 and gradle 4_5 and abt 3_0_1`() { + doTest("4.5", "1.2.20", AndroidPluginParams("3.0.1", "27.0.0", 27)) + } } \ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiProjectSingleOutTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiProjectSingleOutTest.kt index 13c7c37e..9458528c 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiProjectSingleOutTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiProjectSingleOutTest.kt @@ -51,4 +51,7 @@ class MultiProjectSingleOutTest : AbstractDokkaGradleTest() { doTest("4.0", "1.1.2") } + @Test fun `test kotlin 1_2_20 and gradle 4_5`() { + doTest("4.5", "1.2.20") + } } \ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/RebuildAfterSourceChangeTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/RebuildAfterSourceChangeTest.kt index 42e79696..f712998c 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/RebuildAfterSourceChangeTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/RebuildAfterSourceChangeTest.kt @@ -66,4 +66,9 @@ class RebuildAfterSourceChangeTest : AbstractDokkaGradleTest() { fun `test kotlin 1_1_2 and gradle 4_0`() { doTest("4.0", "1.1.2") } + + @Test + fun `test kotlin 1_2_20 and gradle 4_5`() { + doTest("4.5", "1.2.20") + } } \ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle index 790f3132..d3dbae22 100644 --- a/runners/gradle-plugin/build.gradle +++ b/runners/gradle-plugin/build.gradle @@ -11,7 +11,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { freeCompilerArgs += "-Xjsr305=strict" languageVersion = "1.2" - apiVersion = "1.0" + apiVersion = "1.1" jvmTarget = "1.8" } } -- cgit From 7c80cf7ab7f578f4221597ff9fab1f688a85cc54 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 30 Jan 2018 22:33:19 +0300 Subject: Use kotlin-test-junit in gradle-integration-tests --- runners/gradle-integration-tests/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle index cb734db3..a681c82e 100644 --- a/runners/gradle-integration-tests/build.gradle +++ b/runners/gradle-integration-tests/build.gradle @@ -22,7 +22,7 @@ configurations { dependencies { testCompileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_for_gradle_runtime_version + testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_for_gradle_runtime_version testCompile ideaRT() dokkaPlugin project(path: ':runners:gradle-plugin', configuration: 'shadow') -- cgit From 6fa36fde9628685c274fd6af0aebc467e76c79e9 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 31 Jan 2018 00:49:52 +0300 Subject: Update jkid --- integration/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/build.gradle b/integration/build.gradle index 026cfbc0..24d59edf 100644 --- a/integration/build.gradle +++ b/integration/build.gradle @@ -20,7 +20,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { dependencies { compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version - compile('com.github.yole:jkid:7d9c529c87') { + compile('com.github.yole:jkid:8fc7f12e1a') { transitive = false } } \ No newline at end of file -- cgit From f1536cc86b9cedebb10664e63783eb45e60c4856 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 31 Jan 2018 14:35:28 +0300 Subject: Fix dependencies in Gradle 4.5 --- gradle/wrapper/gradle-wrapper.properties | 2 +- runners/gradle-plugin/src/main/kotlin/main.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 590f0e81..610ad4c5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt index 78bf4978..8c7f608e 100644 --- a/runners/gradle-plugin/src/main/kotlin/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/main.kt @@ -71,7 +71,7 @@ open class DokkaTask : DefaultTask() { description = "Generates dokka documentation for Kotlin" @Suppress("LeakingThis") - dependsOn(Callable { kotlinTasks.flatMap { it.dependsOn } }) + dependsOn(Callable { kotlinTasks.map { it.taskDependencies } }) } @Input -- cgit From a9230650654229443c1e4d0896188f887e43077d Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 1 Feb 2018 16:11:47 +0300 Subject: Fix publication POM for maven-plugin --- runners/maven-plugin/build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle index 0e8d6a4d..f3b9e79c 100644 --- a/runners/maven-plugin/build.gradle +++ b/runners/maven-plugin/build.gradle @@ -1,4 +1,5 @@ import groovy.io.FileType +import org.jetbrains.CorrectShadowPublishing import org.jetbrains.CrossPlatformExec import java.nio.file.Files @@ -92,14 +93,14 @@ apply plugin: 'maven-publish' publishing { publications { - dokkaMavenPlugin(MavenPublication) { publication -> + dokkaMavenPlugin(MavenPublication) { MavenPublication publication -> artifactId = 'dokka-maven-plugin' artifact sourceJar { classifier "sources" } - project.shadow.component(publication) + CorrectShadowPublishing.configure(publication, project) pom.withXml { Node root = asNode() -- cgit From 428a95b391cf313f8a57d3cd27a81665cf92cba6 Mon Sep 17 00:00:00 2001 From: Flamenco Date: Wed, 10 Jan 2018 17:41:07 -0500 Subject: Add information on suppress package option --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 158ce430..a50866bb 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,11 @@ dokka { reportUndocumented = true // Emit warnings about not documented members includeNonPublic = false } + // Suppress a package + packageOptions { + prefix = "kotlin.internal" // will match kotlin.internal and all sub-packages of it + suppress = true + } } ``` -- cgit From 5dd8433a27ad6e50f79b66709480be02696af57d Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Fri, 8 Dec 2017 16:54:57 +0000 Subject: Update plugin-publish-plugin Hiya, Tim from Gradle here. There was a [bug in versions prior to 0.9.7](https://discuss.gradle.org/t/plugin-authors-please-use-the-latest-plugin-publish-plugin-others-may-result-in-a-broken-upload/23573) of the gradle `plugin-publish-plugin`, where artifacts would sometimes silently not be pushed into the repo. Your plugin has not been affected by the bug yet, but you should still upgrade. This won't fix issue 146 (I'm not sure what has caused the pom differences seen in that issue), but it should avoid any problems publishing future versions --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0002ee69..f3e2cc52 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ allprojects { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' - classpath "com.gradle.publish:plugin-publish-plugin:0.9.6" + classpath "com.gradle.publish:plugin-publish-plugin:0.9.9" } } -- cgit From 9530cb367eb1ad92b6ca5aa5261e28f76e7d4bad Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 20 Feb 2018 00:11:30 +0300 Subject: Update publish-plugin and fix publishing --- build.gradle | 2 +- runners/android-gradle-plugin/build.gradle | 7 +++++++ runners/gradle-plugin/build.gradle | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f3e2cc52..ee76c9cb 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ allprojects { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' - classpath "com.gradle.publish:plugin-publish-plugin:0.9.9" + classpath "com.gradle.publish:plugin-publish-plugin:0.9.10" } } diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle index 7d286cc7..72d1be9e 100644 --- a/runners/android-gradle-plugin/build.gradle +++ b/runners/android-gradle-plugin/build.gradle @@ -1,3 +1,4 @@ +import com.gradle.publish.DependenciesBuilder import org.jetbrains.CorrectShadowPublishing apply plugin: 'java' @@ -87,6 +88,12 @@ pluginBundle { } } + withDependencies { List list -> + list.clear() + def builder = new DependenciesBuilder() + builder.addUniqueScopedDependencies(list, configurations.shadow, "compile") + } + mavenCoordinates { groupId = "org.jetbrains.dokka" artifactId = "dokka-android-gradle-plugin" diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle index d3dbae22..661d432b 100644 --- a/runners/gradle-plugin/build.gradle +++ b/runners/gradle-plugin/build.gradle @@ -1,3 +1,5 @@ +import com.gradle.publish.DependenciesBuilder + apply plugin: 'java' apply plugin: 'kotlin' @@ -84,6 +86,12 @@ pluginBundle { } } + withDependencies { List list -> + list.clear() + def builder = new DependenciesBuilder() + builder.addUniqueScopedDependencies(list, configurations.shadow, "compile") + } + mavenCoordinates { groupId = "org.jetbrains.dokka" artifactId = "dokka-gradle-plugin" -- cgit From 3eb23215edcd1cf92966f8d39afe754fef0c7a19 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 21 Feb 2018 11:51:06 +0300 Subject: Update bundled kotlin compiler --- build.gradle | 2 + core/build.gradle | 2 +- .../main/kotlin/Analysis/AnalysisEnvironment.kt | 53 ++++++++++++++++++++-- .../main/kotlin/Analysis/CoreKotlinCacheService.kt | 30 ++++++++++++ .../main/kotlin/Analysis/CoreProjectFileIndex.kt | 30 ++++++------ .../kotlin/Kotlin/DescriptorDocumentationParser.kt | 2 +- .../src/main/kotlin/Kotlin/DocumentationBuilder.kt | 10 ++++ gradle.properties | 4 +- 8 files changed, 111 insertions(+), 22 deletions(-) create mode 100644 core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt diff --git a/build.gradle b/build.gradle index ee76c9cb..f1748259 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ allprojects { def repo = { artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/[revision]/internal/[module](.[ext])") + artifactPattern("https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/[revision]/([module]_[ext]/)[module](.[ext])") } buildscript { @@ -70,6 +71,7 @@ task wrapper(type: Wrapper) { def versions = DependenciesVersionGetter.getVersions(project, bundled_kotlin_compiler_version) ext.ideaVersion = versions["idea.build.id"] +ext.markdownVersion = versions["markdown.build.id"].replace("%20", " ") configurations { ideaIC diff --git a/core/build.gradle b/core/build.gradle index a8f0f275..1a93bb48 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -29,7 +29,7 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version" compile "teamcity:kotlin-ide-common:$bundled_kotlin_compiler_version" - compile "teamcity:markdown:$bundled_kotlin_compiler_version" + compile "teamcity:markdown:$markdownVersion" compile intellijCoreAnalysis() diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt index 56249ac4..5522d4f0 100644 --- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt +++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka +import com.google.common.collect.ImmutableMap import com.intellij.core.CoreApplicationEnvironment import com.intellij.core.CoreModuleManager import com.intellij.mock.MockComponentManager @@ -17,6 +18,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.search.GlobalSearchScope import com.intellij.util.io.URLUtil import org.jetbrains.kotlin.analyzer.* +import org.jetbrains.kotlin.caches.resolve.KotlinCacheService import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles @@ -34,16 +36,19 @@ import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.platform.JvmBuiltIns -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.resolve.CompilerEnvironment +import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.lazy.ResolveSession +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice +import org.jetbrains.kotlin.util.slicedMap.WritableSlice import java.io.File /** @@ -158,7 +163,11 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { val resolverForModule = resolverForProject.resolverForModule(module) val moduleDescriptor = resolverForProject.descriptorForModule(module) builtIns.initialize(moduleDescriptor, true) - return DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule) + val created = DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule) + val projectComponentManager = environment.project as MockComponentManager + projectComponentManager.registerService(KotlinCacheService::class.java, CoreKotlinCacheService(created)) + + return created } fun loadLanguageVersionSettings(languageVersionString: String?, apiVersionString: String?) { @@ -247,6 +256,42 @@ class DokkaResolutionFacade(override val project: Project, val resolveSession: ResolveSession get() = getFrontendService(ResolveSession::class.java) override fun analyze(element: KtElement, bodyResolveMode: BodyResolveMode): BindingContext { + if (element is KtDeclaration) { + val descriptor = resolveToDescriptor(element) + return object : BindingContext { + override fun getKeys(p0: WritableSlice?): Collection { + throw UnsupportedOperationException() + } + + override fun getType(p0: KtExpression): KotlinType? { + throw UnsupportedOperationException() + } + + override fun get(slice: ReadOnlySlice?, key: K): V? { + if (key != element) { + throw UnsupportedOperationException() + } + return when { + slice == BindingContext.DECLARATION_TO_DESCRIPTOR -> descriptor as V + slice == BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER && (element as KtParameter).hasValOrVar() -> descriptor as V + else -> null + } + } + + override fun getDiagnostics(): Diagnostics { + throw UnsupportedOperationException() + } + + override fun addOwnDataTo(p0: BindingTrace, p1: Boolean) { + throw UnsupportedOperationException() + } + + override fun getSliceContents(p0: ReadOnlySlice): ImmutableMap { + throw UnsupportedOperationException() + } + + } + } throw UnsupportedOperationException() } diff --git a/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt b/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt new file mode 100644 index 00000000..31b8ffc7 --- /dev/null +++ b/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt @@ -0,0 +1,30 @@ +package org.jetbrains.dokka + +import com.intellij.psi.PsiFile +import org.jetbrains.kotlin.analyzer.ModuleInfo +import org.jetbrains.kotlin.caches.resolve.KotlinCacheService +import org.jetbrains.kotlin.idea.resolve.ResolutionFacade +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.resolve.TargetPlatform +import org.jetbrains.kotlin.resolve.diagnostics.KotlinSuppressCache + + +class CoreKotlinCacheService(private val resolutionFacade: DokkaResolutionFacade) : KotlinCacheService { + override fun getResolutionFacade(elements: List): ResolutionFacade { + return resolutionFacade + } + + override fun getResolutionFacadeByFile(file: PsiFile, platform: TargetPlatform): ResolutionFacade { + return resolutionFacade + } + + override fun getResolutionFacadeByModuleInfo(moduleInfo: ModuleInfo, platform: TargetPlatform): ResolutionFacade? { + return resolutionFacade + } + + override fun getSuppressionCache(): KotlinSuppressCache { + throw UnsupportedOperationException() + } + +} + diff --git a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt index 2f2f94b3..4f6a7c76 100644 --- a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt +++ b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt @@ -228,24 +228,26 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List { + override fun getFiles(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getPresentableName(): String { + override fun getUrls(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getUrls(p0: OrderRootType?): Array { + override fun accept(p0: RootPolicy, p1: R?): R { throw UnsupportedOperationException() } - override fun getOwnerModule(): Module = module - override fun accept(p0: RootPolicy?, p1: R?): R { + override fun getPresentableName(): String { throw UnsupportedOperationException() } + override fun getOwnerModule(): Module = module + + override fun isValid(): Boolean { throw UnsupportedOperationException() } @@ -262,29 +264,29 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List { throw UnsupportedOperationException() } - override fun getJdk(): Sdk = sdk - - override fun getFiles(p0: OrderRootType?): Array { + override fun getUrls(p0: OrderRootType): Array { throw UnsupportedOperationException() } - override fun getPresentableName(): String { + override fun accept(p0: RootPolicy, p1: R?): R { throw UnsupportedOperationException() } - override fun getUrls(p0: OrderRootType?): Array { + override fun getJdkName(): String? { throw UnsupportedOperationException() } - override fun getOwnerModule(): Module { + override fun getJdk(): Sdk = sdk + + override fun getPresentableName(): String { throw UnsupportedOperationException() } - override fun accept(p0: RootPolicy?, p1: R?): R { + override fun getOwnerModule(): Module { throw UnsupportedOperationException() } @@ -358,7 +360,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List getModuleExtension(p0: Class?): T { + override fun getModuleExtension(p0: Class): T { throw UnsupportedOperationException() } diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt index eb8c12d0..f2d9d3a7 100644 --- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt +++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt @@ -81,7 +81,7 @@ class DescriptorDocumentationParser val suppressAnnotation = annotations.findAnnotation(FqName(Suppress::class.qualifiedName!!)) return if (suppressAnnotation != null) { @Suppress("UNCHECKED_CAST") - (suppressAnnotation.argumentValue("names") as List).any { it.value == "NOT_DOCUMENTED" } + (suppressAnnotation.argumentValue("names")?.value as List).any { it.value == "NOT_DOCUMENTED" } } else containingDeclaration?.isSuppressWarning() ?: false } diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 61bf50d6..916f89c9 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -15,7 +15,9 @@ import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl +import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtModifierListOwner import org.jetbrains.kotlin.psi.KtParameter import org.jetbrains.kotlin.resolve.DescriptorUtils @@ -779,6 +781,14 @@ class DocumentationBuilder "\"" + StringUtil.escapeStringCharacters(value) + "\"" is EnumEntrySyntheticClassDescriptor -> value.containingDeclaration.name.asString() + "." + value.name.asString() + is Pair<*, *> -> { + val (classId, name) = value + if (classId is ClassId && name is Name) { + classId.shortClassName.asString() + "." + name.asString() + } else { + value.toString() + } + } else -> value.toString() }.let { valueString -> DocumentationNode(valueString, Content.Empty, NodeKind.Value) diff --git a/gradle.properties b/gradle.properties index 4a6475b1..cabae269 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ dokka_version=0.9.16 dokka_publication_channel=dokka #Kotlin compiler and plugin -bundled_kotlin_compiler_version=1.2.20-dev-419 -kotlin_version=1.2.0 +bundled_kotlin_compiler_version=1.2.40-dev-529 +kotlin_version=1.2.21 kotlin_for_gradle_runtime_version=1.1.60 ant_version=1.9.6 -- cgit From 0a09b1bffb45eceb3f53296207b8b03715cc345b Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 22 Feb 2018 15:46:18 +0300 Subject: Bump version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cabae269..0e98fc46 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -dokka_version=0.9.16 +dokka_version=0.9.17-SNAPSHOT dokka_publication_channel=dokka #Kotlin compiler and plugin -- cgit From 8db3b40a0e82ff0847d078cf496dfd6edc1464a5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 7 Mar 2018 22:42:55 +0300 Subject: Bind language service back --- core/src/main/kotlin/Formats/FormatDescriptor.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/kotlin/Formats/FormatDescriptor.kt b/core/src/main/kotlin/Formats/FormatDescriptor.kt index a1120c00..b497fb0f 100644 --- a/core/src/main/kotlin/Formats/FormatDescriptor.kt +++ b/core/src/main/kotlin/Formats/FormatDescriptor.kt @@ -26,6 +26,7 @@ abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor { bind() toType NodeLocationAwareGenerator::class bind() toType generatorServiceClass + bind() toType languageServiceClass lazyBind() toOptional (outlineServiceClass) lazyBind() toOptional formatServiceClass @@ -36,4 +37,6 @@ abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor { abstract val outlineServiceClass: KClass? abstract val generatorServiceClass: KClass abstract val packageListServiceClass: KClass? + + open val languageServiceClass: KClass = KotlinLanguageService::class } \ No newline at end of file -- cgit From b9f4b81092b492c1519f9d16fb7511b78d20d17d Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 7 Mar 2018 18:39:07 +0300 Subject: Fix early configuration resolving in Gradle Plugin Fixes #282 --- .../dokka/gradle/AndroidLibDependsOnJavaLibTest.kt | 50 ++++++++++++++++++++++ .../androidLibDependsOnJavaLib/build.gradle | 20 +++++++++ .../androidLibDependsOnJavaLib/fileTree.txt | 14 ++++++ .../androidLibDependsOnJavaLib/jlib/build.gradle | 1 + .../jlib/src/main/java/example/jlib/LibClz.java | 5 +++ .../androidLibDependsOnJavaLib/lib/build.gradle | 39 +++++++++++++++++ .../lib/src/main/AndroidManifest.xml | 4 ++ .../lib/src/main/kotlin/example/LibClzUse.kt | 13 ++++++ .../androidLibDependsOnJavaLib/package-list | 1 + .../androidLibDependsOnJavaLib/settings.gradle | 5 +++ runners/gradle-plugin/src/main/kotlin/main.kt | 33 ++++++++------ 11 files changed, 173 insertions(+), 12 deletions(-) create mode 100644 runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/build.gradle create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/fileTree.txt create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/build.gradle create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/src/main/java/example/jlib/LibClz.java create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/AndroidManifest.xml create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/kotlin/example/LibClzUse.kt create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/package-list create mode 100644 runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/settings.gradle diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt new file mode 100644 index 00000000..2a4ce712 --- /dev/null +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt @@ -0,0 +1,50 @@ +package org.jetbrains.dokka.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.Test +import java.nio.file.Path +import java.nio.file.Paths +import kotlin.test.assertEquals + +class AndroidLibDependsOnJavaLibTest: AbstractDokkaAndroidGradleTest() { + + private val testDataRootPath = "androidLibDependsOnJavaLib" + + private fun prepareTestData() { + val testDataRoot = testDataFolder.resolve(testDataRootPath) + val tmpRoot = testProjectDir.root.toPath() + + testDataRoot.copy(tmpRoot) + + androidLocalProperties?.copy(tmpRoot.resolve("local.properties")) + } + + + private fun doTest(gradleVersion: String, kotlinVersion: String, androidPluginParams: AbstractAndroidAppTest.AndroidPluginParams) { + prepareTestData() + + val result = configure(gradleVersion, kotlinVersion, + arguments = arrayOf("dokka", "--stacktrace") + androidPluginParams.asArguments()) + .build() + + println(result.output) + + assertEquals(TaskOutcome.SUCCESS, result.task(":lib:dokka")?.outcome) + + val docsOutput = "lib/build/dokka" + + checkOutputStructure("$testDataRootPath/fileTree.txt", docsOutput) + + checkNoErrorClasses(docsOutput) + checkNoUnresolvedLinks(docsOutput) + + checkExternalLink(docsOutput, "LibClz", + """LibClz""") + } + + + @Test + fun `test kotlin 1_2_20 and gradle 4_5 and abt 3_0_1`() { + doTest("4.5", "1.2.20", AbstractAndroidAppTest.AndroidPluginParams("3.0.1", "27.0.0", 27)) + } +} \ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/build.gradle b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/build.gradle new file mode 100644 index 00000000..736668ab --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/build.gradle @@ -0,0 +1,20 @@ +subprojects { + buildscript { + repositories { + mavenCentral() + jcenter() + maven { url 'https://maven.google.com' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } + } + + } + + repositories { + mavenCentral() + jcenter() + maven { url 'https://maven.google.com' } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } + } +} \ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/fileTree.txt b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/fileTree.txt new file mode 100644 index 00000000..6c96a01c --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/fileTree.txt @@ -0,0 +1,14 @@ +/ + lib/ + alltypes/ + index.html + example/ + -lib-clz-use/ + -init-.html + f.html + index.html + index.html + index-outline.html + index.html + package-list + style.css diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/build.gradle b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/build.gradle new file mode 100644 index 00000000..bbfeb03c --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/build.gradle @@ -0,0 +1 @@ +apply plugin: 'java' diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/src/main/java/example/jlib/LibClz.java b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/src/main/java/example/jlib/LibClz.java new file mode 100644 index 00000000..1d9a6fb2 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/src/main/java/example/jlib/LibClz.java @@ -0,0 +1,5 @@ +package example.jlib; + +public class LibClz { + +} \ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle new file mode 100644 index 00000000..0f27d365 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle @@ -0,0 +1,39 @@ +buildscript { + dependencies { + classpath "com.android.tools.build:gradle:$abt_plugin_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$test_kotlin_version" + } +} + + +plugins { + id 'org.jetbrains.dokka-android' +} + + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'org.jetbrains.dokka-android' + + +android { + compileSdkVersion Integer.parseInt(sdk_version) + buildToolsVersion abt_version + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } +} + +dependencies { + api(project(":jlib")) +} + +dokka { + dokkaFatJar = new File(dokka_fatjar) + + externalDocumentationLink { + url = new URL("https://example.com") + packageListUrl = file("$rootDir/package-list").toURI().toURL() + } +} \ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/AndroidManifest.xml b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/AndroidManifest.xml new file mode 100644 index 00000000..267f6efd --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/kotlin/example/LibClzUse.kt b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/kotlin/example/LibClzUse.kt new file mode 100644 index 00000000..d034a3a9 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/kotlin/example/LibClzUse.kt @@ -0,0 +1,13 @@ +package example + +import example.jlib.LibClz + +/** + * Uses jlib + */ +class LibClzUse { + /** + * Returns LibClz + */ + fun f(): LibClz = LibClz() +} \ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/package-list b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/package-list new file mode 100644 index 00000000..bf76058e --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/package-list @@ -0,0 +1 @@ +example.jlib \ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/settings.gradle b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/settings.gradle new file mode 100644 index 00000000..5b4250a0 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = "androidLibDependsOnJavaLib" + + +include(":lib") +include(":jlib") \ No newline at end of file diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt index 8c7f608e..5f02cd0e 100644 --- a/runners/gradle-plugin/src/main/kotlin/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/main.kt @@ -10,6 +10,7 @@ import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.tasks.* import org.gradle.api.tasks.Optional +import org.gradle.api.tasks.compile.AbstractCompile import org.jetbrains.dokka.* import org.jetbrains.dokka.ReflectDsl.isNotInstance import org.jetbrains.dokka.gradle.ClassloaderContainer.fatJarClassLoader @@ -133,7 +134,7 @@ open class DokkaTask : DefaultTask() { @Optional @Input var apiVersion: String? = null - @get:Input + @get:Internal internal val kotlinCompileBasedClasspathAndSourceRoots: ClasspathAndSourceRoots by lazy { extractClasspathAndSourceRootsFromKotlinTasks() } @@ -201,7 +202,7 @@ open class DokkaTask : DefaultTask() { } } - internal data class ClasspathAndSourceRoots(val classpath: List, val sourceRoots: List) : Serializable + internal data class ClasspathAndSourceRoots(val classpathFileCollection: FileCollection, val sourceRoots: List) : Serializable private fun extractKotlinCompileTasks(): List { val inputList = (kotlinTasksConfigurator.invoke() ?: emptyList()).filterNotNull() @@ -228,6 +229,7 @@ open class DokkaTask : DefaultTask() { val allTasks = kotlinTasks val allClasspath = mutableSetOf() + var allClasspathFileCollection: FileCollection = project.files() val allSourceRoots = mutableSetOf() allTasks.forEach { @@ -239,15 +241,20 @@ open class DokkaTask : DefaultTask() { val abstractKotlinCompileClz = getAbstractKotlinCompileFor(it)!! val taskClasspath: Iterable = - (it["compileClasspath", abstractKotlinCompileClz].takeIfIsProp()?.v() ?: - it["getClasspath", abstractKotlinCompileClz]()) - - allClasspath += taskClasspath.filter { it.exists() } + (it["getClasspath", AbstractCompile::class].takeIfIsFunc()?.invoke() + ?: it["compileClasspath", abstractKotlinCompileClz].takeIfIsProp()?.v() + ?: it["getClasspath", abstractKotlinCompileClz]()) + + if (taskClasspath is FileCollection) { + allClasspathFileCollection += taskClasspath + } else { + allClasspath += taskClasspath + } allSourceRoots += taskSourceRoots.filter { it.exists() } } } - return ClasspathAndSourceRoots(allClasspath.toList(), allSourceRoots.toList()) + return ClasspathAndSourceRoots(allClasspathFileCollection + project.files(allClasspath), allSourceRoots.toList()) } private fun Iterable.toSourceRoots(): List = this.filter { it.exists() }.map { SourceRoot().apply { path = it.path } } @@ -351,15 +358,17 @@ open class DokkaTask : DefaultTask() { } + @Classpath + fun getInputClasspath(): FileCollection { + val (classpathFileCollection) = extractClasspathAndSourceRootsFromKotlinTasks() + return project.files(collectClasspathFromOldSources() + classpath) + classpathFileCollection + } + @InputFiles fun getInputFiles(): FileCollection { - val (tasksClasspath, tasksSourceRoots) = extractClasspathAndSourceRootsFromKotlinTasks() - - val fullClasspath = collectClasspathFromOldSources() + tasksClasspath + classpath - + val (_, tasksSourceRoots) = extractClasspathAndSourceRootsFromKotlinTasks() return project.files(tasksSourceRoots.map { project.fileTree(it) }) + project.files(collectSourceRoots().map { project.fileTree(File(it.path)) }) + - project.files(fullClasspath.map { project.fileTree(it) }) + project.files(includes) + project.files(samples.filterNotNull().map { project.fileTree(it) }) } -- cgit From d6ba6677cff2de399b8231127325af2cea210b50 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 22 Mar 2018 23:12:56 +0300 Subject: Fix external references to Java enum entries Fix #274 --- core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt | 5 ++++- core/src/test/kotlin/format/MarkdownFormatTest.kt | 5 +++++ core/testdata/format/enumRef.kt | 4 ++++ core/testdata/format/enumRef.md | 8 ++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 core/testdata/format/enumRef.kt create mode 100644 core/testdata/format/enumRef.md diff --git a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt index 108cee78..ebea7183 100644 --- a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt +++ b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt @@ -5,6 +5,7 @@ import com.google.inject.Singleton import com.intellij.psi.PsiMethod import com.intellij.util.io.* import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.impl.EnumEntrySyntheticClassDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor @@ -178,7 +179,9 @@ interface InboundExternalLinkResolutionService { class Javadoc : InboundExternalLinkResolutionService { override fun getPath(symbol: DeclarationDescriptor): String? { - if (symbol is JavaClassDescriptor) { + if (symbol is EnumEntrySyntheticClassDescriptor) { + return getPath(symbol.containingDeclaration)?.let { it + "#" + symbol.name.asString() } + } else if (symbol is JavaClassDescriptor) { return DescriptorUtils.getFqName(symbol).asString().replace(".", "/") + ".html" } else if (symbol is JavaCallableMemberDescriptor) { val containingClass = symbol.containingDeclaration as? JavaClassDescriptor ?: return null diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index f60969fc..f06f0e64 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -419,6 +419,11 @@ class MarkdownFormatTest: FileGeneratorTestCase() { verifyMarkdownNodeByName("companionImplements", "Foo") } + @Test fun enumRef() { + verifyMarkdownNode("enumRef") + } + + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") val options = DocumentationOptions( diff --git a/core/testdata/format/enumRef.kt b/core/testdata/format/enumRef.kt new file mode 100644 index 00000000..5c0b2de9 --- /dev/null +++ b/core/testdata/format/enumRef.kt @@ -0,0 +1,4 @@ +/** + * [java.math.RoundingMode.UP] + */ +fun f() {} \ No newline at end of file diff --git a/core/testdata/format/enumRef.md b/core/testdata/format/enumRef.md new file mode 100644 index 00000000..8b2a6650 --- /dev/null +++ b/core/testdata/format/enumRef.md @@ -0,0 +1,8 @@ +[test](index.md) / [f](./f.md) + +# f + +`fun f(): Unit` + +[java.math.RoundingMode.UP](http://docs.oracle.com/javase/6/docs/api/java/math/RoundingMode.html#UP) + -- cgit From 5eeab3e8c96b6e03435025f9adae38c7e9e3edab Mon Sep 17 00:00:00 2001 From: Håvard Kindem Date: Mon, 7 May 2018 10:46:00 +0200 Subject: Fix ClassCastException when generating JavaDoc Fixes #287 --- core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 916f89c9..17e4bc1a 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -887,7 +887,7 @@ fun DeclarationDescriptor.isDocumentationSuppressed(options: DocumentationOption } fun DeclarationDescriptor.sourcePsi() = - ((original as DeclarationDescriptorWithSource).source as? PsiSourceElement)?.psi + ((original as? DeclarationDescriptorWithSource)?.source as? PsiSourceElement)?.psi fun DeclarationDescriptor.isDeprecated(): Boolean = annotations.any { DescriptorUtils.getFqName(it.type.constructor.declarationDescriptor!!).asString() == "kotlin.Deprecated" -- cgit From 02039d818ca8c508908641e01fa480674276a785 Mon Sep 17 00:00:00 2001 From: Lukas Niemeier Date: Wed, 28 Mar 2018 23:57:34 +0200 Subject: Avoid unnecessary logging. --- core/src/main/kotlin/javadoc/dokka-adapters.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/kotlin/javadoc/dokka-adapters.kt b/core/src/main/kotlin/javadoc/dokka-adapters.kt index 4676db18..483fb3cd 100644 --- a/core/src/main/kotlin/javadoc/dokka-adapters.kt +++ b/core/src/main/kotlin/javadoc/dokka-adapters.kt @@ -13,7 +13,6 @@ class JavadocGenerator @Inject constructor(val options: DocumentationOptions, va override fun buildPages(nodes: Iterable) { val module = nodes.single() as DocumentationModule - DokkaConsoleLogger.report() HtmlDoclet.start(ModuleNodeAdapter(module, StandardReporter(logger), options.outputDir)) } -- cgit From 7eb623f6f79f1d93d094cbb75ff057f0c0958f87 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 16 May 2018 16:38:59 +0300 Subject: Fix lookup of tools.jar in Maven runner Fix #272 --- runners/maven-plugin/build.gradle | 51 +-------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle index f3b9e79c..79a8c22b 100644 --- a/runners/maven-plugin/build.gradle +++ b/runners/maven-plugin/build.gradle @@ -28,6 +28,7 @@ dependencies { shadow "org.codehaus.plexus:plexus-utils:$plexus_utils_version" shadow "org.codehaus.plexus:plexus-archiver:$plexus_archiver_version" shadow "org.apache.maven.plugin-tools:maven-plugin-annotations:$maven_plugin_tools_version" + shadow "com.github.olivergondza:maven-jdk-tools-wrapper:0.1" } task generatePom() { @@ -101,56 +102,6 @@ publishing { } CorrectShadowPublishing.configure(publication, project) - - pom.withXml { - Node root = asNode() - - def dependency = new XmlParser().parseText(''' - - com.sun - tools - 1.8.0 - system - ${toolsjar} - - ''') - - root.children().find { - return it.name() == "dependencies" - }.append(dependency) - - def profiles = new XmlParser().parseText(''' - - - default-profile - - true - - ${java.home}/../lib/tools.jar - - - - ${java.home}/../lib/tools.jar - - - - mac-profile - - false - - ${java.home}/../Classes/classes.jar - - - - ${java.home}/../Classes/classes.jar - - - - ''') - root.append(profiles) - } - - } } } -- cgit From b3fa0d91fd466c3319f3a37a1cc5e82be2b89697 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 16 May 2018 18:06:56 +0300 Subject: Fix link resolution context for inherited docs Fix #229 --- .../kotlin/Kotlin/DescriptorDocumentationParser.kt | 18 ++++++++++++++---- core/src/test/kotlin/format/MarkdownFormatTest.kt | 16 ++++++++++++++++ core/testdata/format/inheritedLink.1.kt | 10 ++++++++++ core/testdata/format/inheritedLink.kt | 11 +++++++++++ core/testdata/format/inheritedLink.md | 17 +++++++++++++++++ 5 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 core/testdata/format/inheritedLink.1.kt create mode 100644 core/testdata/format/inheritedLink.kt create mode 100644 core/testdata/format/inheritedLink.md diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt index f2d9d3a7..6e44df74 100644 --- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt +++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt @@ -8,14 +8,17 @@ import org.intellij.markdown.parser.LinkMap import org.jetbrains.dokka.* import org.jetbrains.dokka.Samples.SampleProcessingService import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.kdoc.findKDoc import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.kdoc.parser.KDocKnownTag +import org.jetbrains.kotlin.kdoc.psi.api.KDoc import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection import org.jetbrains.kotlin.kdoc.psi.impl.KDocTag import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.annotations.argumentValue import org.jetbrains.kotlin.resolve.constants.StringValue @@ -49,6 +52,13 @@ class DescriptorDocumentationParser } return Content.Empty to { node -> } } + + val contextDescriptor = + (PsiTreeUtil.getParentOfType(kdoc, KDoc::class.java)?.context as? KtDeclaration) + ?.takeIf { it != descriptor.original.sourcePsi() } + ?.resolveToDescriptorIfAny() + ?: descriptor + var kdocText = kdoc.getContent() // workaround for code fence parsing problem in IJ markdown parser if (kdocText.endsWith("```") || kdocText.endsWith("~~~")) { @@ -56,20 +66,20 @@ class DescriptorDocumentationParser } val tree = parseMarkdown(kdocText) val linkMap = LinkMap.buildLinkMap(tree.node, kdocText) - val content = buildContent(tree, LinkResolver(linkMap, { href -> linkResolver.resolveContentLink(descriptor, href) }), inline) + val content = buildContent(tree, LinkResolver(linkMap, { href -> linkResolver.resolveContentLink(contextDescriptor, href) }), inline) if (kdoc is KDocSection) { val tags = kdoc.getTags() tags.forEach { when (it.knownTag) { KDocKnownTag.SAMPLE -> - content.append(sampleService.resolveSample(descriptor, it.getSubjectName(), it)) + content.append(sampleService.resolveSample(contextDescriptor, it.getSubjectName(), it)) KDocKnownTag.SEE -> - content.addTagToSeeAlso(descriptor, it) + content.addTagToSeeAlso(contextDescriptor, it) else -> { val section = content.addSection(javadocSectionDisplayName(it.name), it.getSubjectName()) val sectionContent = it.getContent() val markdownNode = parseMarkdown(sectionContent) - buildInlineContentTo(markdownNode, section, LinkResolver(linkMap, { href -> linkResolver.resolveContentLink(descriptor, href) })) + buildInlineContentTo(markdownNode, section, LinkResolver(linkMap, { href -> linkResolver.resolveContentLink(contextDescriptor, href) })) } } } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index f06f0e64..9e4c831d 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -423,6 +423,22 @@ class MarkdownFormatTest: FileGeneratorTestCase() { verifyMarkdownNode("enumRef") } + @Test fun inheritedLink() { + val filePath = "testdata/format/inheritedLink" + verifyOutput( + arrayOf( + contentRootFromPath("$filePath.kt"), + contentRootFromPath("$filePath.1.kt") + ), + ".md", + withJdk = true, + withKotlinRuntime = true, + includeNonPublic = false + ) { model, output -> + buildPagesAndReadInto(model.members.single { it.name == "p2" }.members.single().members, output) + } + } + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") diff --git a/core/testdata/format/inheritedLink.1.kt b/core/testdata/format/inheritedLink.1.kt new file mode 100644 index 00000000..29cc12b4 --- /dev/null +++ b/core/testdata/format/inheritedLink.1.kt @@ -0,0 +1,10 @@ +package p1 + +import java.util.LinkedList + +interface Foo { + + /** Says hello - [LinkedList]. */ + fun sayHello() : String + +} \ No newline at end of file diff --git a/core/testdata/format/inheritedLink.kt b/core/testdata/format/inheritedLink.kt new file mode 100644 index 00000000..86b8f4e2 --- /dev/null +++ b/core/testdata/format/inheritedLink.kt @@ -0,0 +1,11 @@ +package p2 + +import p1.Foo + +class FooBar : Foo { + + override fun sayHello(): String { + return "Hello!" + } + +} \ No newline at end of file diff --git a/core/testdata/format/inheritedLink.md b/core/testdata/format/inheritedLink.md new file mode 100644 index 00000000..e5af326c --- /dev/null +++ b/core/testdata/format/inheritedLink.md @@ -0,0 +1,17 @@ + +[test](../../index.md) / [p2](../index.md) / [FooBar](index.md) / [<init>](./-init-.md) + +# <init> + +`FooBar()` + +[test](../../index.md) / [p2](../index.md) / [FooBar](index.md) / [sayHello](./say-hello.md) + +# sayHello + +`fun sayHello(): String` + +Overrides [Foo.sayHello](../../p1/-foo/say-hello.md) + +Says hello - [LinkedList](http://docs.oracle.com/javase/6/docs/api/java/util/LinkedList.html). + -- cgit From ad95537c3f2eb5ba1478f82fd5b476d2309bc986 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 16 May 2018 18:46:07 +0300 Subject: Fix external links to packages with uppercase letters in dokka mode Fix #285 --- .../main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt index ebea7183..e19ecf76 100644 --- a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt +++ b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt @@ -214,13 +214,11 @@ interface InboundExternalLinkResolutionService { else return "$path/index.$extension" } - fun getPathWithoutExtension(symbol: DeclarationDescriptor): String { - if (symbol.containingDeclaration == null) - return identifierToFilename(symbol.name.asString()) - else if (symbol is PackageFragmentDescriptor) { - return symbol.fqName.asString() - } else { - return getPathWithoutExtension(symbol.containingDeclaration!!) + '/' + identifierToFilename(symbol.name.asString()) + private fun getPathWithoutExtension(symbol: DeclarationDescriptor): String { + return when { + symbol.containingDeclaration == null -> identifierToFilename(symbol.name.asString()) + symbol is PackageFragmentDescriptor -> identifierToFilename(symbol.fqName.asString()) + else -> getPathWithoutExtension(symbol.containingDeclaration!!) + '/' + identifierToFilename(symbol.name.asString()) } } -- cgit From 9865da2e6e6c038ab6c719a6a03bb09184542d20 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 17 May 2018 19:48:44 +0300 Subject: Fix incorrect link to stylesheet in html format --- core/src/main/kotlin/Formats/HtmlFormatService.kt | 5 ++--- core/src/main/kotlin/Generation/FileGenerator.kt | 4 +--- core/src/main/kotlin/Locations/Location.kt | 6 +++--- core/src/test/kotlin/format/FileGeneratorTestCase.kt | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index 0073553c..0ad946be 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -4,7 +4,6 @@ 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 open class HtmlOutputBuilder(to: StringBuilder, location: Location, @@ -80,7 +79,7 @@ open class HtmlOutputBuilder(to: StringBuilder, } override fun appendNodes(nodes: Iterable) { - templateService.appendHeader(to, getPageTitle(nodes), generator.relativeToRoot(location)) + templateService.appendHeader(to, getPageTitle(nodes), generator.relativePathToRoot(location)) super.appendNodes(nodes) templateService.appendFooter(to) } @@ -108,7 +107,7 @@ open class HtmlFormatService @Inject constructor(generator: NodeLocationAwareGen HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService) override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable) { - templateService.appendHeader(to, "Module Contents", generator.relativeToRoot(location)) + templateService.appendHeader(to, "Module Contents", generator.relativePathToRoot(location)) super.appendOutline(location, to, nodes) templateService.appendFooter(to) } diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index bc08e180..b7c6cf63 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -8,15 +8,13 @@ import java.io.FileOutputStream import java.io.IOException import java.io.OutputStreamWriter -class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) : NodeLocationAwareGenerator { +class FileGenerator @Inject constructor(@Named("outputDir") override val root: File) : NodeLocationAwareGenerator { @set:Inject(optional = true) var outlineService: OutlineFormatService? = null @set:Inject(optional = true) lateinit var formatService: FormatService @set:Inject(optional = true) lateinit var options: DocumentationOptions @set:Inject(optional = true) var packageListService: PackageListService? = null - override val root: File = rootFile - override fun location(node: DocumentationNode): FileLocation { return FileLocation(fileForNode(node, formatService.linkExtension)) } diff --git a/core/src/main/kotlin/Locations/Location.kt b/core/src/main/kotlin/Locations/Location.kt index 0e6572d9..4cb0ac39 100644 --- a/core/src/main/kotlin/Locations/Location.kt +++ b/core/src/main/kotlin/Locations/Location.kt @@ -53,9 +53,9 @@ fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, return location(owner).relativePathTo(location(node), null) } -fun NodeLocationAwareGenerator.relativeToRoot(from: Location): File { - val file = File(from.path) - return file.relativeTo(root) +fun NodeLocationAwareGenerator.relativePathToRoot(from: Location): File { + val file = File(from.path).parentFile + return root.relativeTo(file) } fun File.toUnixString() = toString().replace(File.separatorChar, '/') diff --git a/core/src/test/kotlin/format/FileGeneratorTestCase.kt b/core/src/test/kotlin/format/FileGeneratorTestCase.kt index 948426ea..ef9e815d 100644 --- a/core/src/test/kotlin/format/FileGeneratorTestCase.kt +++ b/core/src/test/kotlin/format/FileGeneratorTestCase.kt @@ -27,7 +27,7 @@ abstract class FileGeneratorTestCase { if (sb.isNotBlank() && !sb.endsWith('\n')) { sb.appendln() } - sb.appendln("") + sb.appendln("") } sb.append(loc.file.readText()) } -- cgit From ab3621abcc468cead0206d3c45f200f6c9ea10b9 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 18 May 2018 12:45:49 +0300 Subject: Enable suppression of generated files for Android plugin 3.2.0-alpha Fix #308 --- core/src/main/kotlin/DokkaBootstrapImpl.kt | 2 +- core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 2 +- runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index 126a0175..aeaca8be 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -69,7 +69,7 @@ class DokkaBootstrapImpl : DokkaBootstrap { languageVersion, apiVersion, cacheRoot, - suppressedFiles.map { File(it) } + suppressedFiles.map { File(it) }.toSet() ) ) } diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 17e4bc1a..7b50fff5 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -53,7 +53,7 @@ class DocumentationOptions(val outputDir: String, val languageVersion: String?, val apiVersion: String?, cacheRoot: String? = null, - val suppressedFiles: List = emptyList()) { + val suppressedFiles: Set = emptySet()) { init { if (perPackageOptions.any { it.prefix == "" }) throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead") diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt index f2261120..bd2e88c2 100644 --- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt +++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt @@ -23,8 +23,12 @@ open class DokkaAndroidTask : DokkaTask() { @Input var noAndroidSdkLink: Boolean = false override fun collectSuppressedFiles(sourceRoots: List): List { - val generatedSubpath = "${project.buildDir}/generated/source".replace("/", File.separator) - return sourceRoots.filter { generatedSubpath in it.path }.flatMap { File(it.path).walk().toList() }.map { it.absolutePath } + val generatedRoot = project.buildDir.resolve("generated").absoluteFile + return sourceRoots + .map { File(it.path) } + .filter { it.startsWith(generatedRoot) } + .flatMap { it.walk().toList() } + .map { it.absolutePath } } init { -- cgit From e94df7be47eef5b8305c291037a6b15852647eb8 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 21 May 2018 16:13:28 +0300 Subject: Flush .idea/*.xml changes --- .idea/codeStyles/Project.xml | 24 +++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++ .idea/compiler.xml | 13 ++++---- .idea/inspectionProfiles/Project_Default.xml | 7 +--- .idea/kotlinc.xml | 6 +++- .idea/misc.xml | 10 +++--- .idea/runConfigurations/All_tests.xml | 4 +-- .idea/runConfigurations/Core_tests.xml | 39 ++++++++++------------ .idea/runConfigurations/Dokka.xml | 4 +-- .../runConfigurations/Gradle_integration_tests.xml | 39 ++++++++++------------ .idea/runConfigurations/Playground.xml | 9 +++++ 11 files changed, 94 insertions(+), 66 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/runConfigurations/Playground.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..ba49a93e --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 56269ff5..9700d3cc 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -22,14 +22,14 @@ - - + + - - - - + + + + @@ -38,7 +38,6 @@ - diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 710a3bbe..06bda8c9 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,12 +1,7 @@ - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 1c24f9a8..b072dc00 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,7 +1,11 @@ + + - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9ec5f45a..537aa8e4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,10 +5,12 @@ - - + - + + + + @@ -23,7 +25,7 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations/All_tests.xml b/.idea/runConfigurations/All_tests.xml index d0d60ec9..dffc1e09 100644 --- a/.idea/runConfigurations/All_tests.xml +++ b/.idea/runConfigurations/All_tests.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/.idea/runConfigurations/Core_tests.xml b/.idea/runConfigurations/Core_tests.xml index 6f76e23f..50476737 100644 --- a/.idea/runConfigurations/Core_tests.xml +++ b/.idea/runConfigurations/Core_tests.xml @@ -1,26 +1,21 @@ - - - - - - - - - + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Dokka.xml b/.idea/runConfigurations/Dokka.xml index a77f9eb3..1f7da97f 100644 --- a/.idea/runConfigurations/Dokka.xml +++ b/.idea/runConfigurations/Dokka.xml @@ -1,9 +1,9 @@ - +
", block) + else + block() + } } class KotlinWebsiteHtmlFormatService @Inject constructor( diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index b57f21be..53172563 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -83,6 +83,10 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } + open fun appendAsBlockWithPlatforms(platforms: Set, block: () -> Unit) { + block() + } + open fun appendSymbol(text: String) { appendText(text) } @@ -465,6 +469,18 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, platformsToShow + protected fun mergeVersions(otherKotlinVersion: String, kotlinVersions: List): String { + val allKotlinVersions = (kotlinVersions + otherKotlinVersion).distinct() + + val minVersion = allKotlinVersions.min()!! + val resultVersion: String = when { + allKotlinVersions.size == 1 -> allKotlinVersions.single() + minVersion.endsWith("+") -> minVersion + else -> "$minVersion+" + } + + return resultVersion + } protected fun platformsOfItems(items: List): Set { val platforms = items.asSequence().map { @@ -486,19 +502,38 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, // When no Kotlin version specified, it means that version is 1.0 if (otherKotlinVersion != null && kotlinVersions.isNotEmpty()) { - val allKotlinVersions = (kotlinVersions + otherKotlinVersion).distinct() + result.intersect(platformsOfItem) + mergeVersions(otherKotlinVersion, kotlinVersions) + } else { + result.intersect(platformsOfItem) + } + } + } - val minVersion = allKotlinVersions.min()!! - val resultVersion = when { - allKotlinVersions.size == 1 -> allKotlinVersions.single() - minVersion.endsWith("+") -> minVersion - else -> "$minVersion+" - } + protected fun unionPlatformsOfItems(items: List): Set { + val platforms = items.asSequence().map { + when (it.kind) { + NodeKind.GroupNode -> unionPlatformsOfItems(it.origins) + else -> it.platformsToShow.toSet() + } + } + + fun String.isKotlinVersion() = this.startsWith("Kotlin") + + if (platforms.count() == 0) return emptySet() + + // Calculating common platforms for items + return platforms.reduce { result, platformsOfItem -> + val otherKotlinVersion = result.find { it.isKotlinVersion() } + val (kotlinVersions, otherPlatforms) = platformsOfItem.partition { it.isKotlinVersion() } - result.intersect(otherPlatforms) + resultVersion + // When no Kotlin version specified, it means that version is 1.0 + if (otherKotlinVersion != null && kotlinVersions.isNotEmpty()) { + result.union(otherPlatforms) + mergeVersions(otherKotlinVersion, kotlinVersions) } else { - result.intersect(platformsOfItem) + result.union(otherPlatforms) } + }.let { + if (it.containsAll(impliedPlatforms)) it - impliedPlatforms else it } } @@ -566,6 +601,17 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } + private fun unionPlatformsOfItems(items: List): Set { + val platforms = items.flatMapTo(mutableSetOf()) { + when (it.kind) { + NodeKind.GroupNode -> unionPlatformsOfItems(it.origins) + else -> it.platforms + } + } + + return platforms.let { if (it.containsAll(impliedPlatforms)) it - impliedPlatforms else it } + } + inner class SectionsBuilder(val node: DocumentationNode): PageBuilder(listOf(node)) { override fun build() { @@ -666,12 +712,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } appendTableCell { - val nodesToAppend = if (members.all { it.kind == NodeKind.GroupNode }) { - members.flatMap { it.origins } - } else { - members - } - appendSummarySignatures(nodesToAppend, platformsBasedOnMembers, omitSamePlatforms) + appendSummarySignatures(members, platformsBasedOnMembers, omitSamePlatforms) } } } @@ -680,6 +721,10 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } private fun platformsOfItems(items: List, omitSamePlatforms: Boolean = true): Set { + if (items.all { it.kind != NodeKind.Package && it.kind != NodeKind.Module && it.kind != NodeKind.ExternalClass }) { + return unionPlatformsOfItems(items) + } + val platforms = platformsOfItems(items) if (platforms.isNotEmpty() && (platforms != node.platformsToShow.toSet() || !omitSamePlatforms)) { return platforms @@ -688,35 +733,49 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } private fun appendSummarySignatures(items: List, platformsBasedOnMembers: Boolean, omitSamePlatforms: Boolean) { - val summarySignature = languageService.summarizeSignatures(items) - if (summarySignature != null) { - appendSummarySignature(summarySignature, items, platformsBasedOnMembers, omitSamePlatforms) - return - } + val groupBySummary = items.groupBy { it.summary } + for ((summary, node) in groupBySummary) { + val nodesToAppend = if (node.all { it.kind == NodeKind.GroupNode }) { + node.flatMap { it.origins } + } else { + node + } - val groupBySignature = items.groupBy { - languageService.render(it, RenderMode.SUMMARY) - } - for ((sign, node) in groupBySignature) { - appendSummarySignature(sign, node, platformsBasedOnMembers, omitSamePlatforms) + val summarySignature = languageService.summarizeSignatures(nodesToAppend) + if (summarySignature != null) { + appendSignatures(summarySignature, items, platformsBasedOnMembers, omitSamePlatforms) + } else { + val groupBySignature = nodesToAppend.groupBy { + languageService.render(it, RenderMode.SUMMARY) + } + for ((sign, members) in groupBySignature) { + appendSignatures(sign, members, platformsBasedOnMembers, omitSamePlatforms) + } + } + + val platforms = platformsOfItems(node) + appendAsBlockWithPlatforms(platforms) { + appendContent(summary) + appendSoftLineBreak() + } } } - private fun appendSummarySignature(signature: ContentNode, items: List, platformsBasedOnMembers: Boolean, omitSamePlatforms: Boolean) { + private fun appendSignatures(signature: ContentNode, items: List, platformsBasedOnMembers: Boolean, omitSamePlatforms: Boolean) { val elementPlatforms = platformsOfItems(items, omitSamePlatforms) val platforms = if (platformsBasedOnMembers) items.flatMapTo(mutableSetOf()) { platformsOfItems(it.members) } + elementPlatforms else elementPlatforms - appendPlatforms(platforms) - appendAsSignature(signature) { - signature.appendSignature() + appendAsBlockWithPlatforms(platforms) { + appendPlatforms(platforms) + appendAsSignature(signature) { + signature.appendSignature() + } + appendSoftLineBreak() } - - appendContent(items.first().summary) - appendSoftLineBreak() } } diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt index 146c1e99..f2b3a937 100644 --- a/core/src/main/kotlin/Model/DocumentationNode.kt +++ b/core/src/main/kotlin/Model/DocumentationNode.kt @@ -76,7 +76,11 @@ open class DocumentationNode(val name: String, var content: Content = content private set - val summary: ContentNode get() = content.summary + val summary: ContentNode get() = when (kind) { + NodeKind.GroupNode -> this.origins.first().summary + else -> content.summary + } + val owner: DocumentationNode? get() = references(RefKind.Owner).singleOrNull()?.to -- cgit