Gradle Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 20: Line 20:
<span id='Build_Initialization_Phase'></span><span id='Initialization'></span>'''Initialization phase'''. In case of a simple project, Gradle creates the Project instance. For a multi-project build, and depending on which project is executed, Gradle figures out which of the project dependencies need to participate in the build. [[Gradle Extra Properties#Overview|Extra properties]] for [[Org.gradle.api.invocation.Gradle|Gradle]] and [[Gradle_Settings|Settings]] object instances can be declared at this phase. None of the build scripts is executed in this phase.
<span id='Build_Initialization_Phase'></span><span id='Initialization'></span>'''Initialization phase'''. In case of a simple project, Gradle creates the Project instance. For a multi-project build, and depending on which project is executed, Gradle figures out which of the project dependencies need to participate in the build. [[Gradle Extra Properties#Overview|Extra properties]] for [[Org.gradle.api.invocation.Gradle|Gradle]] and [[Gradle_Settings|Settings]] object instances can be declared at this phase. None of the build scripts is executed in this phase.


<span id='Build_Configuration_Phase'></span><span id='Configuration'></span>'''Configuration phase'''. The code declared in [[build.gradle]] is executed in order. Tasks are [[Gradle_Task#Task_Lifecycle|instantiated and configured]].
<span id='Build_Configuration_Phase'></span><span id='Configuration'></span>'''Configuration phase'''. The code declared in [[build.gradle]] is executed in order. Tasks are [[Gradle_Task#Task_Lifecycle|instantiated and configured]]. Gradle constructs a task DAG. <font color=darkgray>The incremental build features determines if any of the tasks in the model are required to run.</font>


<span id='Build_Execution_Phase'></span><span id='Execution'></span>'''Execution phase'''. Task actions are [[Gradle_Task#Task_Lifecycle|executed]].
<span id='Build_Execution_Phase'></span><span id='Execution'></span>'''Execution phase'''. Task actions are [[Gradle_Task#Task_Lifecycle|executed]].

Revision as of 22:31, 8 October 2020

External

Internal

Overview

Gradle is a general-purpose build tool. It is primarily used to build Java and Groovy, but it can build other languages as well. The goal of a Gradle execution, also known as a Gradle build, is to execute a set of tasks, in sequence. Each build runs according to a well defined build lifecycle, during which Gradle instantiates a complex domain model of the project in memory: a Gradle instance, a Settings instance and the project itself.

Build Lifecycle

A build is a Gradle execution. Each build instantiates at least one project, which in turn contains tasks, and it can be configured and controlled with properties.

Initialization phase. In case of a simple project, Gradle creates the Project instance. For a multi-project build, and depending on which project is executed, Gradle figures out which of the project dependencies need to participate in the build. Extra properties for Gradle and Settings object instances can be declared at this phase. None of the build scripts is executed in this phase.

Configuration phase. The code declared in build.gradle is executed in order. Tasks are instantiated and configured. Gradle constructs a task DAG. The incremental build features determines if any of the tasks in the model are required to run.

Execution phase. Task actions are executed.

Convention over Configuration

Subjects

TO DEPLETE

Gradle Concepts TO DEPLETE