- Mastering Gradle
- Mainak Mitra
- 322字
- 2021-07-16 20:49:34
Build life cycle
Gradle build has a life cycle, which consists of three phases: initialization, configuration, and execution. Understanding the build life cycle and the execution phases is crucial for Gradle developers. Gradle build is primarily a collection of tasks and a user can define the dependency between the tasks. So, even if two tasks depend on the same task, for example, Task C and Task B both depend on Task A, Gradle makes sure that Task A will execute only once throughout the execution of the build script.
Before executing any task, Gradle prepares a Directed Acyclic Graph (DAG) of all tasks for the build. It is directed because a task directly depends on another task. It is acyclic because, if Task A depends on Task B and if you make Task B depend on Task A, it will result in an error, as there can't be cyclic dependency between two tasks. Before executing the build script, Gradle configures the task dependency graph.
Let's quickly discuss the three build phases.
Initialization
User can create a build script for a single project as well as for a Multi-project build. During the initialization phase, Gradle determines which projects are going to take part in the build process, and creates a Project instance for each of these projects.
Configuration
This phase configures the project object. All the build scripts (in case the user is executing a multiproject build), which are part of the build process are executed without executing any task. This means whatever statements you have written outside of the task in the configuration block would be executed in the configuration phase. No tasks would be executed here; only the directed acyclic graph would be created for all tasks.
- DBA攻堅(jiān)指南:左手Oracle,右手MySQL
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第三版)
- C# 2012程序設(shè)計(jì)實(shí)踐教程 (清華電腦學(xué)堂)
- Python機(jī)器學(xué)習(xí)經(jīng)典實(shí)例
- BIM概論及Revit精講
- Learning FuelPHP for Effective PHP Development
- 執(zhí)劍而舞:用代碼創(chuàng)作藝術(shù)
- C++編程兵書
- IDA Pro權(quán)威指南(第2版)
- CodeIgniter Web Application Blueprints
- 青少年學(xué)Python(第2冊)
- Implementing Microsoft Dynamics NAV(Third Edition)
- Three.js權(quán)威指南:在網(wǎng)頁上創(chuàng)建3D圖形和動(dòng)畫的方法與實(shí)踐(原書第4版)
- Android 游戲開發(fā)大全(第二版)
- Oracle SOA Suite 12c Administrator's Guide