Gradle Settings Script and Settings Instance
DEPLETE TO
Overview
The settings.gradle file describes the build's project hierarchy. In the simplest case, there is no settings.gradle, and the build consists in just a single project, the root project. In more complex cases, various sub-project hierarchies can be specified. The file can also be used to add libraries to the build script classpath. The configuration file is executed during the initialization phase and updates the state of the delegate Settings instance. For single-project builds, this file is optional. However, it is required for multi-project builds: the root project of the multi-project build must declare this file.
Project Hierarchy
TODO: next time I am here, describe differences between 'include' and 'includeFlat'.
The sub-projects of a multi-project build are declared in the settings.gradle file of the root project with the Settings include(...) or includeFlat(...) methods:
include 'subproject1', 'subproject2:child1'
The include(...) method specifies a multi-project build hierarchical layout. It takes hierarchical project paths as arguments.
includeFlat 'subproject1', 'subproject2'
The includeFlat(...) method specifies a multi-project build flat layout. It expects a flat sibling structure.
Resolution
- Look at a directory called "master" on the same nesting level as the current directory.
- If not found, search parent directories.
- If not found, the build executes as a single project build.
- If found, Gradle checks if the current project is part of multi-project hierarchy defined in the found settings.gradle file. If not, the build is executed as a single project build. Otherwise, a multi project build executed.
rootProject.name
rootProject.name = 'some-name'
More details: