I have enabled parallel builds with Gradle and I h...
# community-support
s
I have enabled parallel builds with Gradle and I have several subprojects whose tasks should have been executed in parallel but they don’t seem to be. How can I find out why Gradle executes them sequentially? Any particular logs I could enable?
v
If you can, I would recommend you do not enable parallel mode, but instead enable configuration cache. With that all tasks, even within one project, can run in parallel as long as they do not depend on each other.
s
I have quite a lot of custom tasks that don’t support configuration cache and some code in the build project that does incompatible things, so I’m not ready to modernize everything yet.
but eventually, definitely.
v
Sad
Well, then maybe you do not have enough max-workers to do the things in parallel?
s
for now I have project A and project B that should be completely independent and project C that depends on them, and I see that Gradle runs some preparation tasks from A and B in parallel but not the main build task. I’d like to understand whether it sees an unintended dependency between the tasks in A and B.
v
Otherwise, the tasks probably depend on each other somehow and thus cannot run in parallel
Maybe just trigger the tasks in B and check whether the tasks in A get run automatically by that. (you can also use
-m
to not actually execute them but just show what would run)
s
hmm right
I could confirm there are no dependencies between tasks.
ok I think it’s probably working, just Gradle seems too lazy to start a new build process at times.
👌 1
it almost seems to me as if Gradle was scheduling tasks on parallel runners in advance, without taking into account how long each task actually takes.
it could run task A:x which enables B:x and C:x to run in parallel, then task A:y from the same project which depends only on A:x, but it instead chooses to run A:x, then A:y, and only then starts B:x and C:x.
v
🤷‍♂️