Does anyone have a Kotlin version of a task that o...
# gradle
l
Does anyone have a Kotlin version of a task that outputs aggregated javadoc at hand?
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
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):
Copy code
task<Javadoc>("myJavadocs") {
    source = java.sourceSets["main"].allJava
}
But I’m not familiar with advanced javadoc configs
l
Copy code
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
Collect is a groovy method, you can replace it with Kotlin
.map{}