Hi Andrew,
I have two assumptions about your problem:
1. the assignment of the input files should be done during the
configuration phase of the task and not in a doLast closure. In your
existing task setup, the input files are never considered.
2. when gradle is executed, it stores the hash of the output file. If you
never create one, even though you marked a specific path for the output
file, gradle recognizes, that the output file of your task hasn't changed
(since it does not exist after your first run, the second run of your task
(create a non existing outputfile) is up-to-date.
regards,
René
Am Do, 28.04.2011, 18:10, schrieb Andrew Schetinin:
> 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
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email