I shall not repeat what has been extensively and eloquently discussed in GRADLE-427 and elsewhere. In the light of that the glaring disconnect between what Gradle currently does with respect to dependsOn and what many users need becomes rather obvious.
Gradle developers, please respect your users. I appreciate your opinion with regard to dependsOn and the perceived benefits of its current behaviour but here in the real world we need to do things which work, whether they follow some theoretical guidelines or not. dependsOn reordering tasks causes a lot of pain for actual users working on actual projects and we need a robust, concise, easy to use alternative which respects the specified order.
It appears mustRunAfter() was meant to be a solution but it leads to code like this:
someOtherTask.mustRunAfter(actualTask) anotherTask.mustRunAfter(actualTask) anotherTask.mustRunAfter(someOtherTask) task myTask {
dependsOn actualTask, someOtherTask, anotherTask }
While it does solve the issue it’s unreadable and error-prone to write. While clearly a hack, this still seems to be a dramatically easier to write and read workaround:
task myTaskDependency1(dependsOn: actualTask) task myTaskDependency2(dependsOn: someOtherTask) task myTaskDependency3(dependsOn: anotherTask) task myTask {
dependsOn myTaskDependency1, myTaskDependency2, myTaskDependency3 }
Please add an alternative which would be as easy as:
task myTask {
properlyDependsOn actualTask, someOtherTask, anotherTask }