Task without outputs is never considered up to date


(Piotr Kubowicz) #1

I saw http://forums.gradle.org/gradle/topics/how_to_define_a_task_without_outputs and consider your answer counter-intuitive. There are many cases where you define a task checking correctness of some source files (for example, a fast check that an XML file has all tags closed, or that line endings are in Unix format). There is no sense for those kind of tasks to produce any output.

If you choose to retain this behaviour, please at least print a warning when a task has some inputs but no outputs. I think you should also clearly describe how outputs behave in the user guide (http://www.gradle.org/docs/current/userguide/more_about_tasks.html#sec:up_to_date_checks) - currently the chapter ‘Skipping tasks that are up-to-date’ offers no help and you can waste lots of time trying to figure out why your task is never skipped.


(Peter Niederwieser) #2

Logically, a task that checks if line endings are in Unix format does have an output (at least ‘true’ or ‘false’), even though this kind of output isn’t currently easy to describe in Gradle. The info log (’–info’) provides good information on why a task is not considered up-to-date. Would you be interested in helping out on improving the documentation? A pull request would definitely be appreciated.