Gábor Török
07/08/2025, 7:04 PMclass TestConfiguratorPlugin : Plugin<Project> {
override fun apply(target: Project): Unit = target.run {
tasks.withType<Test>().configureEach {
println("Configuring test task: ${name}")
it.afterTest { something ->
println("After test task $something")
}
}
}
}
i am trying to write a plugin in kotlin - but i can't figure out how to invoke those groovy closures from kotlin at all :/ephemient
07/08/2025, 7:07 PMGábor Török
07/08/2025, 7:13 PMGábor Török
07/08/2025, 7:14 PMtasks.withType(Test) { ... }
in
> Groovy, you shouldn’t use tasks.withType<Test>() { ... }
in Kotlin
> (destroying task configuration avoidance for all test tasks).
soooo what should we use if we want to configure all tests to a certain behaviour?ephemient
07/08/2025, 7:18 PMafterTest
is not for configuring test behaviorGábor Török
07/08/2025, 7:21 PMVampire
07/09/2025, 6:56 AMtasks.withType<Test>() { }
, you are using tasks.withType<Test>().configureEach { }
and that is exactly what you should do.Gábor Török
07/09/2025, 4:43 PM