Gradle ProjectDescriptor: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
Line 5: Line 5:
* [[Gradle Concepts]]
* [[Gradle Concepts]]
=Overview=
=Overview=
Project information can be accessed from [[settings.gradle]] via ProjectDescriptor instances. [[Gradle_Project|Project]] instances are not accessible at this stage. ProjectDescriptor instances are created when a new project is added to the build from the settings script via <code>include</code> or <code>includeFlat</code>.
The ProjectDescriptor instances can be looked up in settings.gradle as follows:
<syntaxhighlight lang='groovy'>
project(':subproject-A')
</syntaxhighlight>
<syntaxhighlight lang='groovy'>
findProject(':subproject-A')
</syntaxhighlight>
The methods take a path as arguments and return the corresponding ProjectDescriptor instance. The ProjectDescriptor instance can be use to access and mutate state of the corresponding project.

Latest revision as of 21:41, 11 October 2020

External

Internal

Overview

Project information can be accessed from settings.gradle via ProjectDescriptor instances. Project instances are not accessible at this stage. ProjectDescriptor instances are created when a new project is added to the build from the settings script via include or includeFlat.

The ProjectDescriptor instances can be looked up in settings.gradle as follows:

project(':subproject-A')
findProject(':subproject-A')

The methods take a path as arguments and return the corresponding ProjectDescriptor instance. The ProjectDescriptor instance can be use to access and mutate state of the corresponding project.