Using the Kotlin Gradle DSL, a task can be defined in several ways:
-
tasks.create(…)
will eagerly configure the task, regardless of whether it is required.
-
tasks.register(…)
lazily configures the task only when it is required. This happens when it is located using query methods such
as TaskCollection.getByName(java.lang.String)
, when it is added to the task graph for execution, or when Provider.get()
is
called on the return value of this method.
It is generally more efficient to use tasks.register(…)
instead of tasks.create(…)
as the task will not be configured
if it is not needed.