aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2019-06-13 13:17:28 +0200
committerKamil Doległo <kamilok1965@interia.pl>2019-06-13 13:17:28 +0200
commitf4280a9fcd106bdb4e886fe99cfeb1410a921ba0 (patch)
tree63c3139682bfdc1046ed948ebb3f4a6fb1b954ac
parent16804bc4c2396ed8bc905e9ec9f2b0bc1c80cd38 (diff)
downloaddokka-f4280a9fcd106bdb4e886fe99cfeb1410a921ba0.tar.gz
dokka-f4280a9fcd106bdb4e886fe99cfeb1410a921ba0.tar.bz2
dokka-f4280a9fcd106bdb4e886fe99cfeb1410a921ba0.zip
Readme update
-rw-r--r--README.md71
1 files changed, 56 insertions, 15 deletions
diff --git a/README.md b/README.md
index 64224056..81ffe6a0 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ repositories {
apply plugin: 'org.jetbrains.dokka'
```
-or using the new plugins block:
+or using the plugins block:
```groovy
plugins {
@@ -44,6 +44,7 @@ If you encounter any problems when migrating from older versions of Dokka, pleas
Minimal dokka configuration:
+Groovy
```groovy
dokka {
outputFormat = 'html'
@@ -51,6 +52,16 @@ dokka {
}
```
+Kotlin
+```kotlin
+tasks {
+ val dokka by getting(DokkaTask::class) {
+ outputFormat = "html"
+ outputDirectory = "$buildDir/dokka"
+ }
+}
+```
+
[Output formats](#output_formats)
The available configuration options for single platform are shown below:
@@ -162,31 +173,30 @@ dokka {
}
```
-The available configuration options for multiplatform are like those for single platform, but `configuration` block is
-replaced by `multiplatform` which has inner blocks for each platform. You also have to explicitly empty `kotlinTasks` block:
+#### Multiplatform
+Since 0.9.19 dokka supports multiplatform projects.
+The available configuration options for multiplatform are like those for single platform, but the `configuration` block
+is replaced by `multiplatform` which has inner blocks for each platform. The inner blocks can be named arbitrary,
+however if you want to use source roots and classpath provided by Kotlin Multiplatform plugin, they must have the same names.
+Groovy
```groovy
+kotlin { // Kotlin Multiplatform plugin configuration
+ jvm()
+ js("customName")
+}
+
dokka {
outputDirectory = "$buildDir/dokka"
outputFormat = "html"
- kotlinTasks {
- []
- }
-
multiplatform {
- js { // the name here is arbitrary
+ customName { // The same name as in Kotlin Multiplatform plugin, so the sources are fetched automatically
targets = ["JS"]
platform = "js"
- sourceRoot {
- path = kotlin.sourceSets.jsMain.kotlin.srcDirs[0]
- }
- sourceRoot {
- path = kotlin.sourceSets.commonMain.kotlin.srcDirs[0]
- }
}
- jvm { // the name here is arbitrary
+ differentName { // Different name, so source roots must be passed explicitly
targets = ["JVM"]
platform = "jvm"
sourceRoot {
@@ -198,9 +208,40 @@ dokka {
}
}
}
+```
+
+Kotlin
+```kotlin
+kotlin { // Kotlin Multiplatform plugin configuration
+ jvm()
+ js("customName")
+}
+val dokka by getting(DokkaTask::class) {
+ outputDirectory = "$buildDir/dokka"
+ 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"
+ }
+
+ register("differentName") { // Different name, so source roots must be passed explicitly
+ targets = listOf("JVM")
+ platform = "jvm"
+ sourceRoot {
+ path = kotlin.sourceSets.getByName("jvmMain").kotlin.srcDirs.first().toString()
+ }
+ sourceRoot {
+ path = kotlin.sourceSets.getByName("commonMain").kotlin.srcDirs.first().toString()
+ }
+ }
+ }
+ }
```
+Note that `javadoc` output format cannot be used with multiplatform.
To generate the documentation, use the `dokka` Gradle task: