Using the following Groovy build script:
apply plugin: 'java'
task emptyJar(type: Jar) {
classifier = 'empty'
doFirst {
println 'Test'
}
}
The :emptyJar task is run only once, further invocations of the task report UP-TO-DATE.
When I write the same thing using a Kotlin build script:
import org.gradle.jvm.tasks.Jar
plugins {
java
}
task<Jar>("emptyJar") {
classifier = "empty"
doFirst {
println("Test")
}
}
The JAR is always re-built because Gradle detects the task as out-of-date. If I enable debug logging it shows the following:
Executing task ':emptyJar' (up-to-date check took 0.009 secs) due to:
Task ':emptyJar' has a custom action that was loaded with an unknown classloader
I think adding a custom task action using a Kotlin build script should behave similar to Groovy without affecting the up-to-date check.
Tested with gradle-script-kotlin-3.5-20170207151802+0000
Thanks for the report!
Blocked by #171.
Resolved in 174f72c1263183ea49520b6820bcdc72252f930b.
Thanks for the report, @Minecrell!
@bamboo I've tested it and it works fine using the latest snapshot distribution. Thanks for the fix!