I'm learning Gradle and trying to understand how input and output files determine whether a task is up to date.
This task is never up to date, even when the build file doesn't change.
task printFoo() {
inputs.file(getBuildFile())
doLast {
println 'foo'
}
}
This task is always up to date, even when the build file changes.
task printFoo() {
outputs.file(getBuildFile())
doLast {
println 'foo'
}
}
I had expected both examples to consider the task out of date only when the build file changes, and up to date otherwise. What am I missing?