# InitScriptApi

abstract class InitScriptApi(val delegate: Gradle) : GradleDelegate(source)

### Deprecated

Kept for compatibility with precompiled script plugins published with Gradle versions prior to 6.0

#### Replace with

    import org.gradle.api.invocation.Gradle

Content copied to clipboard

    Gradle

Content copied to clipboard

Standard implementation of the API exposed to all types of Gradle scripts, precompiled and otherwise.

#### Inheritors

KotlinInitScript

## Constructors

InitScriptApi
Link copied to clipboard
constructor(delegate: Gradle)

## Properties

buildPath
Link copied to clipboard
open val buildPath: String
delegate
Link copied to clipboard
open override val delegate: Gradle
extensions
Link copied to clipboard
open val extensions: ExtensionContainer
extra
Link copied to clipboard
val ExtensionAware. extra: ExtraPropertiesExtension

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

gradle
Link copied to clipboard
open val gradle: Gradle
gradleHomeDir
Link copied to clipboard
open val gradleHomeDir: File?
gradleUserHomeDir
Link copied to clipboard
open val gradleUserHomeDir: File
gradleVersion
Link copied to clipboard
open val gradleVersion: String
includedBuilds
Link copied to clipboard
open val includedBuilds: MutableCollection<IncludedBuild>
lifecycle
Link copied to clipboard
open val lifecycle: GradleLifecycle
logger
Link copied to clipboard
val logger: Logger

Logger for init scripts. You can use this in your init script to write log messages.

logging
Link copied to clipboard
val logging: LoggingManager

The LoggingManager which can be used to receive logging and to control the standard output/error capture for this script. By default, `System.out` is redirected to the Gradle logging system at the `QUIET` log level, and `System.err` is redirected at the `ERROR` log level.

parent
Link copied to clipboard
open val parent: Gradle?
pluginManager
Link copied to clipboard
open val pluginManager: PluginManager
plugins
Link copied to clipboard
open val plugins: PluginContainer
providers
Link copied to clipboard
open val providers: ProviderFactory
resources
Link copied to clipboard
val resources: ResourceHandler

Provides access to resource-specific utility methods, for example factory methods that create various resources.

rootProject
Link copied to clipboard
open val rootProject: Project
sharedServices
Link copied to clipboard
open val sharedServices: BuildServiceRegistry
startParameter
Link copied to clipboard
open val startParameter: StartParameter
taskGraph
Link copied to clipboard
open val taskGraph: TaskExecutionGraph

## Functions

addBuildListener
Link copied to clipboard
open override fun addBuildListener(buildListener: BuildListener)
addListener
Link copied to clipboard
open override fun addListener(listener: Any)
addProjectEvaluationListener
Link copied to clipboard
open override fun addProjectEvaluationListener(listener: ProjectEvaluationListener): ProjectEvaluationListener
afterProject
Link copied to clipboard
open override fun afterProject(closure: Closure<Any>)
open override fun afterProject(action: Action<in Project>)
allprojects
Link copied to clipboard
open override fun allprojects(action: Action<in Project>)
apply
Link copied to clipboard
open override fun apply(closure: Closure<Any>)
open override fun apply(options: Map<String, *>)
open override fun apply(action: Action<in ObjectConfigurationAction>)
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
open override fun beforeProject(closure: Closure<Any>)
open override fun beforeProject(action: Action<in Project>)
beforeSettings
Link copied to clipboard
open override fun beforeSettings(closure: Closure<*>)
open override fun beforeSettings(action: Action<in Settings>)
buildFinished
Link copied to clipboard
open override fun buildFinished(closure: Closure<Any>)
open override fun buildFinished(action: Action<in BuildResult>)
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.

copy
Link copied to clipboard
fun copy(configuration: CopySpec.() -> Unit): WorkResult

Copies the specified files.

copySpec
Link copied to clipboard
fun copySpec(): CopySpec
fun copySpec(configuration: CopySpec.() -> Unit): CopySpec

Creates a {@link CopySpec} which can later be used to copy files or create an archive.

delete
Link copied to clipboard
fun delete(configuration: DeleteSpec.() -> Unit): WorkResult

Deletes the specified files.

fun delete(vararg paths: Any): Boolean

Deletes files and directories.

file
Link copied to clipboard
fun file(path: Any): File
fun file(path: Any, validation: PathValidation): File

Resolves a file path relative to this script's target base directory.

files
Link copied to clipboard
fun files(vararg paths: Any): ConfigurableFileCollection
fun files(paths: Any, configuration: ConfigurableFileCollection.() -> Unit): ConfigurableFileCollection

Creates a ConfigurableFileCollection containing the given files.

fileTree
Link copied to clipboard
fun fileTree(baseDir: Any): ConfigurableFileTree
fun fileTree(baseDir: Any, configuration: ConfigurableFileTree.() -> Unit): ConfigurableFileTree

Creates a new ConfigurableFileTree using the given base directory.

getBuildPath
Link copied to clipboard
open override fun getBuildPath(): String
getExtensions
Link copied to clipboard
open override fun getExtensions(): ExtensionContainer
getGradle
Link copied to clipboard
open override fun getGradle(): Gradle
getGradleHomeDir
Link copied to clipboard
open override fun getGradleHomeDir(): File?
getGradleUserHomeDir
Link copied to clipboard
open override fun getGradleUserHomeDir(): File
getGradleVersion
Link copied to clipboard
open override fun getGradleVersion(): String
getIncludedBuilds
Link copied to clipboard
open override fun getIncludedBuilds(): MutableCollection<IncludedBuild>
getLifecycle
Link copied to clipboard
open override fun getLifecycle(): GradleLifecycle
getParent
Link copied to clipboard
open override fun getParent(): Gradle?
getPluginManager
Link copied to clipboard
open override fun getPluginManager(): PluginManager
getPlugins
Link copied to clipboard
open override fun getPlugins(): PluginContainer
getProviders
Link copied to clipboard
open override fun getProviders(): ProviderFactory
getRootProject
Link copied to clipboard
open override fun getRootProject(): Project
getSharedServices
Link copied to clipboard
open override fun getSharedServices(): BuildServiceRegistry
getStartParameter
Link copied to clipboard
open override fun getStartParameter(): StartParameter
getTaskGraph
Link copied to clipboard
open override fun getTaskGraph(): TaskExecutionGraph
includedBuild
Link copied to clipboard
open override fun includedBuild(name: String): IncludedBuild
initscript
Link copied to clipboard
open fun initscript(block: ScriptHandlerScope.() -> Unit)

Configures the classpath of the init script.

mkdir
Link copied to clipboard
fun mkdir(path: Any): File

Creates a directory and returns a file pointing to it.

projectsEvaluated
Link copied to clipboard
open override fun projectsEvaluated(closure: Closure<Any>)
open override fun projectsEvaluated(action: Action<in Gradle>)
projectsLoaded
Link copied to clipboard
open override fun projectsLoaded(closure: Closure<Any>)
open override fun projectsLoaded(action: Action<in Gradle>)
relativePath
Link copied to clipboard
fun relativePath(path: Any): String

Returns the relative path from this script's target base directory to the given path.

removeListener
Link copied to clipboard
open override fun removeListener(listener: Any)
removeProjectEvaluationListener
Link copied to clipboard
open override fun removeProjectEvaluationListener(listener: ProjectEvaluationListener)
rootProject
Link copied to clipboard
open override fun rootProject(action: Action<in Project>)
settingsEvaluated
Link copied to clipboard
open override fun settingsEvaluated(closure: Closure<Any>)
open override fun settingsEvaluated(action: Action<in Settings>)
tarTree
Link copied to clipboard
fun tarTree(tarPath: Any): FileTree

Creates a new FileTree which contains the contents of the given TAR file.

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.

uri
Link copied to clipboard
fun uri(path: Any): URI

Resolves a file path to a URI, relative to this script's target base directory.

useLogger
Link copied to clipboard
open override fun useLogger(logger: Any)
zipTree
Link copied to clipboard
fun zipTree(zipPath: Any): FileTree

Creates a new FileTree which contains the contents of the given ZIP file.