# Gradle

@ServiceScope(value = Build::class)
interface Gradle : PluginAware, ExtensionAware(source)

Represents an invocation of Gradle.

You can obtain a `Gradle` instance by calling getGradle.

## Functions

addBuildListener
Link copied to clipboard
abstract fun addBuildListener(buildListener: BuildListener)
Adds a BuildListener to this Build instance.
addListener
Link copied to clipboard
abstract fun addListener(listener: Any)
Adds the given listener to this build.
addProjectEvaluationListener
Link copied to clipboard
abstract fun addProjectEvaluationListener(listener: ProjectEvaluationListener): ProjectEvaluationListener
Adds a listener to this build, to receive notifications as projects are evaluated.
afterProject
Link copied to clipboard
abstract fun afterProject(closure: Closure)
Adds a closure to be called immediately after a project is evaluated.
abstract fun afterProject(action: Action<in Project>)
Adds an action to be called immediately after a project is evaluated.
allprojects
Link copied to clipboard
abstract fun allprojects(action: Action<in Project>)
Adds an action to execute against all projects of this build.
apply
Link copied to clipboard
abstract fun apply(@DelegatesTo(value = ObjectConfigurationAction::class) closure: Closure)
abstract fun apply(action: Action<in ObjectConfigurationAction>)
Applies zero or more plugins or scripts.
abstract fun apply(options: Map<String, out Any>)
Applies a plugin or script, using the given options provided as a map.
beforeProject
Link copied to clipboard
abstract fun beforeProject(closure: Closure)
Adds a closure to be called immediately before a project is evaluated.
abstract fun beforeProject(action: Action<in Project>)
Adds an action to be called immediately before a project is evaluated.
beforeSettings
Link copied to clipboard
abstract fun beforeSettings(@DelegatesTo(value = Settings::class) closure: Closure<out Any>)
abstract fun beforeSettings(action: Action<in Settings>)
Adds an action to be called before the build settings have been loaded and evaluated.
buildFinished
Link copied to clipboard
abstract fun buildFinished(closure: Closure)
Adds a closure to be called when the build is completed.
abstract fun buildFinished(action: Action<in BuildResult>)
Adds an action to be called when the build is completed.
getBuildPath
Link copied to clipboard
abstract fun getBuildPath(): String
Get the path of this build relative to the root build.
getExtensions
Link copied to clipboard
@Internal
abstract fun getExtensions(): ExtensionContainer
The container of extensions.
getGradle
Link copied to clipboard
abstract fun getGradle(): Gradle
Returns this `Gradle` instance.
getGradleHomeDir
Link copied to clipboard
@Nullable
abstract fun getGradleHomeDir(): @Nullable File
Returns the Gradle home directory, if any.
getGradleUserHomeDir
Link copied to clipboard
abstract fun getGradleUserHomeDir(): File
Returns the Gradle user home directory.
getGradleVersion
Link copied to clipboard
abstract fun getGradleVersion(): String
Returns the current Gradle version.
getIncludedBuilds
Link copied to clipboard
abstract fun getIncludedBuilds(): Collection<IncludedBuild>
Returns the included builds for this build.
getLifecycle
Link copied to clipboard
@Incubating
abstract fun getLifecycle(): GradleLifecycle
Gives access to the new Gradle build lifecycle callbacks.
getParent
Link copied to clipboard
@Nullable
abstract fun getParent(): @Nullable Gradle
Returns the parent build of this build, if any.
getPluginManager
Link copied to clipboard
abstract fun getPluginManager(): PluginManager
The plugin manager for this plugin aware object.
getPlugins
Link copied to clipboard
abstract fun getPlugins(): PluginContainer
The container of plugins that have been applied to this object.
getProviders
Link copied to clipboard
@Incubating
abstract fun getProviders(): ProviderFactory
Provides access to methods to create various kinds of org.gradle.api.provider.Provider instances.
getRootProject
Link copied to clipboard
abstract fun getRootProject(): Project
Returns the root project of this build.
getSharedServices
Link copied to clipboard
abstract fun getSharedServices(): BuildServiceRegistry
Returns the build services that are shared by all projects of this build.
getStartParameter
Link copied to clipboard
abstract fun getStartParameter(): StartParameter
Returns the StartParameter used to start this build.
getTaskGraph
Link copied to clipboard
abstract fun getTaskGraph(): TaskExecutionGraph
Returns the TaskExecutionGraph for this build.
includedBuild
Link copied to clipboard
abstract fun includedBuild(name: String): IncludedBuild
Returns the included build with the specified name for this build.
projectsEvaluated
Link copied to clipboard
abstract fun projectsEvaluated(closure: Closure)
Adds a closure to be called when all projects for the build have been evaluated.
abstract fun projectsEvaluated(action: Action<in Gradle>)
Adds an action to be called when all projects for the build have been evaluated.
projectsLoaded
Link copied to clipboard
abstract fun projectsLoaded(closure: Closure)
Adds a closure to be called when the projects for the build have been created from the settings.
abstract fun projectsLoaded(action: Action<in Gradle>)
Adds an action to be called when the projects for the build have been created from the settings.
removeListener
Link copied to clipboard
abstract fun removeListener(listener: Any)
Removes the given listener from this build.
removeProjectEvaluationListener
Link copied to clipboard
abstract fun removeProjectEvaluationListener(listener: ProjectEvaluationListener)
Removes the given listener from this build.
rootProject
Link copied to clipboard
abstract fun rootProject(action: Action<in Project>)
Adds an action to execute against the root project of this build.
settingsEvaluated
Link copied to clipboard
abstract fun settingsEvaluated(closure: Closure)
Adds a closure to be called when the build settings have been loaded and evaluated.
abstract fun settingsEvaluated(action: Action<in Settings>)
Adds an action to be called when the build settings have been loaded and evaluated.
useLogger
Link copied to clipboard
abstract fun useLogger(logger: Any)
Uses the given object as a logger.