anchor.diff:  [[sec:how_do_i_defer_configuration]]
   ==== How do I defer task configuration?
   
  -Existing APIs like api:org.gradle.api.DomainObjectCollection#all(org.gradle.api.Action)[] and api:org.gradle.api.DomainObjectCollection#withType(java.lang.Class,org.gradle.api.Action)[] require Gradle to fallback to the old behavior of eagerly creating and configuration tasks. To defer task configuration, you will need to migrate to a new API equivalent. See the <<sec:old_vs_new_configuration_api_overview,table below>> to identify the new API alternative.
  +Existing APIs like api:org.gradle.api.DomainObjectCollection#all(org.gradle.api.Action)[] and api:org.gradle.api.DomainObjectCollection#withType(java.lang.Class,org.gradle.api.Action)[] will immediately create and configure any registered tasks. To defer task configuration, you will need to migrate to a new API equivalent. See the <<sec:old_vs_new_configuration_api_overview,table below>> to identify the new API alternative.
   
   [[sec:how_do_i_reference_a_task]]
   ==== How do I reference a task without creating/configuring it?
  
positive.code: 3. Lists of the type of tasks that were created with the old API. This is a good list to work down to increase the amount of possible avoidable task configuration. 
  4. Lists of the type of tasks that were created with the new API but were created/configured anyways. This is a good list to work down to increase the amount of task configuration that is avoided.
  
  These statistics are printed out once per build. So projects with buildSrc will display this information twice (once for buildSrc, once for the root build).  In a build that uses the new APIs perfectly, we should see 0 tasks created with the old API and only 1 created/configured task because we are only executing the `help` task. If you run other tasks (like `build`), you should expect many more tasks to be created and configured.
  
  You can use the list of task types to guide which tasks would provide the biggest bang for your buck when you migrate to the new API.
  
  To approximate the time it takes to configure a build without executing tasks, you can run `gradle help`. Please use the Gradle Profiler to measure your build as described in <<sec:new_task_gradle_profiler_scenario>>.
  
  [[sec:task_configuration_avoidance_pitfalls]]
  ==== Pitfalls and examples
  
  The following guidelines should be followed when using the new APIs:
  
  
negative.code: 
  [cols="a,a", options="header"]
  |===
  | Old vs New API 
  | Description 
  
  | Old: `task myTask(type: MyTask) {}`
  .2+| There is not a shorthand Groovy DSL for using the new API.
  | New: `tasks.register("myTask", MyTask) {}`
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.util.Map)[]
  .2+| Use one of the alternatives below.
  | New: No direct equivalent.
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.util.Map,groovy.lang.Closure)[]
  .2+| Use one of the alternatives below.
  | New: No direct equivalent.
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.lang.String)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskContainer#register(java.lang.String)[]
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.lang.String,groovy.lang.Closure)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskContainer#register(java.lang.String,org.gradle.api.Action)[]
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.lang.String,java.lang.Class)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskContainer#register(java.lang.String,java.lang.Class)[]
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.lang.String,java.lang.Class,org.gradle.api.Action)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskContainer#register(java.lang.String,java.lang.Class,org.gradle.api.Action)[]
  
  | Old: api:org.gradle.api.tasks.TaskContainer#create(java.lang.String,java.lang.Class,java.lang.Object...)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskContainer#register(java.lang.String,java.lang.Class,java.lang.Object...)[]
  
  | Old: api:org.gradle.api.tasks.TaskCollection#getByName(java.lang.String)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskCollection#named(java.lang.String)[]
  
  | Old: api:org.gradle.api.tasks.TaskCollection#getByName(java.lang.String,groovy.lang.Closure)[]
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: `named(java.lang.String).configure(Action)`
  
  | Old: api:org.gradle.api.tasks.TaskContainer#getByPath(java.lang.String)[]
  .2+| Accessing tasks from another project requires a specific ordering of project evaluation. 
  | New: No direct equivalent.
  
  | Old: api:org.gradle.api.NamedDomainObjectCollection#findByName(java.lang.String)[]
  .2+| `named(String)` is the closest equivalent, but will fail if the task does not exist. Using `findByName(String)` will cause tasks registered with the new API to be created/configured.
  | New: No direct equivalent.
  
  | Old: api:org.gradle.api.tasks.TaskContainer#findByPath(java.lang.String)[]
  .2+| See `getByPath(String)` above.
  | New: No direct equivalent.
  
  | Old: api:org.gradle.api.tasks.TaskCollection#withType(java.lang.Class)[]
  .2+| This is OK to use because it does not require tasks to be created immediately.
  | New: _OK_
  
  | Old: `withType(java.lang.Class).getByName(java.lang.String)`
  .2+| This returns a `TaskProvider` instead of a `Task`.
  | New: `withType(java.lang.Class).named(java.lang.String)`
  
  | Old: api:org.gradle.api.DomainObjectCollection#withType(java.lang.Class,org.gradle.api.Action)[]
  .2+| This returns `void`, so it cannot be chained.
  | New: `withType(java.lang.Class).configureEach(org.gradle.api.Action)`
  
  | Old: api:org.gradle.api.DomainObjectCollection#all(org.gradle.api.Action)[]
  .2+| This returns `void`, so it cannot be chained.
  | New: api:org.gradle.api.DomainObjectCollection#configureEach(org.gradle.api.Action)[]
  
  | Old: api:org.gradle.api.NamedDomainObjectSet#findAll(groovy.lang.Closure)[]
  .2+| Avoid calling this method. `matching(Spec)` and `configureEach(Action)` are more appropriate in most cases.
  | New: _OK_, with issues.
  
  | Old: api:org.gradle.api.tasks.TaskCollection#matching(groovy.lang.Closure)[]
  .2+| This is OK to use because it does not require tasks to be created immediately.
  | New: _OK_
  
  | Old: api:org.gradle.api.tasks.TaskCollection#getAt(java.lang.String)[]
  .2+| Avoid calling this directly as it's a Groovy convenience method. The alternative returns a `TaskProvider` instead of a `Task`.
  | New: api:org.gradle.api.tasks.TaskCollection#named(java.lang.String)[]
  
  | Old: `iterator()` or implicit iteration over the `Task` collection
  .2+| Avoid doing this as it requires creating and configuring all tasks. See `findAll(Closure)` above.
  | New: _OK_, with issues.
  
  | Old: `remove(org.gradle.api.Task)`
  .2+| Avoid calling this. The behavior of `remove` with the new API may change in the future.
  | New: _OK_, with issues.
  
  | Old: api:org.gradle.api.tasks.TaskContainer#replace(java.lang.String)[]
  .2+| Avoid calling this. The behavior of `replace` with the new API may change in the future.
  | New: _OK_, with issues.
  
  | Old: api:org.gradle.api.tasks.TaskContainer#replace(java.lang.String,java.lang.Class)[]
  .2+| Avoid calling this. The behavior of `replace` with the new API may change in the future.
  | New: _OK_, with issues.
  
  |===
  
  