Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why in Gradle can't declare property as output?

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)

like image 549
Xelian Avatar asked Jul 07 '14 08:07

Xelian


1 Answers

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.

like image 103
chipwilson Avatar answered Nov 15 '22 19:11

chipwilson