Gradle: configuration phase vs execution phase

task clean()  {
  // runs always
  doLast {
    // runs only when executed
    delete "${buildDir}"
  }
}