|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
org.gradle.api.plugins.PluginAware org.gradle.api.initialization.Settings
public interface Settings extends PluginAware
Declares the configuration required to instantiate and configure the hierarchy of Project instances which are to participate in a build.
There is a one-to-one correspondence between a Settings
instance and a {
settings file. Before Gradle assembles the projects for a build, it creates a
Settings
instance and executes the settings file against it.
One of the purposes of the Settings
object is to allow you to declare the projects which are to be
included in the build. You add projects to the build using the include(String[]) method. There is always a
root project included in a build. It is added automatically when the Settings
object is created. The
root project's name defaults to the name of the directory containing the settings file. The root project's project
directory defaults to the directory containing the settings file.
When a project is included in the build, a ProjectDescriptor is created. You can use this descriptor to change the default values for several properties of the project.
In addition to the properties of this interface, the Settings object makes some additional read-only properties available to the settings script. This includes properties from the following sources:
Field Summary | |
---|---|
String |
DEFAULT_SETTINGS_FILE
|
Method Summary | |
---|---|
ProjectDescriptor
|
findProject(String path)
|
ProjectDescriptor
|
findProject(File projectDir)
|
Gradle
|
getGradle()
Returns the Gradle instance for the current build. |
File
|
getRootDir()
|
ProjectDescriptor
|
getRootProject()
|
Settings
|
getSettings()
|
File
|
getSettingsDir()
|
StartParameter
|
getStartParameter()
|
void
|
include(String[] projectPaths)
|
void
|
includeFlat(String[] projectNames)
|
ProjectDescriptor
|
project(String path)
|
ProjectDescriptor
|
project(File projectDir)
|
Methods inherited from interface PluginAware | |
---|---|
apply, apply, getPlugins |
Field Detail |
---|
public String DEFAULT_SETTINGS_FILE
The default name for the settings file.
Method Detail |
---|
public ProjectDescriptor findProject(String path)
Returns the project with the given path.
path
- The path
public ProjectDescriptor findProject(File projectDir)
Returns the project with the given project directory.
projectDir
- The project directory.
public Gradle getGradle()
public File getRootDir()
Returns the root directory of the build. The root directory is the project directory of the root project.
public ProjectDescriptor getRootProject()
Returns the root project of the build.
public Settings getSettings()
Returns this settings object.
public File getSettingsDir()
Returns the settings directory of the build. The settings directory is the directory containing the settings file.
public StartParameter getStartParameter()
Returns the set of parameters used to invoke this instance of Gradle.
public void include(String[] projectPaths)
Adds the given projects to the build. Each path in the supplied list is treated as the path of a project to add to the build. Note that these path are not file paths, but instead specify the location of the new project in the project heirarchy. As such, the supplied paths must use the ':' character as separator.
The last element of the supplied path is used as the project name. The supplied path is converted to a project directory relative to the root project directory.
As an example, the path a:b adds a project with path :a:b, name b and project directory $rootDir/a/b.
projectPaths
- the projects to add.
public void includeFlat(String[] projectNames)
Adds the given projects to the build. Each name in the supplied list is treated as the name of a project to add to the build.
The supplied name is converted to a project directory relative to the parent directory of the root project directory.
As an example, the name a add a project with path :a, name a and project directory $rootDir/../a.
projectNames
- the projects to add.
public ProjectDescriptor project(String path)
Returns the project with the given path.
path
- The path.
public ProjectDescriptor project(File projectDir)
Returns the project with the given project directory.
projectDir
- The project directory.
Gradle API 1.12