What order does Gradle build modules in with parallel build enabled?

Viewed 606

Want to know if a project would compile faster if like the one really big common module could be split into submodule so the dependency graph is less like a pyramid

  *    
 / \
*   *  

and more like a square

*  *  <-- build top level dependencies faster because can build concurrently on multi core CPU 
|/ |
*  *

or does Gradle not build in the in order of the dependencies?

Was curios if project could build faster if higher level modules can be built in parallel.

edit

My understanding is that there is a task tree, and Gradle builds in order of the task tree, so that might be the direction I should look in.

1 Answers

Gradle will not execute two tasks in the same project in parallel, it will only execute tasks from different projects in parallel. Once the task graph ordering is taken into account, Gradle will execute projects in alphabetical order.

If you want to understand the task tree, add the task tree plugin to your build.

You can then do something like

gradle build taskTree

Which will ioutput something like

:build
+--- :assemble
|    \--- :jar
|         \--- :classes
|              +--- :compileJava
|              \--- :processResources
\--- :check
     \--- :test
          +--- :classes
          |    +--- :compileJava
          |    \--- :processResources
          \--- :testClasses
               +--- :compileTestJava
               |    \--- :classes
               |         +--- :compileJava
               |         \--- :processResources
               \--- :processTestResources
Related