task
task copied to clipboard
Out-of-date dependency force execution of an up-to-date task.
TL;DR
Force the execution of all dependent tasks when a dependency (defined by deps) is out-of-date.
Note: A more detailed discussion can be found in here. To assess the popularity of this feature please upvote (👍) or downvote it (👎 )
Current behavior
Task currently only evaluates the source/generates/status fields of a task in order to determine if the task's commands need to run or to be skipped. As a result, when dependencies are out-of-date, their execution does not affect their dependent task and subsequently the execution of the target task (i.e., the task whose name was passed as the command line argument). As a result, a target task might be skipped despite having some of its dependencies executed due to being out-of-date.
Desired behavior
Overview
Make the execution of any of the dependencies trigger the execution of all their dependent tasks. Especially for project management and DevOps uses of go-task, where not all tasks operate on files, this behavior will greatly simplify the definition of tasks and help minimize the need for forced runs while still preventing unnecessary work.
This change, as noted by @ghostsquad here, will also make go-task behave closer to Makefiles (GNU make).
Details
A potential algorithm of how to resolve whether the commands of a given task need to be executed or skipped can be the following:
- Evaluate the dependencies of a target task. If any of the dependencies was out-of-date mark the target task as out-of-date.
- When returning to evaluate the up-to-date/out-of-date status of a task, if it hasn't already been marked as out-of-date by its dependencies, evaluate its sources/generates/status as normal to determine if it should be skipped or not.
For example, for a task dependency tree as shown below:

If only tasks dep1.2.1 and dep2.2 are out-of-date, this would also force tasks dep1.2, dep1, dep2, and of course the target to be marked as out-of-date and run.