9

enter image description here

If my task change some property and when execute it twice incremental build can not be accomplished. And every time this task has to be executed again. Can I use upToDateWhen() method to do some check for the property?

Is there some purpose that property can not be declared as task output?

The image is from: (Muschko, Benjamin. "Hooking into the Build Lifecycle." Gradle in Action. N.p.: n.p., 2014)

Xelian
  • 16,680
  • 25
  • 99
  • 152
  • `upToDateWhen` is definitely dedicated to check if task should be executed. Don't understood well what You mean, but if it suites your needs feel free to use it. – Opal Jul 07 '14 at 09:29
  • I want to ask why Gradleware made TaskOutput interface without property method? – Xelian Jul 07 '14 at 09:44
  • Then ask gradle team. I suppose it's too transitory entity to be registered as task output. – Opal Jul 07 '14 at 11:25
  • FYI: Manning Publications might not like it if you use copyright-protected material from any of their books. – Benjamin Muschko Jul 27 '14 at 15:47
  • Sorry. I add cite to the book from which I took the picture. – Xelian Jul 27 '14 at 17:24

1 Answers1

6

A task's input and output declarations are used to determine whether a task is "up to date" since the last build, and can therefore be safely skipped in the current build. The absence of any output declaration means the task is always out of date when a build starts. Since properties are not persisted across builds, a task which outputs a property would always be out of date and need to be run, which is equivalent to not specifying the property as an output of the task.

chipwilson
  • 160
  • 2
  • 9