# Gradle

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

Represents an invocation of Gradle.

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

## Properties

extra
Link copied to clipboard
val ExtensionAware.extra: ExtraPropertiesExtension

The extra properties extension in this object's extension container.

## 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(closure: Closure)
apply
Link copied to clipboard
inline fun <T : Plugin<Gradle>> Gradle.apply()
inline fun <T : Plugin<*>> PluginAware.apply()

Applies the plugin of the given type T. Does nothing if the plugin has already been applied.

inline fun PluginAware.apply(vararg options: Pair<String, Any>)

Kotlin extension function for org.gradle.api.plugins.PluginAware.apply.

fun PluginAware.apply(from: Any? = null, plugin: String? = null, to: Any? = null)

Applies the given plugin or script.

applyTo
Link copied to clipboard
inline fun <T : Plugin<*>> PluginAware.applyTo(vararg targets: Any)

Applies the plugin of the given type T to the specified object. Does nothing if the plugin has already been applied.

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.
configure
Link copied to clipboard
inline fun <T : Any> ExtensionAware.configure(noinline configuration: T.() -> Unit)

Executes the given configuration block against the extension of the specified type.

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
abstract fun getExtensions(): ExtensionContainer
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
getPlugins
Link copied to clipboard
abstract fun getPlugins(): PluginContainer
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.
the
Link copied to clipboard
inline fun <T : Any> ExtensionAware.the(): T

Returns the extension of the specified type.

fun <T : Any> ExtensionAware.the(extensionType: KClass<T>): T

Returns the extension of the specified extensionType.

useLogger
Link copied to clipboard
abstract fun useLogger(logger: Any)
Uses the given object as a logger.