On 24/11/2010, at 2:45 AM, Etienne Studer wrote:

> Hi Adam
> 
> If I have a task type that annotates its fields with @Input / 
> @InputDirectory, etc. but with no fields that have @OutputDirectory / 
> @OutputFile annotations, the task is always executed and never considered 
> uptodate. Is that by design?

It is. A task needs to have at least one of:

- A property marked with @OutputDirectory

- A property marked with @OutputFile

- Some output files or directories declared using outputs.dir(), file() or 
files()

- An 'up-to-date' rule, by supplying a predicate to outputs.upToDateWhen()

The theory here is that a task always does some useful work of some kind - that 
it, it has one or more outputs. If you don't give Gradle any way to check if 
the outputs are up to date, then it has to assume that the outputs are not 
persistent in any way, and so must execute the task every time.

At the moment, the only types of outputs that Gradle understands are local 
files and directories. I imagine over time we'll add extra types of outputs. 
For example, Gradle might understand that a deployed web app is a kind of 
output, and can skip deployment if the war hasn't changed since the web app was 
deployed and the web app is still deployed.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to