Hi,
I'm developing a new task, and trying to make it working, but it only runs
once (or I need to specify "-C rebuild" argument to rebuild the cache and
cause it to be triggered).
I defined a task like the following:
task myExtract {
logger.info "Configuring..."
destDir = new File( buildDir, 'extracted-file.war' )
destFile = new File( destDir, 'include-jars.txt' )
outputs.file destFile // <<<<<<<<<<<<<<<<<<<<<< OUTPUT FILE
logger.info "Task output: ${destFile}"
doLast {
logger.info "Extracting..."
inputs.files configurations.repoFiles // <<<<<<<<<< INPUT FILES
destDir.mkdir() // <<<<<<<< creating the output folder (but not the
output file!)
inputs.files.each { File f ->
logger.info "Extracting ${f.absolutePath}"
}
}
}
I expected it to be triggered always, because at the moment I don't create
the output file.
Otherwise, the task passes, since there is no real functionality in it, not
yet.
Somehow, Gradle caches the mere fact that the task passed, and never really
verifies that the file that was declared as the output file had been created
(I've searched for that file everywhere, just in case - no luck).
So, it runs once, and then states that the task is up-to-date.
Only if I run it with "-C rebuild", the task gets executed again.
It looks like it breaks the whole idea of declaring output files/dirs, or am
I misunderstanding something?
Thank you in advance,
Andrew
--
--
Andrew Schetinin