# KotlinBuildScript

abstract class KotlinBuildScript(host: KotlinScriptHost<Project>) : ProjectDelegate

### Deprecated

Will be removed in Gradle 10

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

#### See also

KotlinProjectScriptTemplate

## Constructors

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

## Properties

delegate
Link copied to clipboard
open val delegate: Project
extra
Link copied to clipboard
val ExtensionAware.extra: ExtraPropertiesExtension

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

## Functions

absoluteProjectPath
Link copied to clipboard
open override fun absoluteProjectPath(path: String): String
afterEvaluate
Link copied to clipboard
open override fun afterEvaluate(closure: Closure<*>)
open override fun afterEvaluate(action: Action<in Project>)
allprojects
Link copied to clipboard
open override fun allprojects(configureClosure: Closure<*>)
open override fun allprojects(action: Action<in Project>)
ant
Link copied to clipboard
open override fun ant(configureClosure: Closure<*>): AntBuilder
open override fun ant(configureAction: Action<in AntBuilder>): AntBuilder
apply
Link copied to clipboard
open override fun apply(closure: Closure<*>)
open override fun apply(options: Map<String, *>)
open override fun apply(action: Action<in ObjectConfigurationAction>)
apply
Link copied to clipboard
inline fun <T : Plugin<Project>> Project.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.

artifacts
Link copied to clipboard
open override fun artifacts(configureClosure: Closure<*>)
open override fun artifacts(configureAction: Action<in ArtifactHandler>)
artifacts
Link copied to clipboard
fun Project.artifacts(configuration: ArtifactHandlerScope.() -> Unit)

Configures the artifacts for this project.

beforeEvaluate
Link copied to clipboard
open override fun beforeEvaluate(closure: Closure<*>)
open override fun beforeEvaluate(action: Action<in Project>)
buildscript
Link copied to clipboard
open fun buildscript(block: ScriptHandlerScope.() -> Unit)

Configures the build script classpath for this project.

open override fun buildscript(configureClosure: Closure<*>)
buildscript
Link copied to clipboard
fun Project.buildscript(action: ScriptHandlerScope.() -> Unit)

Configures the build script classpath for this project.

compareTo
Link copied to clipboard
open operator override fun compareTo(other: Project): Int
components
Link copied to clipboard
open override fun components(configuration: Action<in SoftwareComponentContainer>)
configurations
Link copied to clipboard
open override fun configurations(configureClosure: Closure<*>)
configure
Link copied to clipboard
open override fun configure(object: Any, configureClosure: Closure<*>): Any
open override fun configure(objects: Iterable<*>, configureClosure: Closure<*>): Iterable<*>
open override fun <T : Any> configure(objects: Iterable<T>, configureAction: Action<in T>): Iterable<T>
configure
Link copied to clipboard
inline fun <T : Any> Project.configure(noinline configuration: T.() -> Unit)

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

inline fun <T : Any> ExtensionAware.configure(noinline configuration: T.() -> Unit)

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

container
Link copied to clipboard
open override fun <T : Any> container(type: Class<T>): NamedDomainObjectContainer<T>
open override fun <T : Any> container(type: Class<T>, factoryClosure: Closure<*>): NamedDomainObjectContainer<T>
open override fun <T : Any> container(type: Class<T>, factory: NamedDomainObjectFactory<T>): NamedDomainObjectContainer<T>
container
Link copied to clipboard
inline fun <T : Any> Project.container(): NamedDomainObjectContainer<T>
inline fun <T : Any> Project.container(noinline factory: (String) -> T): NamedDomainObjectContainer<T>

Creates a container for managing named objects of the specified type.

inline fun <T : Any> Project.container(type: KClass<T>): NamedDomainObjectContainer<T>
inline fun <T : Any> Project.container(type: KClass<T>, factory: NamedDomainObjectFactory<T>): NamedDomainObjectContainer<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.Project.container.

copy
Link copied to clipboard
open override fun copy(closure: Closure<*>): WorkResult
open override fun copy(action: Action<in CopySpec>): WorkResult
copySpec
Link copied to clipboard
open override fun copySpec(): CopySpec
open override fun copySpec(closure: Closure<*>): CopySpec
open override fun copySpec(action: Action<in CopySpec>): CopySpec
createAntBuilder
Link copied to clipboard
open override fun createAntBuilder(): AntBuilder
defaultTasks
Link copied to clipboard
open override fun defaultTasks(vararg defaultTasks: String)
defaultTasks
Link copied to clipboard
inline fun Project.defaultTasks(vararg tasks: Task)

Sets the default tasks of this project. These are used when no tasks names are provided when starting the build.

delete
Link copied to clipboard
open override fun delete(vararg paths: Any?): Boolean
open override fun delete(action: Action<in DeleteSpec>): WorkResult
dependencies
Link copied to clipboard
open override fun dependencies(configureClosure: Closure<*>)
dependencies
Link copied to clipboard
fun Project.dependencies(configuration: DependencyHandlerScope.() -> Unit)

Configures the dependencies for this project.

dependencyLocking
Link copied to clipboard
open override fun dependencyLocking(configuration: Action<in DependencyLockingHandler>)
depthCompare
Link copied to clipboard
open override fun depthCompare(otherProject: Project): Int
evaluationDependsOn
Link copied to clipboard
open override fun evaluationDependsOn(path: String): Project
evaluationDependsOnChildren
Link copied to clipboard
open override fun evaluationDependsOnChildren()
file
Link copied to clipboard
open override fun file(path: Any): File
open override fun file(path: Any, validation: PathValidation): File
files
Link copied to clipboard
open override fun files(vararg paths: Any?): ConfigurableFileCollection
open override fun files(paths: Any, configureClosure: Closure<*>): ConfigurableFileCollection
open override fun files(paths: Any, configureAction: Action<in ConfigurableFileCollection>): ConfigurableFileCollection
fileTree
Link copied to clipboard
open override fun fileTree(baseDir: Any): ConfigurableFileTree
open override fun fileTree(args: Map<String, *>): ConfigurableFileTree
open override fun fileTree(baseDir: Any, configureClosure: Closure<*>): ConfigurableFileTree
open override fun fileTree(baseDir: Any, configureAction: Action<in ConfigurableFileTree>): ConfigurableFileTree
fileTree
Link copied to clipboard
inline fun Project.fileTree(vararg args: Pair<String, Any>): ConfigurableFileTree

Kotlin extension function for org.gradle.api.Project.fileTree.

findProject
Link copied to clipboard
open override fun findProject(path: String): Project?
findProperty
Link copied to clipboard
open override fun findProperty(propertyName: String): Any?
getAllprojects
Link copied to clipboard
open override fun getAllprojects(): MutableSet<Project>
getAllTasks
Link copied to clipboard
open override fun getAllTasks(recursive: Boolean): MutableMap<Project, MutableSet<Task>>
getAnt
Link copied to clipboard
open override fun getAnt(): AntBuilder
getArtifacts
Link copied to clipboard
open override fun getArtifacts(): ArtifactHandler
getBuildDir
Link copied to clipboard
open override fun getBuildDir(): File
getBuildFile
Link copied to clipboard
open override fun getBuildFile(): File
getBuildscript
Link copied to clipboard
open override fun getBuildscript(): ScriptHandler

The ScriptHandler for this script.

getBuildTreePath
Link copied to clipboard
open override fun getBuildTreePath(): String
getChildProjects
Link copied to clipboard
open override fun getChildProjects(): MutableMap<String, Project>
getComponents
Link copied to clipboard
open override fun getComponents(): SoftwareComponentContainer
getConfigurations
Link copied to clipboard
open override fun getConfigurations(): ConfigurationContainer
getDefaultTasks
Link copied to clipboard
open override fun getDefaultTasks(): MutableList<String>
getDependencies
Link copied to clipboard
open override fun getDependencies(): DependencyHandler
getDependencyFactory
Link copied to clipboard
open override fun getDependencyFactory(): DependencyFactory
getDependencyLocking
Link copied to clipboard
open override fun getDependencyLocking(): DependencyLockingHandler
getDepth
Link copied to clipboard
open override fun getDepth(): Int
getDescription
Link copied to clipboard
open override fun getDescription(): String?
getDisplayName
Link copied to clipboard
open override fun getDisplayName(): String
getExtensions
Link copied to clipboard
open override fun getExtensions(): ExtensionContainer
getGradle
Link copied to clipboard
open override fun getGradle(): Gradle
getGroup
Link copied to clipboard
open override fun getGroup(): Any
getIsolated
Link copied to clipboard
open override fun getIsolated(): IsolatedProject
getLayout
Link copied to clipboard
open override fun getLayout(): ProjectLayout
getLogger
Link copied to clipboard
open override fun getLogger(): Logger
getLogging
Link copied to clipboard
open override fun getLogging(): LoggingManager
getName
Link copied to clipboard
open override fun getName(): String
getNormalization
Link copied to clipboard
open override fun getNormalization(): InputNormalizationHandler
getObjects
Link copied to clipboard
open override fun getObjects(): ObjectFactory
getParent
Link copied to clipboard
open override fun getParent(): Project?
getPath
Link copied to clipboard
open override fun getPath(): String
getPluginManager
Link copied to clipboard
open override fun getPluginManager(): PluginManager
getPlugins
Link copied to clipboard
open override fun getPlugins(): PluginContainer
getProject
Link copied to clipboard
open override fun getProject(): Project
getProjectDir
Link copied to clipboard
open override fun getProjectDir(): File
getProperties
Link copied to clipboard
open override fun getProperties(): MutableMap<String, *>
getProviders
Link copied to clipboard
open override fun getProviders(): ProviderFactory
getRepositories
Link copied to clipboard
open override fun getRepositories(): RepositoryHandler
getResources
Link copied to clipboard
open override fun getResources(): ResourceHandler
getRootDir
Link copied to clipboard
open override fun getRootDir(): File
getRootProject
Link copied to clipboard
open override fun getRootProject(): Project
getState
Link copied to clipboard
open override fun getState(): ProjectState
getStatus
Link copied to clipboard
open override fun getStatus(): Any
getSubprojects
Link copied to clipboard
open override fun getSubprojects(): MutableSet<Project>
getTasks
Link copied to clipboard
open override fun getTasks(): TaskContainer
getTasksByName
Link copied to clipboard
open override fun getTasksByName(name: String, recursive: Boolean): MutableSet<Task>
getVersion
Link copied to clipboard
open override fun getVersion(): Any
gradleKotlinDsl
Link copied to clipboard
fun Project.gradleKotlinDsl(): Dependency

Creates a dependency on the API of the current version of the Gradle Kotlin DSL.

hasProperty
Link copied to clipboard
open override fun hasProperty(propertyName: String): Boolean
mkdir
Link copied to clipboard
open override fun mkdir(path: Any): File
normalization
Link copied to clipboard
open override fun normalization(configuration: Action<in InputNormalizationHandler>)
plugins
Link copied to clipboard
fun plugins(block: PluginDependenciesSpecScope.() -> Unit)

Configures the plugin dependencies for this project.

plugins
Link copied to clipboard
fun Project.plugins(block: PluginDependenciesSpec.() -> Unit): Nothing

Nested `plugins` blocks are NOT allowed, for example:

project
Link copied to clipboard
open override fun project(path: String): Project
open override fun project(path: String, configureClosure: Closure<*>): Project
open override fun project(path: String, configureAction: Action<in Project>): Project
property
Link copied to clipboard
open override fun property(propertyName: String): Any?
provideDelegate
Link copied to clipboard
operator fun Project.provideDelegate(any: Any?, property: KProperty<*>): PropertyDelegate

Locates a property on Project.

provider
Link copied to clipboard
open override fun <T : Any> provider(value: Callable<out T?>): Provider<T>
relativePath
Link copied to clipboard
open override fun relativePath(path: Any): String
relativeProjectPath
Link copied to clipboard
open override fun relativeProjectPath(path: String): String
repositories
Link copied to clipboard
open override fun repositories(configureClosure: Closure<*>)
repositories
Link copied to clipboard
fun Project.repositories(configuration: RepositoryHandler.() -> Unit)

Configures the repositories for this project.

setBuildDir
Link copied to clipboard
open override fun setBuildDir(path: File)
open override fun setBuildDir(path: Any)
setDefaultTasks
Link copied to clipboard
open override fun setDefaultTasks(defaultTasks: MutableList<String>)
setDescription
Link copied to clipboard
open override fun setDescription(description: String?)
setGroup
Link copied to clipboard
open override fun setGroup(group: Any)
setProperty
Link copied to clipboard
open override fun setProperty(name: String, value: Any?)
setStatus
Link copied to clipboard
open override fun setStatus(status: Any)
setVersion
Link copied to clipboard
open override fun setVersion(version: Any)
subprojects
Link copied to clipboard
open override fun subprojects(configureClosure: Closure<*>)
open override fun subprojects(action: Action<in Project>)
sync
Link copied to clipboard
open override fun sync(action: Action<in SyncSpec>): WorkResult
tarTree
Link copied to clipboard
open override fun tarTree(tarPath: Any): FileTree
task
Link copied to clipboard
open override fun task(name: String): Task
open override fun task(name: String, configureClosure: Closure<*>): Task
open override fun task(name: String, configureAction: Action<in Task>): Task
open override fun task(args: Map<String, *>, name: String): Task
open override fun task(args: Map<String, *>, name: String, configureClosure: Closure<*>): Task
task
Link copied to clipboard
inline fun <type : Task> Project.task(name: String): <Error class: unknown class>

Creates a Task with the given name and type, and adds it to this project tasks container.

inline fun Project.task(name: String, vararg args: Pair<String, Any>): Task

Kotlin extension function for org.gradle.api.Project.task.

inline fun <type : Task> Project.task(name: String, noinline configuration: type.() -> Unit): type

Creates a Task with the given name and type, configures it with the given configuration action, and adds it to this project tasks container.

fun <T : Task> Project.task(name: String, type: KClass<T>, configuration: T.() -> Unit): T
the
Link copied to clipboard
inline fun <T : Any> Project.the(): T
fun <T : Any> Project.the(extensionType: KClass<T>): T

Returns the project extension of the specified type.

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
open override fun uri(path: Any): URI
zipTree
Link copied to clipboard
open override fun zipTree(zipPath: Any): FileTree