- 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.
- JavaScript+DHTML語法與范例詳解詞典
- Python量化投資指南:基礎、數據與實戰(zhàn)
- Spring技術內幕:深入解析Spring架構與設計
- Vue.js快速入門與深入實戰(zhàn)
- Java性能權威指南(第2版)
- PHP+MySQL+Dreamweaver動態(tài)網站開發(fā)實例教程
- 人人都懂設計模式:從生活中領悟設計模式(Python實現(xiàn))
- 基于Swift語言的iOS App 商業(yè)實戰(zhàn)教程
- 表哥的Access入門:以Excel視角快速學習數據庫開發(fā)(第2版)
- 領域驅動設計:軟件核心復雜性應對之道(修訂版)
- Visual Studio Code 權威指南
- Java程序設計教程
- Xamarin Cross-Platform Development Cookbook
- 例說FPGA:可直接用于工程項目的第一手經驗
- Java Web動態(tài)網站開發(fā)(第2版·微課版)