I want to create a task let’s say “rootTask”, that dynamically according to some computation, depends on all tasks of type “Test” from some of the subprojects.
The problem is, that if this computation runs in the “doFirst” of the rootTask, then the taskGraph is already finalized. If i’m doing it in the configuration phase, then the subprojects’ tasks are not created yet.
Also, i’d prefer (though not a must) that the computation will only run if “rootTask” is being called.
Hey,
I have a similiar problem.
How can you define task dependencies or input/output dependencies to a dynamically created task. As matans already says, either the task is not created yet, or it is too late for dependencies to be added.
I have tried adding dependencies in afterEvaluate and tasks.whenTaskAdded but both is too late. Adding a direct dependencies in the build script task.getByName(“dynamicTask”) will not work, as the task does not exist in that phase.