I have a task X that is not created by my plugin.
Some other tasks depend on the task X (also not created by my plugin).
I need to make a task Y that depends on X and can add some outputs to X’s output,
so all tasks that depend on X should depend on Y.
- Find tasks that depend on X by name/regex. It works now, but potentially fragile solution.
- Use ‘X.finalizedBy(Y)’. It seems that a finalizer task is not guaranteed to be executed immediately after a finalizing task, though often it does.
- Enumerate all tasks; check that X in ‘task.taskDependencies.getDependencies(task)’. This seems to be forcing configuration resolution and breaking Android plugin. There was a warning before 3.0:
Changed dependencies of configuration ':[module]:default' after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0.
Is there any other way to make this work that is reliable and generic?