This message was deleted.
# community-support
s
This message was deleted.
c
Maybe you need to depend on the artifact generated on the taskA of all the projects, and not the tasks.
t
There is no dependency between the tasks.
Then, why you need the mustRunAfter?
t
I simply want any
taskB
to start its execution after all
taskA
are done. No dependency between them. Just simple task ordering.
v
Well, it is less a matter of scope. It is simply if you reference
taskA
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.
t
The reason of my doubts was one sentence from: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:ordering_tasks describing a difference between
mustRunAfter
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.
v
The reason of my doubts was one sentence from: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:ordering_tasks
describing a difference between
mustRunAfter
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).
Not sure what parallelization and difference between
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, 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.
Then maybe something like
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.