KotlinInitScript

abstract class KotlinInitScript(host: KotlinScriptHost<Gradle>) : InitScriptApi(source)

Deprecated

Will be removed in Gradle 9.0

Legacy base class for Gradle Kotlin DSL standalone Gradle scripts IDE support, aka. init scripts.

See also

Constructors

Link copied to clipboard
constructor(host: KotlinScriptHost<Gradle>)

Properties

Link copied to clipboard
open val delegate: Gradle
Link copied to clipboard

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

Link copied to clipboard

The ScriptHandler for this script.

Link copied to clipboard
val logger: Logger

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

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.

Link copied to clipboard
val resources: ResourceHandler

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

Functions

Link copied to clipboard
open override fun addBuildListener(buildListener: BuildListener)
Link copied to clipboard
open override fun addListener(listener: Any)
Link copied to clipboard
open override fun addProjectEvaluationListener(listener: ProjectEvaluationListener): ProjectEvaluationListener
Link copied to clipboard
open override fun afterProject(closure: Closure<Any>)
open override fun afterProject(action: Action<in Project>)
Link copied to clipboard
open override fun allprojects(action: Action<in Project>)
Link copied to clipboard
open override fun apply(action: Action<in ObjectConfigurationAction>)

Applies zero or more plugins or scripts.

open override fun apply(closure: Closure<Any>)
open override fun apply(options: Map<String, *>)
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.

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.

Link copied to clipboard
open override fun beforeProject(closure: Closure<Any>)
open override fun beforeProject(action: Action<in Project>)
Link copied to clipboard
open override fun beforeSettings(closure: Closure<*>)
open override fun beforeSettings(action: Action<in Settings>)
Link copied to clipboard
open override fun buildFinished(closure: Closure<Any>)
open override fun buildFinished(action: Action<in BuildResult>)
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.

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

Copies the specified files.

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

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

Link copied to clipboard
fun delete(vararg paths: Any): Boolean

Deletes files and directories.

fun delete(configuration: DeleteSpec.() -> Unit): WorkResult

Deletes the specified files.

Link copied to clipboard
fun exec(configuration: ExecSpec.() -> Unit): ExecResult

Executes an external command.

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.

Link copied to clipboard

Creates a ConfigurableFileCollection containing the given files.

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.

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

Configures the classpath of the init script.

Link copied to clipboard
fun javaexec(configuration: JavaExecSpec.() -> Unit): ExecResult

Executes an external Java process.

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

Creates a directory and returns a file pointing to it.

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

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

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

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

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.

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

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

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

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