Build phases
A Gradle build follows a very simple life cycle on every invocation. The build passes through three stages: initialization, configuration, and execution. When a gradle
command is invoked, not all the code written in our build file executes sequentially from top to bottom. Only the blocks of code that are relevant to the current phase of the build are executed. Also, the build phase's order determines when the block of code will execute. An example is the task configuration versus task execution. Understanding of these phases is important to correctly configure our build.
Initialization
Gradle first figures out whether the current project has child projects or if it is the only project in the build. For multiprojects build, Gradle figures out which projects (or sub-module, as many prefer to call them) have to be included in the build. We will see multiproject builds in the next chapter. Gradle then creates a Project
instance for the root project and for each of the child projects...