This may not be applicable to your situation but I'll post anyway
If you have one task consuming the outputs of another, you are best off wiring
them together directly so the task dependency can be inferred.
task producer {
outputs.file file("somefile.txt")
}
task consumer {
inputs.files producer.outputs.files
doFirst {
inputs.files.each {
// do stuff with inputs
}
}
}
Besides centralising some logic like filter patterns etc. this also implicitly
creates the task dependency between consumer and producer (and gives you
up-to-date) checks.
On 07/09/2011, at 8:41 PM, phil swenson wrote:
> I think I figured it out. I should have had outputs pointing at
> outputs.files { project.fileTree(dir: project.libsDir, includes:
> ['*-l10n-*']) }
>
> If I had made my filter recursive (using ** instead of *), my previous
> implementation would have worked.
>
> On Wed, Sep 7, 2011 at 11:34 AM, phil swenson <[email protected]> wrote:
>> yes, this task depends on other tasks which re-create the files. So
>> in this case, the inputs are the same (although have different
>> timestamps). However the outputs don't exist at all.
>>
>> On Wed, Sep 7, 2011 at 11:32 AM, Luke Daley <[email protected]>
>> wrote:
>>>
>>> On 07/09/2011, at 6:21 PM, phil swenson wrote:
>>>
>>>> I'm having troubles getting a task to trigger.
>>>>
>>>> I have a task called buildLangPack.
>>>>
>>>> it has the following inputs and outputs:
>>>>
>>>> inputs.files { project.fileTree(dir:
>>>> project.l10nConvention.localizationOutputPath, includes:
>>>> ['*.properties', 'feature.xml']) }
>>>> outputs.files { project.fileTree(dir: project.buildDir, includes:
>>>> ['*-l10n-*']) }
>>>>
>>>> I have run a clean so the entire buildDir is empty (the
>>>> localizationOutputPath reference above is also in the buildDir. But
>>>> the task no longer executes. This tells me gradle thinks it's
>>>> up-to-date (it says "up-to-date" on the execute too). This is
>>>> surprising given that no files exist in the input and output. If I
>>>> delete the .gradle dir for my project, it works again.
>>>>
>>>> thoughts? things to try?
>>>
>>> If there are declared inputs, and the point to non existent files Gradle
>>> will skip the task.
>>>
>>> Are these input files created by another task?
>>>
>>> --
>>> Luke Daley
>>> Principal Engineer, Gradleware
>>> http://gradleware.com
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email