diff options
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | dokka-gradle-plugin/src/main/kotlin/main.kt | 12 |
2 files changed, 24 insertions, 7 deletions
@@ -132,10 +132,17 @@ buildscript { apply plugin: 'org.jetbrains.dokka' ``` -To configure plugin use dokka lambda in the root scope. For example: +The plugin adds a task named "dokka" to the project. The available configuration +options are shown below: ```groovy dokka { + moduleName = 'data' + outputFormat = 'javadoc' + outputDirectory = "$buildDir/javadoc" + processConfigurations = ['compile', 'extra'] + includes = ['packages.md', 'extra.md'] + samples = ['samples/basic.kt', 'samples/advanced.kt'] linkMapping { dir = "src/main/kotlin" url = "https://github.com/cy6erGn0m/vertx3-lang-kotlin/blob/master/src/main/kotlin" @@ -150,6 +157,16 @@ To get it generated use gradle `dokka` task ./gradlew dokka ``` +More dokka tasks can be added to a project like this: + +```groovy +task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) { + outputFormat = 'javadoc' + outputDirectory = "$buildDir/javadoc" +} +``` + + Please see the [Dokka Gradle example project](https://github.com/JetBrains/kotlin-examples/tree/master/gradle/dokka-gradle-example) for an example. ## Dokka Internals diff --git a/dokka-gradle-plugin/src/main/kotlin/main.kt b/dokka-gradle-plugin/src/main/kotlin/main.kt index 28600a6b..c214a08e 100644 --- a/dokka-gradle-plugin/src/main/kotlin/main.kt +++ b/dokka-gradle-plugin/src/main/kotlin/main.kt @@ -34,13 +34,13 @@ public open class DokkaTask : DefaultTask() { var outputFormat: String = "html" var outputDirectory: String = "" @Input - var processConfigurations: ArrayList<String> = arrayListOf("compile") + var processConfigurations: List<Any?> = arrayListOf("compile") @Input - var includes: ArrayList<String> = arrayListOf() + var includes: List<Any?> = arrayListOf() @Input var linkMappings: ArrayList<LinkMapping> = arrayListOf() @Input - var samples: ArrayList<String> = arrayListOf() + var samples: List<Any?> = arrayListOf() fun linkMapping(closure: Closure<Any?>) { val mapping = LinkMapping() @@ -65,7 +65,7 @@ public open class DokkaTask : DefaultTask() { val classpath = processConfigurations - .map { allConfigurations?.getByName(it) ?: throw IllegalArgumentException("No configuration $it found") } + .map { allConfigurations?.getByName(it.toString()) ?: throw IllegalArgumentException("No configuration $it found") } .flatMap { it } if (sourceDirectories.isEmpty()) { @@ -77,8 +77,8 @@ public open class DokkaTask : DefaultTask() { DokkaGradleLogger(logger), classpath.map { it.absolutePath }, sourceDirectories.map { it.absolutePath }, - samples, - includes, + samples.filterNotNull().map { project.file(it).absolutePath }, + includes.filterNotNull().map { project.file(it).absolutePath }, moduleName, outputDirectory, outputFormat, |