interface Gradle : PluginAware
Represents an invocation of Gradle.
You can obtain a Gradle
instance by calling Project#getGradle()
.
abstract fun addBuildListener(buildListener: BuildListener): Unit
Adds a BuildListener to this Build instance. The listener is notified of events which occur during the execution of the build. |
|
abstract fun addListener(listener: Any): Unit
Adds the given listener to this build. The listener may implement any of the given listener interfaces:
|
|
abstract fun addProjectEvaluationListener(listener: ProjectEvaluationListener): ProjectEvaluationListener
Adds a listener to this build, to receive notifications as projects are evaluated. |
|
abstract fun afterProject(closure: Closure<Any>): Unit
Adds a closure to be called immediately after a project is evaluated. The project is passed to the closure as the first parameter. The project evaluation failure, if any, is passed as the second parameter. Both parameters are optional. abstract fun afterProject(action: Action<in Project>): Unit
Adds an action to be called immediately after a project is evaluated. |
|
abstract fun allprojects(action: Action<in Project>): Unit
Adds an action to execute against all projects of this build. The action is executed immediately against all projects which are already available. It is also executed as subsequent projects are added to this build. |
|
abstract fun beforeProject(closure: Closure<Any>): Unit
Adds a closure to be called immediately before a project is evaluated. The project is passed to the closure as a parameter. abstract fun beforeProject(action: Action<in Project>): Unit
Adds an action to be called immediately before a project is evaluated. |
|
abstract fun buildFinished(closure: Closure<Any>): Unit
Adds a closure to be called when the build is completed. All selected tasks have been executed. A BuildResult instance is passed to the closure as a parameter. abstract fun buildFinished(action: Action<in BuildResult>): Unit
Adds an action to be called when the build is completed. All selected tasks have been executed. |
|
abstract fun buildStarted(closure: Closure<Any>): Unit
Adds a closure to be called when the build is started. This abstract fun buildStarted(action: Action<in Gradle>): Unit
Adds an action to be called when the build is started. |
|
abstract fun getGradle(): Gradle
Returns this |
|
abstract fun getGradleHomeDir(): File
Returns the Gradle home directory, if any. This directory is the directory containing the Gradle distribution executing this build. When using the “Gradle Daemon”, this may not be the same Gradle distribution that the build was started with. If an existing daemon process is running that is deemed compatible (e.g. has the desired JVM characteristics) then this daemon may be used instead of starting a new process and it may have been started from a different “gradle home”. However, it is guaranteed to be the same version of Gradle. For more information on the Gradle Daemon, please consult the user guide. |
|
abstract fun getGradleUserHomeDir(): File
Returns the Gradle user home directory. This directory is used to cache downloaded resources, compiled build scripts and so on. |
|
abstract fun getGradleVersion(): String
Returns the current Gradle version. |
|
abstract fun getIncludedBuilds(): MutableCollection<IncludedBuild>
Returns the included builds for this build. |
|
abstract fun getParent(): Gradle
Returns the parent build of this build, if any. |
|
abstract fun getRootProject(): Project
Returns the root project of this build. |
|
abstract fun getStartParameter(): StartParameter
Returns the StartParameter used to start this build. |
|
abstract fun getTaskGraph(): TaskExecutionGraph
Returns the TaskExecutionGraph for this build. |
|
abstract fun includedBuild(name: String): IncludedBuild
Returns the included build with the specified name for this build. |
|
abstract fun projectsEvaluated(closure: Closure<Any>): Unit
Adds a closure to be called when all projects for the build have been evaluated. The project objects are fully configured and are ready to use to populate the task graph. This abstract fun projectsEvaluated(action: Action<in Gradle>): Unit
Adds an action to be called when all projects for the build have been evaluated. The project objects are fully configured and are ready to use to populate the task graph. |
|
abstract fun projectsLoaded(closure: Closure<Any>): Unit
Adds a closure to be called when the projects for the build have been created from the settings. None of the projects have been evaluated. This An example of hooking into the projectsLoaded to configure buildscript classpath from the init script.
abstract fun projectsLoaded(action: Action<in Gradle>): Unit
Adds an action to be called when the projects for the build have been created from the settings. None of the projects have been evaluated. |
|
abstract fun removeListener(listener: Any): Unit
Removes the given listener from this build. |
|
abstract fun removeProjectEvaluationListener(listener: ProjectEvaluationListener): Unit
Removes the given listener from this build. |
|
abstract fun rootProject(action: Action<in Project>): Unit
Adds an action to execute against the root project of this build. If the root project is already available, the action is executed immediately. Otherwise, the action is executed when the root project becomes available. |
|
abstract fun settingsEvaluated(closure: Closure<Any>): Unit
Adds a closure to be called when the build settings have been loaded and evaluated. The settings object is fully configured and is ready to use to load the build projects. The org.gradle.api.initialization.Settings object is passed to the closure as a parameter. abstract fun settingsEvaluated(action: Action<in Settings>): Unit
Adds an action to be called when the build settings have been loaded and evaluated. The settings object is fully configured and is ready to use to load the build projects. |
|
abstract fun useLogger(logger: Any): Unit
Uses the given object as a logger. The logger object may implement any of the listener interfaces supported by Each listener interface has exactly one associated logger. When you call this method with a logger of a given listener type, the new logger will replace whichever logger is currently associated with the listener type. This allows you to selectively replace the standard logging which Gradle provides with your own implementation, for certain types of events. |
abstract fun apply(closure: Closure<Any>): Unit abstract fun apply(action: Action<in ObjectConfigurationAction>): Unit
Applies zero or more plugins or scripts. The given closure is used to configure an ObjectConfigurationAction, which “builds” the plugin application. This method differs from abstract fun apply(options: MutableMap<String, *>): Unit
Applies a plugin or script, using the given options provided as a map. Does nothing if the plugin has already been applied. The given map is applied as a series of method calls to a newly created ObjectConfigurationAction. That is, each key in the map is expected to be the name of a method ObjectConfigurationAction and the value to be compatible arguments to that method. The following options are available:
|
|
abstract fun getPluginManager(): PluginManager
The plugin manager for this plugin aware object. |
|
abstract fun getPlugins(): PluginContainer
The container of plugins that have been applied to this object. While not deprecated, it is preferred to use the methods of this interface or the Use one of the 'apply' methods on this interface or on the Use |
fun <T : Plugin<Gradle>> Gradle.apply(): Unit
Applies the plugin of the given type T. Does nothing if the plugin has already been applied. |
abstract class InitScriptApi : Gradle
Standard implementation of the API exposed to all types of Gradle scripts, precompiled and otherwise. |