What are your thoughts about this way to configure...
# gradle
b
What are your thoughts about this way to configure tasks?
Copy code
inline operator fun <reified T: Task> KClass<T>.invoke(crossinline op: T.() -> Unit) {
    tasks.withType(java) {
        op()
    }
}

KotlinCompile::class {
    kotlinOptions.jvmTarget = "1.8"
}

DokkaTask::class {
    outputFormat = "html"
    outputDirectory = "$buildDir/docs"
}
👍 6
a
I've been been using this:
Copy code
inline fun <reified T: Task> task(crossinline body: T.() -> Unit) {
    tasks.withType(T::class.java) {
        body(this)
    }
}