Gradle Task: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 15: Line 15:
==Tasks From Plugins==
==Tasks From Plugins==


[[Gradle_Plugins#Overview|Plugins]] that have been applied to the project may come with their own tasks.


 
==Explicit Task Declaration==
 


Tasks may be explicitly declared in [[build.gradle]] using Project's task() method. As an example, of the simplest possible task declarations is:
Tasks may be explicitly declared in [[build.gradle]] using Project's task() method. As an example, of the simplest possible task declarations is:
Line 28: Line 28:


<font color=darkgray>A task declared as above will be executed during the configuration phase, not execution. Investigate, this seems odd.</font>
<font color=darkgray>A task declared as above will be executed during the configuration phase, not execution. Investigate, this seems odd.</font>
[[Gradle_Plugins#Overview|Plugins]] that have been applied to the project may come with their own tasks.


=Task Types=
=Task Types=


<font color=darkgray>TODO: https://docs.gradle.org/current/dsl/#N10376</font>
<font color=darkgray>TODO: https://docs.gradle.org/current/dsl/#N10376</font>

Revision as of 22:59, 17 May 2018

External

Internal

Overview

A task is a core Gradle concept. It represents a single atomic piece of work for a build, such as compiling classes or generating javadoc. A build consists in executing a sequence of tasks in succession. Gradle computes the Directed Acyclic Graph of to be executed in order to fulfill the tasks specified on command line, and then executes them honoring inter-task dependencies and insuring the fact that a task is executed only once. Gradle builds the complete dependency graph before any tasks is executed.

Task Declaration

Tasks From Plugins

Plugins that have been applied to the project may come with their own tasks.

Explicit Task Declaration

Tasks may be explicitly declared in build.gradle using Project's task() method. As an example, of the simplest possible task declarations is:

task sample {
    println 'this is a simple task'
}

A task declared as above will be executed during the configuration phase, not execution. Investigate, this seems odd.

Task Types

TODO: https://docs.gradle.org/current/dsl/#N10376