Hi again,
I've found the following in 14.8.2:
Each time after that, before the task is executed, Gradle takes a new
snapshot of the inputs and outputs. If the new snapshots are the same as the
previous snapshots, Gradle assumes that the outputs are up to date and skips
the task. If they are not the same, Gradle executes the task. Gradle
persists both snapshots for next time the task is executed.
That explains the issue, I think. Rene was right about interpreting a
missing output file as an expected result (even if in my opinion it is
illogical).
I put the following at the end of the task, and now it works as I expect
(the task gets executed if the output is missing):
if( !destFile.exists() )
throw new RuntimeException( 'List of files was not created. Stopping
the build...' )
Is there a nicer API for stopping the build? A kind of assert? Or only
throwing an exception?
Regards,
Andrew
On Thu, Apr 28, 2011 at 8:28 PM, Andrew Schetinin <[email protected]>wrote:
> Hi Rene,
>
> Thanks for the ideas.
>
> The input files are not specified in the configure phase, because my input
> file is actually an artifact (a very large one) that has to be downloaded
> first. I don't want to download it during the configure stage, and that's
> what happens if I attempt to specify it as an input file there. Probably I
> should do it in a different way. I've found some example that looked like
> the following:
>
> configurations {
> artifactFiles
> }
>
> dependencies {
> artifactFiles 'com.company.module:module:1.0.0@war'
> }
>
> task {
> inputs.files
> configurations.artifactFiles.resolvedConfiguration.resolvedArtifacts
> }
>
> The second may indeed be true, but then it is weird. To me, a missing
> (expected) output file means that a task failed - that should be the logical
> default behavior, with may be an option to override it.
> May be I need to put some condition at the end of the task, to indicate
> failure if the output task does not get created? How could I do it?
>
> Regards,
>
> Andrew
>
>