aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt9
-rw-r--r--core/src/main/kotlin/Formats/GFMFormatService.kt21
-rw-r--r--core/src/main/kotlin/Formats/HtmlFormatService.kt9
-rw-r--r--core/src/main/kotlin/Formats/JekyllFormatService.kt18
-rw-r--r--core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt28
-rw-r--r--core/src/main/kotlin/Formats/MarkdownFormatService.kt15
-rw-r--r--core/src/main/kotlin/Formats/StructuredFormatService.kt55
-rw-r--r--core/src/main/kotlin/Generation/DokkaGenerator.kt76
-rw-r--r--core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt4
-rw-r--r--core/src/main/kotlin/Java/JavadocParser.kt7
-rw-r--r--core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt2
-rw-r--r--core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt2
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt227
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinLanguageService.kt4
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt4
-rw-r--r--core/src/main/kotlin/Model/DocumentationReference.kt23
-rw-r--r--core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt7
-rw-r--r--core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt14
-rw-r--r--core/src/main/kotlin/Utilities/DokkaModules.kt (renamed from core/src/main/kotlin/Utilities/DokkaModule.kt)60
-rw-r--r--core/src/test/kotlin/TestAPI.kt61
-rw-r--r--core/src/test/kotlin/format/GFMFormatTest.kt2
-rw-r--r--core/src/test/kotlin/format/HtmlFormatTest.kt6
-rw-r--r--core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt2
-rw-r--r--core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt6
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt69
-rw-r--r--core/src/test/kotlin/model/ClassTest.kt12
-rw-r--r--core/src/test/kotlin/model/CommentTest.kt3
-rw-r--r--core/src/test/kotlin/model/FunctionTest.kt12
-rw-r--r--core/src/test/kotlin/model/PropertyTest.kt12
-rw-r--r--core/src/test/kotlin/model/TypeAliasTest.kt9
-rw-r--r--core/testdata/classes/sinceKotlin.kt5
-rw-r--r--core/testdata/format/dynamicExtension.kt3
-rw-r--r--core/testdata/format/dynamicExtension.md10
-rw-r--r--core/testdata/format/dynamicType.kt2
-rw-r--r--core/testdata/format/dynamicType.md5
-rw-r--r--core/testdata/format/memberExtension.kt8
-rw-r--r--core/testdata/format/memberExtension.md10
-rw-r--r--core/testdata/format/multiplatform/js.kt7
-rw-r--r--core/testdata/format/multiplatform/jvm.kt8
-rw-r--r--core/testdata/format/multiplatform/multiplatform.package.md9
-rw-r--r--core/testdata/format/multiplatformImplied/foo.md24
-rw-r--r--core/testdata/format/multiplatformImplied/js.kt16
-rw-r--r--core/testdata/format/multiplatformImplied/jvm.kt16
-rw-r--r--core/testdata/format/multiplatformMerge/js.kt7
-rw-r--r--core/testdata/format/multiplatformMerge/jvm.kt8
-rw-r--r--core/testdata/format/multiplatformMerge/multiplatform.package.md8
-rw-r--r--core/testdata/format/multiplatformMergeMembers/foo.md26
-rw-r--r--core/testdata/format/multiplatformMergeMembers/js.kt16
-rw-r--r--core/testdata/format/multiplatformMergeMembers/jvm.kt16
-rw-r--r--core/testdata/format/multiplatformOmitRedundant/foo.md22
-rw-r--r--core/testdata/format/multiplatformOmitRedundant/js.kt2
-rw-r--r--core/testdata/format/multiplatformOmitRedundant/jvm.kt11
-rw-r--r--core/testdata/format/sinceKotlin.html27
-rw-r--r--core/testdata/format/sinceKotlin.kt5
-rw-r--r--core/testdata/format/sinceKotlin.md14
-rw-r--r--core/testdata/format/sinceKotlin.package.md8
-rw-r--r--core/testdata/format/website-samples/dropImport.md1
-rw-r--r--core/testdata/format/website-samples/newLinesInSamples.kt19
-rw-r--r--core/testdata/format/website-samples/newLinesInSamples.md31
-rw-r--r--core/testdata/format/website-samples/sample.md1
-rw-r--r--core/testdata/format/website-samples/sampleWithAsserts.md1
-rw-r--r--core/testdata/functions/sinceKotlin.kt5
-rw-r--r--core/testdata/properties/sinceKotlin.kt5
-rw-r--r--core/testdata/typealias/sinceKotlin.kt5
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt1
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt24
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt8
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt1
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt9
69 files changed, 963 insertions, 220 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index eb2b2a65..8038089f 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -10,6 +10,11 @@ fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it })
}
+fun parseSourceRoot(sourceRoot: String): SourceRoot {
+ val components = sourceRoot.split("::", limit = 2)
+ return SourceRoot(components.last(), if (components.size == 1) listOf() else components[0].split(','))
+}
+
class DokkaBootstrapImpl : DokkaBootstrap {
class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
@@ -37,6 +42,7 @@ class DokkaBootstrapImpl : DokkaBootstrap {
outputDir: String,
format: String,
includeNonPublic: Boolean,
+ includeRootPackage: Boolean,
reportUndocumented: Boolean,
skipEmptyPackages: Boolean,
skipDeprecated: Boolean,
@@ -46,7 +52,7 @@ class DokkaBootstrapImpl : DokkaBootstrap {
generator = DokkaGenerator(
DokkaProxyLogger(logger),
classpath,
- sources,
+ sources.map(::parseSourceRoot),
samples,
includes,
moduleName,
@@ -54,6 +60,7 @@ class DokkaBootstrapImpl : DokkaBootstrap {
outputDir,
format,
includeNonPublic,
+ includeRootPackage,
reportUndocumented,
skipEmptyPackages,
skipDeprecated,
diff --git a/core/src/main/kotlin/Formats/GFMFormatService.kt b/core/src/main/kotlin/Formats/GFMFormatService.kt
index cfb7fc03..cb31a1d3 100644
--- a/core/src/main/kotlin/Formats/GFMFormatService.kt
+++ b/core/src/main/kotlin/Formats/GFMFormatService.kt
@@ -3,11 +3,12 @@ package org.jetbrains.dokka
import com.google.inject.Inject
open class GFMOutputBuilder(to: StringBuilder,
- location: Location,
- locationService: LocationService,
- languageService: LanguageService,
- extension: String)
- : MarkdownOutputBuilder(to, location, locationService, languageService, extension)
+ location: Location,
+ locationService: LocationService,
+ languageService: LanguageService,
+ extension: String,
+ impliedPlatforms: List<String>)
+ : MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
{
override fun appendTable(vararg columns: String, body: () -> Unit) {
to.appendln(columns.joinToString(" | ", "| ", " |"))
@@ -45,12 +46,14 @@ open class GFMOutputBuilder(to: StringBuilder,
open class GFMFormatService(locationService: LocationService,
signatureGenerator: LanguageService,
- linkExtension: String)
-: MarkdownFormatService(locationService, signatureGenerator, linkExtension) {
+ linkExtension: String,
+ impliedPlatforms: List<String>)
+: MarkdownFormatService(locationService, signatureGenerator, linkExtension, impliedPlatforms) {
@Inject constructor(locationService: LocationService,
- signatureGenerator: LanguageService) : this(locationService, signatureGenerator, "md")
+ signatureGenerator: LanguageService,
+ impliedPlatforms: List<String>) : this(locationService, signatureGenerator, "md", impliedPlatforms)
override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder =
- GFMOutputBuilder(to, location, locationService, languageService, extension)
+ GFMOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
}
diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt
index d73e4e62..6819e652 100644
--- a/core/src/main/kotlin/Formats/HtmlFormatService.kt
+++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.google.inject.name.Named
+import org.jetbrains.dokka.Utilities.impliedPlatformsName
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths
@@ -11,8 +12,9 @@ open class HtmlOutputBuilder(to: StringBuilder,
locationService: LocationService,
languageService: LanguageService,
extension: String,
+ impliedPlatforms: List<String>,
val templateService: HtmlTemplateService)
- : StructuredOutputBuilder(to, location, locationService, languageService, extension)
+ : StructuredOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
{
override fun appendText(text: String) {
to.append(text.htmlEscape())
@@ -95,7 +97,8 @@ open class HtmlOutputBuilder(to: StringBuilder,
open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService,
signatureGenerator: LanguageService,
- val templateService: HtmlTemplateService)
+ val templateService: HtmlTemplateService,
+ @Named(impliedPlatformsName) val impliedPlatforms: List<String>)
: StructuredFormatService(locationService, signatureGenerator, "html"), OutlineFormatService {
override fun enumerateSupportFiles(callback: (String, String) -> Unit) {
@@ -103,7 +106,7 @@ open class HtmlFormatService @Inject constructor(@Named("folders") locationServi
}
override fun createOutputBuilder(to: StringBuilder, location: Location) =
- HtmlOutputBuilder(to, location, locationService, languageService, extension, templateService)
+ HtmlOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms, templateService)
override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
templateService.appendHeader(to, "Module Contents", locationService.calcPathToRoot(location))
diff --git a/core/src/main/kotlin/Formats/JekyllFormatService.kt b/core/src/main/kotlin/Formats/JekyllFormatService.kt
index bab73379..d217bf38 100644
--- a/core/src/main/kotlin/Formats/JekyllFormatService.kt
+++ b/core/src/main/kotlin/Formats/JekyllFormatService.kt
@@ -1,13 +1,16 @@
package org.jetbrains.dokka
import com.google.inject.Inject
+import com.google.inject.name.Named
+import org.jetbrains.dokka.Utilities.impliedPlatformsName
open class JekyllOutputBuilder(to: StringBuilder,
location: Location,
locationService: LocationService,
languageService: LanguageService,
- extension: String)
- : MarkdownOutputBuilder(to, location, locationService, languageService, extension)
+ extension: String,
+ impliedPlatforms: List<String>)
+ : MarkdownOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
{
override fun appendNodes(nodes: Iterable<DocumentationNode>) {
to.appendln("---")
@@ -25,14 +28,15 @@ open class JekyllOutputBuilder(to: StringBuilder,
open class JekyllFormatService(locationService: LocationService,
signatureGenerator: LanguageService,
- linkExtension: String)
-: MarkdownFormatService(locationService, signatureGenerator, linkExtension) {
+ linkExtension: String,
+ impliedPlatforms: List<String>)
+: MarkdownFormatService(locationService, signatureGenerator, linkExtension, impliedPlatforms) {
@Inject constructor(locationService: LocationService,
- signatureGenerator: LanguageService): this(locationService, signatureGenerator, "md") {
- }
+ signatureGenerator: LanguageService,
+ @Named(impliedPlatformsName) impliedPlatforms: List<String>): this(locationService, signatureGenerator, "md", impliedPlatforms)
override fun createOutputBuilder(to: StringBuilder, location: Location): FormattedOutputBuilder =
- JekyllOutputBuilder(to, location, locationService, languageService, extension)
+ JekyllOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
}
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt
index 007e9353..7ebc5f09 100644
--- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt
+++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt
@@ -1,14 +1,17 @@
package org.jetbrains.dokka
import com.google.inject.Inject
+import com.google.inject.name.Named
+import org.jetbrains.dokka.Utilities.impliedPlatformsName
open class KotlinWebsiteOutputBuilder(to: StringBuilder,
location: Location,
locationService: LocationService,
languageService: LanguageService,
- extension: String)
- : JekyllOutputBuilder(to, location, locationService, languageService, extension)
+ extension: String,
+ impliedPlatforms: List<String>)
+ : JekyllOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
{
private var needHardLineBreaks = false
private var insideDiv = 0
@@ -145,11 +148,12 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder,
}
class KotlinWebsiteFormatService @Inject constructor(locationService: LocationService,
- signatureGenerator: LanguageService)
- : JekyllFormatService(locationService, signatureGenerator, "html")
+ signatureGenerator: LanguageService,
+ @Named(impliedPlatformsName) impliedPlatforms: List<String>)
+ : JekyllFormatService(locationService, signatureGenerator, "html", impliedPlatforms)
{
override fun createOutputBuilder(to: StringBuilder, location: Location) =
- KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension)
+ KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
}
@@ -157,14 +161,15 @@ class KotlinWebsiteRunnableSamplesOutputBuilder(to: StringBuilder,
location: Location,
locationService: LocationService,
languageService: LanguageService,
- extension: String)
- : KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension) {
+ extension: String,
+ impliedPlatforms: List<String>)
+ : KotlinWebsiteOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms) {
override fun appendSampleBlockCode(language: String, imports: () -> Unit, body: () -> Unit) {
div(to, "sample", true) {
appendBlockCode(language) {
imports()
- wrap("\nfun main(args: Array<String>) {", "}") {
+ wrap("\n\nfun main(args: Array<String>) {", "}") {
wrap("\n//sampleStart\n", "\n//sampleEnd\n", body)
}
}
@@ -173,9 +178,10 @@ class KotlinWebsiteRunnableSamplesOutputBuilder(to: StringBuilder,
}
class KotlinWebsiteRunnableSamplesFormatService @Inject constructor(locationService: LocationService,
- signatureGenerator: LanguageService)
- : JekyllFormatService(locationService, signatureGenerator, "html") {
+ signatureGenerator: LanguageService,
+ @Named(impliedPlatformsName) impliedPlatforms: List<String>)
+ : JekyllFormatService(locationService, signatureGenerator, "html", impliedPlatforms) {
override fun createOutputBuilder(to: StringBuilder, location: Location) =
- KotlinWebsiteRunnableSamplesOutputBuilder(to, location, locationService, languageService, extension)
+ KotlinWebsiteRunnableSamplesOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
}
diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt
index fc63b2f2..b9c9c04f 100644
--- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt
+++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt
@@ -1,6 +1,8 @@
package org.jetbrains.dokka
import com.google.inject.Inject
+import com.google.inject.name.Named
+import org.jetbrains.dokka.Utilities.impliedPlatformsName
import java.util.*
enum class ListKind {
@@ -14,8 +16,9 @@ open class MarkdownOutputBuilder(to: StringBuilder,
location: Location,
locationService: LocationService,
languageService: LanguageService,
- extension: String)
- : StructuredOutputBuilder(to, location, locationService, languageService, extension)
+ extension: String,
+ impliedPlatforms: List<String>)
+ : StructuredOutputBuilder(to, location, locationService, languageService, extension, impliedPlatforms)
{
private val listKindStack = Stack<ListKind>()
protected var inTableCell = false
@@ -211,11 +214,13 @@ open class MarkdownOutputBuilder(to: StringBuilder,
open class MarkdownFormatService(locationService: LocationService,
signatureGenerator: LanguageService,
- linkExtension: String)
+ linkExtension: String,
+ val impliedPlatforms: List<String>)
: StructuredFormatService(locationService, signatureGenerator, "md", linkExtension) {
@Inject constructor(locationService: LocationService,
- signatureGenerator: LanguageService): this(locationService, signatureGenerator, "md")
+ signatureGenerator: LanguageService,
+ @Named(impliedPlatformsName) impliedPlatforms: List<String>): this(locationService, signatureGenerator, "md", impliedPlatforms)