Can I have a Gradle task where I can have both dependsOn
and mustRunAfter
to define the dependencies and the ordering?
tasks.register('MyTask') {
dependsOn 'foo'
dependsOn 'bar'
dependsOn 'toy'
tasks.findByName('bar').mustRunAfter('foo')
tasks.findByName('toy').mustRunAfter('bar')
}
I want to run foo -> bar -> toy.
Are these two the same?
tasks.register('MyTask2') {
dependsOn 'hello'
tasks.findByName('MyTask2').mustRunAfter('hello')
}
tasks.register('MyTask2') {
mustRunAfter('hello')
}
Is this a correct approach? I tried going over a few posts, but couldn't find an answer.