Execution Graph to detect cyclic tasks
Execution graph to detect cyclic tasks, replacing the TaskCalledTooManyTimesError mechanism.
Vertices in the graph are added for each unique call (to a task) and the PreventCycles feature of the graph is used to detect cyclic execution. The unique identifying properties are:
- The task name, unique from the Taskfile AST/DAG mechanism.
- The task hash, unique for an "instance" of a task call (e.g. set of vars).
- Call "index" of the task, either from 'deps' or 'cmds'.
- The sources method value, propagated as a call "token". This addresses a special case where a task call is cyclic, but the sources change between each cycle, and thus the task call should continue.
Although this method has worked remarkably well, it could be beneficial to have a mechanism to disable the detection: Environment variable (of course) and perhaps attached to an existing CLI parameter (--force).
fixes https://github.com/go-task/task/issues/820 fixes #2302
@korverdev Would you like to try this for you use case mentioned in comments of #820?
Clone the PR and then run task like this:
go run ./cmd/task -d <your directory> <your task>
I can confirm that this PR also fixes #2302