Slackbot
03/21/2022, 10:35 AMCristianGM
03/21/2022, 12:40 PMtomas-mrkvicka
03/21/2022, 12:41 PMCristianGM
03/21/2022, 12:44 PMCristianGM
03/21/2022, 12:44 PMtomas-mrkvicka
03/21/2022, 12:49 PMtaskB to start its execution after all taskA are done. No dependency between them. Just simple task ordering.Vampire
03/21/2022, 3:33 PMtaskA in a project then you reference exactly that projects taskA. So if you do taskB.mustRunAfter(taskA) , yes it of course only affects that projects taskA.
You probably need something like taskB.mustRunAfter(allprojects*.tasks*.withType(TaskAType)) or similar. Hard to say concretely with that little information.tomas-mrkvicka
03/21/2022, 8:42 PMmustRunAfter and shouldRunAfter talking about parallel execution. And I immediately applied those two words to multi project parallelization (because there is no default task parallelization in single project setup as far as I know).
Thank you for the clarification.
In my setup, both taskA and taskB have the very same type. They differ in inputs only. They are generated according to the user configuration. So I can distinguish them by names only.
The solution with gradle.projectsEvaluated I posted above works for my use case.Vampire
03/21/2022, 10:03 PMThe reason of my doubts was one sentence from: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:ordering_tasks
describing a difference betweenNot sure what parallelization and difference betweenandmustRunAftertalking about parallel execution. And I immediately applied those two words to multi project parallelization (because there is no default task parallelization in single project setup as far as I know).shouldRunAfter
mustRunAfter and shouldRunAfter have to do with your question.
Actually there is also task parallelization in single project depending on conditions.
For example if you use configuration cache, tasks run in parallel, that's one of the reasons for it.
Or if you have tasks using the worker api at least the work items can run while another indpendent task starts in parallel already even without configuration cache.
So mustRunAfter enforces order even if things could be done in parallel, shouldRunAfter not.
In my setup, bothandtaskAhave the very same type. They differ in inputs only. They are generated according to the user configuration. So I can distinguish them by names only.taskB
The solution withThen maybe something likeI posted above works for my use case.gradle.projectsEvaluated
taskB.mustRunAfter(allprojects*.tasks*.withType(TaskAType)*.matching { it.name == 'taskA' }) (just do not use matching without withType or you force realization of each and every task, making task configuration avoidance void).
If you use projectsEvaluated and it is ok for your use-case it might be ok.
But you might miss tasks added in a later hook then if that might be an issue.