I have a custom task class, similar to the following:
class CustomTask extends DefaultTask {
@OutputFile
File file
@OutputDirectory
File dir
@TaskAction
def taskAction() {
// run some application code to work with file and dir
}
Then I configure the task:
project.task(taskName, type: CustomTask) {
file fileVar
dir dirVar
// I always want it to run
// I need to tweak the application code before enabling incremental support
outputs.upToDateWhen { true }
}
I will eventually enable full incremental build support, but the application code needs a few tweaks first. So for now, I just want to turn off the incremental support. But… I want to take advantage of automatically creating directories, so I don’t want to remove the @OutputFile and @OutputDirectory. Thus, I put in the upToDateWhen code for this reason. But… I still get the task being up to date when “file” and “dir” haven’t changed.
Is this is desired behavior? If so… then I’m not sure what the upToDateWhen is for.