<@U1QN3NEDQ>: the following will be included in th...
# gradle
b
@koral: the following will be included in the upcoming gradle-script-kotlin 0.3.0
Copy code
import groovy.lang.Closure

fun <Delegate : Any> closure(action: Delegate.() -> Any): Closure<Any> =
    KotlinClosure(action)

class KotlinClosure<in T : Any, V : Any>(val function: T.() -> V) : Closure<V>(null, null) {
    fun doCall(it: T): V =
        it.function()
}
which should allow you to write something like:
Copy code
unitTests.all(closure<Test> {
    if (name == ‘testDebug’) {
        // …
    }
})
👍 2