aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md44
-rw-r--r--core/src/main/kotlin/Analysis/AnalysisEnvironment.kt2
-rw-r--r--core/testdata/format/multiplatform/groupNode/multiplatform.package.md8
-rw-r--r--runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt2
-rw-r--r--runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle4
-rw-r--r--runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt28
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt2
9 files changed, 46 insertions, 48 deletions
diff --git a/README.md b/README.md
index 57ee6cbd..de00d555 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,6 @@ The available configuration options for single platform are shown below:
```groovy
dokka {
- moduleName = 'data'
outputFormat = 'html'
outputDirectory = "$buildDir/javadoc"
@@ -80,17 +79,10 @@ dokka {
// In case of Gradle multiproject build, you can include subprojects here to get merged documentation
// Note however, that you have to have the Kotlin plugin available in the root project
subProjects = ["subproject1", "subproject2"]
-
- // List of files with module and package documentation
- // https://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentation
- includes = ['packages.md', 'extra.md']
-
- // The list of files or directories containing sample code (referenced with @sample tags)
- samples = ['samples/basic.kt', 'samples/advanced.kt']
-
- jdkVersion = 6 // Used for linking to JDK
-
- impliedPlatforms = ["JVM"] // See platforms section of documentation
+
+ // Used for disabling auto extraction of sources and platforms in both multi-platform and single-platform modes
+ // When set to true, subProject and kotlinTasks are also omitted
+ disableAutoconfiguration = false
// Use default or set to custom path to cache directory
// to enable package-list caching
@@ -98,6 +90,8 @@ dokka {
cacheRoot = 'default'
configuration {
+ moduleName = 'data'
+
// Use to include or exclude non public members.
includeNonPublic = false
@@ -121,6 +115,13 @@ dokka {
// Short form sourceRoots
sourceDirs = files('src/main/kotlin')
+ // List of files with module and package documentation
+ // https://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentation
+ includes = ['packages.md', 'extra.md']
+
+ // The list of files or directories containing sample code (referenced with @sample tags)
+ samples = ['samples/basic.kt', 'samples/advanced.kt']
+
// By default, sourceRoots is taken from kotlinTasks, following roots will be appended to it
// Full form sourceRoot declaration
// Repeat for multiple sourceRoots
@@ -142,7 +143,10 @@ dokka {
// Suffix which is used to append the line number to the URL. Use #L for GitHub
lineSuffix = "#L"
}
-
+
+ // Used for linking to JDK documentation
+ jdkVersion = 6
+
// Disable linking to online kotlin-stdlib documentation
noStdlibLink = false
@@ -195,12 +199,9 @@ dokka {
outputFormat = "html"
multiplatform {
- customName { // The same name as in Kotlin Multiplatform plugin, so the sources are fetched automatically
- targets = ["JS"]
- platform = "js"
- }
-
- differentName { // Different name, so source roots must be passed explicitly
+ customName {} // The same name as in Kotlin Multiplatform plugin, so the sources are fetched automatically
+
+ differentName { // Different name, so source roots and platform must be passed explicitly
targets = ["JVM"]
platform = "jvm"
sourceRoot {
@@ -226,10 +227,7 @@ val dokka by getting(DokkaTask::class) {
outputFormat = "html"
multiplatform {
- val customName by creating { // The same name as in Kotlin Multiplatform plugin, so the sources are fetched automatically
- targets = listOf("JS")
- platform = "js"
- }
+ val customName by creating {} // The same name as in Kotlin Multiplatform plugin, so the sources are fetched automatically
register("differentName") { // Different name, so source roots must be passed explicitly
targets = listOf("JVM")
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
index 603fd0e4..c816106e 100644
--- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
@@ -321,7 +321,6 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
if (analysisPlatform == Platform.js) {
configuration.addAll(JSConfigurationKeys.LIBRARIES, paths.map { it.absolutePath })
}
- configuration.addAll(JSConfigurationKeys.LIBRARIES, paths.map { it.absolutePath })
configuration.addJvmClasspathRoots(paths)
}
@@ -333,7 +332,6 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
if (analysisPlatform == Platform.js) {
configuration.add(JSConfigurationKeys.LIBRARIES, path.absolutePath)
}
- configuration.add(JSConfigurationKeys.LIBRARIES, path.absolutePath)
configuration.addJvmClasspathRoot(path)
}
diff --git a/core/testdata/format/multiplatform/groupNode/multiplatform.package.md b/core/testdata/format/multiplatform/groupNode/multiplatform.package.md
index 5708795e..cf1f70f0 100644
--- a/core/testdata/format/multiplatform/groupNode/multiplatform.package.md
+++ b/core/testdata/format/multiplatform/groupNode/multiplatform.package.md
@@ -4,10 +4,6 @@
### Types
-| [Some](-some/index.md)<br>(JS) | `class Some` |
-| [SomeCoolJvmClass](-some-cool-jvm-class/index.md)<br>(JVM) | `class SomeCoolJvmClass` |
-
-### Type Aliases
-
-| [Some](-some/index.md)<br>(JVM) | `typealias Some = SomeCoolJvmClass` |
+| [Some](-some/index.md) | (JVM) `typealias Some = SomeCoolJvmClass`<br>(JS) `class Some` |
+| (JVM) [SomeCoolJvmClass](-some-cool-jvm-class/index.md) | `class SomeCoolJvmClass` |
diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
index d26f136e..1daa1035 100644
--- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
+++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
@@ -19,12 +19,10 @@ open class DokkaAndroidPlugin : DokkaPlugin() {
if(GradleVersion.current() >= GradleVersion.version("4.10")) {
project.tasks.register(taskName, DokkaAndroidTask::class.java).configure {
- it.moduleName = project.name
it.outputDirectory = File(project.buildDir, taskName).absolutePath
}
} else {
project.tasks.create(taskName, DokkaAndroidTask::class.java).apply {
- moduleName = project.name
outputDirectory = File(project.buildDir, taskName).absolutePath
}
}
diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle
index a8e4db78..7d8b1490 100644
--- a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle
+++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle
@@ -72,5 +72,7 @@ task dokkaFullFlavourOnly(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) {
}
dokkaFatJar = dokka_fatjar
outputDirectory = "$buildDir/dokka/fullOnly"
- moduleName = "full"
+ configuration {
+ moduleName = "full"
+ }
} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle b/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle
index 5ce7c3fd..8e25aaf1 100644
--- a/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle
+++ b/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle
@@ -24,7 +24,6 @@ apply plugin: 'kotlin'
@CompileStatic
def configureDokkaTypeSafely(DokkaTask dokka) {
dokka.with {
- moduleName = "some String"
outputFormat = "some String"
outputDirectory = "some String"
dokkaFatJar = "some String"
@@ -39,6 +38,7 @@ def configureDokkaTypeSafely(DokkaTask dokka) {
})
}
dokka.configuration.with {
+ moduleName = "some String"
classpath = Arrays.asList("someClassDir")
includes = Collections.<String> emptyList()
samples = Collections.<String> emptyList()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
index ba931313..0ad1d1d3 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
@@ -120,7 +120,7 @@ object ConfigurationExtractor {
.orEmpty()
private fun getMainCompilation(target: KotlinTarget?): KotlinCompilation<KotlinCommonOptions>? =
- target?.compilations?.getByName("main")
+ target?.compilations?.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
private fun getPlatformName(platform: KotlinPlatformType): String =
if (platform == KotlinPlatformType.androidJvm) "jvm" else platform.toString()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 6bad548a..84bbaf78 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -41,9 +41,6 @@ open class DokkaTask : DefaultTask() {
}
@Input
- var moduleName: String = ""
-
- @Input
var outputFormat: String = "html"
@Input
@@ -65,9 +62,9 @@ open class DokkaTask : DefaultTask() {
@Input
var cacheRoot: String? = null
- var multiplatform: Set<GradlePassConfigurationImpl>
+ var multiplatform: NamedDomainObjectContainer<GradlePassConfigurationImpl>
@Suppress("UNCHECKED_CAST")
- @Nested get() = (DslObject(this).extensions.getByName(MULTIPLATFORM_EXTENSION_NAME) as NamedDomainObjectContainer<GradlePassConfigurationImpl>).toSet()
+ @Nested get() = (DslObject(this).extensions.getByName(MULTIPLATFORM_EXTENSION_NAME) as NamedDomainObjectContainer<GradlePassConfigurationImpl>)
internal set(value) = DslObject(this).extensions.add(MULTIPLATFORM_EXTENSION_NAME, value)
var configuration: GradlePassConfigurationImpl
@@ -96,6 +93,9 @@ open class DokkaTask : DefaultTask() {
@Input
var subProjects: List<String> = emptyList()
+ @Input
+ var disableAutoconfiguration: Boolean = false
+
fun tryResolveFatJar(configuration: Configuration?): Set<File> {
return try {
configuration!!.resolve()
@@ -183,18 +183,23 @@ open class DokkaTask : DefaultTask() {
if (multiplatform.toList().isNotEmpty()) collectFromMultiPlatform() else collectFromSinglePlatform()
private fun collectFromMultiPlatform(): List<GradlePassConfigurationImpl> {
+ if (disableAutoconfiguration) return multiplatform.toList()
+
val baseConfig = mergeUserAndAutoConfigurations(
multiplatform.toList(),
ConfigurationExtractor.extractFromMultiPlatform(project).orEmpty()
)
return if (subProjects.isNotEmpty())
- subProjects.toProjects().fold(baseConfig, { list, project ->
- mergeUserAndAutoConfigurations(list, ConfigurationExtractor.extractFromMultiPlatform(project).orEmpty())})
+ subProjects.toProjects().fold(baseConfig) { list, project ->
+ mergeUserAndAutoConfigurations(list, ConfigurationExtractor.extractFromMultiPlatform(project).orEmpty())
+ }
else
baseConfig
}
private fun collectFromSinglePlatform(): List<GradlePassConfigurationImpl> {
+ if (disableAutoconfiguration) return listOf(configuration)
+
val autoConfig = ConfigurationExtractor.extractFromSinglePlatform(project)
val baseConfig = if (autoConfig != null)
listOf(mergeUserConfigurationAndPlatformData(configuration, autoConfig))
@@ -203,9 +208,9 @@ open class DokkaTask : DefaultTask() {
return if (subProjects.isNotEmpty()) {
try {
- subProjects.toProjects().fold(baseConfig, { list, project ->
+ subProjects.toProjects().fold(baseConfig) { list, project ->
listOf(mergeUserConfigurationAndPlatformData(list.first(), ConfigurationExtractor.extractFromSinglePlatform(project)!!))
- })
+ }
} catch(e: NullPointerException) {
logger.warn("Cannot extract sources from subProjects. Do you have the Kotlin plugin in version 1.3.30+ " +
"and the Kotlin plugin applied in the root project?")
@@ -253,7 +258,10 @@ open class DokkaTask : DefaultTask() {
private fun defaultPassConfiguration(config: GradlePassConfigurationImpl): GradlePassConfigurationImpl {
if (config.moduleName == "") {
- config.moduleName = moduleName
+ config.moduleName = project.name
+ }
+ if (config.targets.isEmpty() && multiplatform.isNotEmpty()){
+ config.targets = listOf(config.platform.toString())
}
config.classpath = (config.classpath as List<Any>).map { it.toString() }.distinct() // Workaround for Groovy's GStringImpl
config.sourceRoots = config.sourceRoots.distinct().toMutableList()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
index 24fe9df1..66020c5c 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
@@ -23,12 +23,10 @@ open class DokkaPlugin : Plugin<Project> {
if(GradleVersion.current() >= GradleVersion.version("4.10")) {
project.tasks.register(taskName, DokkaTask::class.java).configure {
- it.moduleName = project.name
it.outputDirectory = File(project.buildDir, taskName).absolutePath
}
} else {
project.tasks.create(taskName, DokkaTask::class.java).apply {
- moduleName = project.name
outputDirectory = File(project.buildDir, taskName).absolutePath
}
}