Gradle Project and Build Script: Difference between revisions
Line 12: | Line 12: | ||
A Project is the main API to use to interact with Gradle. All top level statements within a "build.gradle" build script are delegated to the corresponding Project instance and when executed, modify its state. | A Project is the main API to use to interact with Gradle. All top level statements within a "build.gradle" build script are delegated to the corresponding Project instance and when executed, modify its state. | ||
In case of a multi-project build, It is possible to configure a project build from another build script associated with any project in the hierarchy. This capability is called ''cross-project configuration''. Gradle implements cross-project configuration via configuration injection. Configuration injection is the default way to define common behavior. | In case of a [[#Multi-Project_Builds|multi-project build]], It is possible to configure a project build from another build script associated with any project in the hierarchy. This capability is called ''cross-project configuration''. Gradle implements cross-project configuration via ''configuration injection''. Configuration injection is the default way to define common behavior. | ||
=Multi-Project Builds= | =Multi-Project Builds= |
Revision as of 01:13, 19 May 2018
External
- https://docs.gradle.org/current/dsl/org.gradle.api.Project.html
- Build script structure https://docs.gradle.org/current/dsl/#N10060
Internal
Overview
A Project is the main API to use to interact with Gradle. All top level statements within a "build.gradle" build script are delegated to the corresponding Project instance and when executed, modify its state.
In case of a multi-project build, It is possible to configure a project build from another build script associated with any project in the hierarchy. This capability is called cross-project configuration. Gradle implements cross-project configuration via configuration injection. Configuration injection is the default way to define common behavior.
Multi-Project Builds
Root Project
Multi-Project Build Layout
Sub-Project
Top-Level Script Blocks
allprojects{}
Applies the given configuration closure, in order, to the current project and all of its sub-projects.
subprojects{}
Applies the given configuration closure, in order, to all sub-projects of the current project.