api / org.gradle.kotlin.dsl / KotlinBuildScript

KotlinBuildScript

abstract class KotlinBuildScript : Project

Base class for Kotlin build scripts.

Constructors

<init>

KotlinBuildScript(host: <ERROR CLASS><Project>)

Base class for Kotlin build scripts.

Functions

buildscript

open fun buildscript(block: ScriptHandlerScope.() -> Unit): Unit

Configures the build script classpath for this project.

getBuildscript

open fun getBuildscript(): ScriptHandler

The ScriptHandler for this script.

plugins

fun plugins(block: PluginDependenciesSpecScope.() -> Unit): Unit

Configures the plugin dependencies for this project.

Extension Properties

announce

val Project.announce: AnnouncePluginExtension

Retrieves the announce extension.

application

val Project.application: ApplicationPluginConvention

Retrieves the application convention.

base

val Project.base: BasePluginConvention

Retrieves the base convention.

buildTypes

val Project.buildTypes: BuildTypeContainer

Retrieves the buildTypes extension.

checkstyle

val Project.checkstyle: CheckstyleExtension

Retrieves the checkstyle extension.

codenarc

val Project.codenarc: CodeNarcExtension

Retrieves the codenarc extension.

defaultArtifacts

val Project.defaultArtifacts: <ERROR CLASS>

Retrieves the defaultArtifacts extension.

distributions

val Project.distributions: DistributionContainer

Retrieves the distributions extension.

ear

val Project.ear: EarPluginConvention

Retrieves the ear convention.

eclipse

val Project.eclipse: EclipseModel

Retrieves the eclipse extension.

extra

val ExtensionAware.extra: ExtraPropertiesExtension

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

findbugs

val Project.findbugs: FindBugsExtension

Retrieves the findbugs extension.

flavors

val Project.flavors: FlavorContainer

Retrieves the flavors extension.

groovyRuntime

val Project.groovyRuntime: GroovyRuntime

Retrieves the groovyRuntime extension.

idea

val Project.idea: IdeaModel

Retrieves the idea extension.

jacoco

val Project.jacoco: JacocoPluginExtension

Retrieves the jacoco extension.

java

val Project.java: JavaPluginConvention

Retrieves the java convention.

javaScript

val Project.javaScript: JavaScriptExtension

Retrieves the javaScript extension.

jdepend

val Project.jdepend: JDependExtension

Retrieves the jdepend extension.

maven

val Project.maven: MavenPluginConvention

Retrieves the maven convention.

osgi

val Project.osgi: OsgiPluginConvention

Retrieves the osgi convention.

platforms

val Project.platforms: PlatformContainer

Retrieves the platforms extension.

playConfigurations

val Project.playConfigurations: PlayPluginConfigurations

Retrieves the playConfigurations extension.

pmd

val Project.pmd: PmdExtension

Retrieves the pmd extension.

projectReports

val Project.projectReports: ProjectReportsPluginConvention

Retrieves the projectReports convention.

publishing

val Project.publishing: PublishingExtension

Retrieves the publishing extension.

reporting

val Project.reporting: ReportingExtension

Retrieves the reporting extension.

scalaRuntime

val Project.scalaRuntime: ScalaRuntime

Retrieves the scalaRuntime extension.

signing

val Project.signing: SigningExtension

Retrieves the signing extension.

toolChains

val Project.toolChains: NativeToolChainRegistry

Retrieves the toolChains extension.

visualStudio

val Project.visualStudio: VisualStudioRootExtension

Retrieves the visualStudio extension.

war

val Project.war: WarPluginConvention

Retrieves the war convention.

xcode

val Project.xcode: XcodeRootExtension

Retrieves the xcode extension.

Extension Functions

announce

fun Project.announce(configure: AnnouncePluginExtension.() -> Unit): Unit

Configures the announce extension.

application

fun Project.application(configure: ApplicationPluginConvention.() -> Unit): Unit

Configures the application convention.

apply

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

Applies the given plugin or script.

fun <T : Plugin<*>> PluginAware.apply(to: Any): Unit

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

base

fun Project.base(configure: BasePluginConvention.() -> Unit): Unit

Configures the base convention.

buildTypes

fun Project.buildTypes(configure: BuildTypeContainer.() -> Unit): Unit

Configures the buildTypes extension.

buildscript

fun Project.buildscript(action: ScriptHandlerScope.() -> Unit): Unit

checkstyle

fun Project.checkstyle(configure: CheckstyleExtension.() -> Unit): Unit

Configures the checkstyle extension.

closureOf

fun <T> Any.closureOf(action: T.() -> Unit): Closure<Any?>

Adapts a Kotlin function to a single argument Groovy Closure.

codenarc

fun Project.codenarc(configure: CodeNarcExtension.() -> Unit): Unit

Configures the codenarc extension.

configure

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

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

configure

fun <T : Any> Project.configure(configuration: T.() -> Unit): Unit

Executes the given configuration block against the plugin convention or extension of the specified type.

createTask

fun <T : Task> Project.createTask(name: String, type: KClass<T>, configuration: T.() -> Unit): T

defaultArtifacts

fun Project.defaultArtifacts(configure: <ERROR CLASS>.() -> Unit): Unit

Configures the defaultArtifacts extension.

defaultTasks

fun Project.defaultTasks(vararg tasks: Task): Unit

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

delegateClosureOf

fun <T> Any.delegateClosureOf(action: T.() -> Unit): Closure<Unit>

Adapts a Kotlin function to a Groovy Closure that operates on the configured Closure delegate.

dependencies

fun Project.dependencies(configuration: DependencyHandlerScope.() -> Unit): Unit

Configures the dependencies for this project.

distributions

fun Project.distributions(configure: DistributionContainer.() -> Unit): Unit

Configures the distributions extension.

ear

fun Project.ear(configure: EarPluginConvention.() -> Unit): Unit

Configures the ear convention.

eclipse

fun Project.eclipse(configure: EclipseModel.() -> Unit): Unit

Configures the eclipse extension.

findbugs

fun Project.findbugs(configure: FindBugsExtension.() -> Unit): Unit

Configures the findbugs extension.

flavors

fun Project.flavors(configure: FlavorContainer.() -> Unit): Unit

Configures the flavors extension.

gradleKotlinDsl

fun Project.gradleKotlinDsl(): Dependency

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

gradlePlugin

fun Project.gradlePlugin(configure: GradlePluginDevelopmentExtension.() -> Unit): Unit

Configures the gradlePlugin extension.

gradleScriptKotlinApi

fun Project.gradleScriptKotlinApi(): Dependency

groovyRuntime

fun Project.groovyRuntime(configure: GroovyRuntime.() -> Unit): Unit

Configures the groovyRuntime extension.

idea

fun Project.idea(configure: IdeaModel.() -> Unit): Unit

Configures the idea extension.

jacoco

fun Project.jacoco(configure: JacocoPluginExtension.() -> Unit): Unit

Configures the jacoco extension.

java

fun Project.java(configure: JavaPluginConvention.() -> Unit): Unit

Configures the java convention.

javaScript

fun Project.javaScript(configure: JavaScriptExtension.() -> Unit): Unit

Configures the javaScript extension.

jdepend

fun Project.jdepend(configure: JDependExtension.() -> Unit): Unit

Configures the jdepend extension.

maven

fun Project.maven(configure: MavenPluginConvention.() -> Unit): Unit

Configures the maven convention.

osgi

fun Project.osgi(configure: OsgiPluginConvention.() -> Unit): Unit

Configures the osgi convention.

platforms

fun Project.platforms(configure: PlatformContainer.() -> Unit): Unit

Configures the platforms extension.

playConfigurations

fun Project.playConfigurations(configure: PlayPluginConfigurations.() -> Unit): Unit

Configures the playConfigurations extension.

pmd

fun Project.pmd(configure: PmdExtension.() -> Unit): Unit

Configures the pmd extension.

projectReports

fun Project.projectReports(configure: ProjectReportsPluginConvention.() -> Unit): Unit

Configures the projectReports convention.

property

fun <T> Project.property(): PropertyState<T>

Creates a PropertyState that holds values of the given type T.

provideDelegate

operator fun Project.provideDelegate(any: Any?, property: KProperty<*>): PropertyDelegate

Locates a property on Project.

publishing

fun Project.publishing(configure: PublishingExtension.() -> Unit): Unit

Configures the publishing extension.

reporting

fun Project.reporting(configure: ReportingExtension.() -> Unit): Unit

Configures the reporting extension.

repositories

fun Project.repositories(configuration: RepositoryHandler.() -> Unit): Unit

Configures the repositories for this project.

scalaRuntime

fun Project.scalaRuntime(configure: ScalaRuntime.() -> Unit): Unit

Configures the scalaRuntime extension.

signing

fun Project.signing(configure: SigningExtension.() -> Unit): Unit

Configures the signing extension.

task

fun <type : Task> Project.task(name: String, 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 <type : Task> Project.task(name: String): type

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

fun <T : Task> Project.task(name: String, type: KClass<T>, configuration: T.() -> Unit): Tfun Project.task(name: String, configuration: Task.() -> Unit): DefaultTask

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

the

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

Returns the extension of the specified extensionType.

the

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

Returns the plugin convention or extension of the specified type.

toolChains

fun Project.toolChains(configure: NativeToolChainRegistry.() -> Unit): Unit

Configures the toolChains extension.

visualStudio

fun Project.visualStudio(configure: VisualStudioRootExtension.() -> Unit): Unit

Configures the visualStudio extension.

war

fun Project.war(configure: WarPluginConvention.() -> Unit): Unit

Configures the war convention.

withConvention

fun <ConventionType : Any, ReturnType> Any.withConvention(conventionType: KClass<ConventionType>, function: ConventionType.() -> ReturnType): ReturnType

Evaluates the given function against the convention plugin of the given conventionType.

withGroovyBuilder

fun <T> Any.withGroovyBuilder(builder: GroovyBuilderScope.() -> T): T

Executes the given builder against this object's GroovyBuilderScope.

xcode

fun Project.xcode(configure: XcodeRootExtension.() -> Unit): Unit

Configures the xcode extension.