https://kotlinlang.org logo
Title
l

Leon Linhart

07/24/2017, 7:22 PM
Does anyone have a Kotlin version of a task that outputs aggregated javadoc at hand?
g

gildor

07/25/2017, 12:14 AM
To generate kotlin docs you should use Dokka https://github.com/Kotlin/dokka
l

Leon Linhart

07/25/2017, 9:06 AM
Ah I see how this was ambiguous, but this is not what I meant. I'm looking for a way to generate the aggregated javadoc of a java-multiproject that I build using Gradle with Kotlin DSL.
g

gildor

07/25/2017, 9:11 AM
You should configure task with the same way as for Groovy DSL, if you provide example of Groovy config for such task I can help with kotlin-dsl
Very basic config of javadoc task will look like (port of example from official doc):
task<Javadoc>("myJavadocs") {
    source = java.sourceSets["main"].allJava
}
But I’m not familiar with advanced javadoc configs
l

Leon Linhart

07/25/2017, 10:21 AM
apply plugin 'java'
def exportedProjects= [
        ":top-lib",
        ":sub:sub-api",
        ":sub:sub-lib1",
        ":sub:sub-lib2",
        ":sub:sub-lib3"
]

task alljavadoc(type: Javadoc) {
    source exportedProjects.collect { project(it).sourceSets.main.allJava }
    classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })
    destinationDir = file("${buildDir}/docs/javadoc")
}
This is one of the snippets that come up when googling the issue. I do get what it does and how it does it but I'm having trouble porting the
exportedProjects.collect { ... }
bits to Kotlin.
g

gildor

07/25/2017, 3:51 PM
Collect is a groovy method, you can replace it with Kotlin
.map{}