I want to delete some non standard files when the clean task runs. How can I do this using the Kotlin DSL?
I found the Manipulating existing tasks section in the user guide. But that shows manipulating the custom “hello” task defined in the same script. When I try to do that for clean:
// Kotlin DSL
clean {
doFirst {
val file = File("/tmp/gradleExtraClean/foo.txt")
file.delete()
}
}
I get an Unresolved reference: clean
error. And I’m not sure to get a reference to the clean task. Or if my approach is completely wrong.