Things I learned in the book Gradle beyond the basics

Help me improve this document!


Tasks can be created by rules. These tasks are called “task rules”. They are dynamically created when a task matching their pattern is invoked.


Single project build phase

Initialization phase

  1. Execute settings.gradle
  2. Determine whether it’s a single project or a multi-project
  3. Locate the build files
  4. Create a Project object

Configuration phase

  1. Load the Project object
  2. Execute gradle.projectsLoaded()
  3. Execute project.beforeEvaluate()
  4. Execute the build file as groovy scripts, against the Project object
    1. DAG gets created
    2. Hook methods are run
  5. Execute project.afterEvaluate()
  6. Execute gradle.projectsEvaluated()

Execution phase

  1. Identifies the tasks to run
  2. Execute the tasks marked for execution
  3. Execute gradle.buildFinished()

Multi-project build phase

I am guessing that this puts a couple of  loops in the configuration phase and in the execution phase…