interface GroovyBuilderScope : GroovyObject
Provides a dynamic dispatching DSL with Groovy semantics for better integration with
plugins that rely on Groovy builders such as the core maven
plugin.
It supports Groovy keyword arguments and arbitrary nesting, for instance, the following Groovy code:
repository(url: "scp://repos.mycompany.com/releases") {
authentication(userName: "me", password: "myPassword")
}
Can be mechanically translated to the following Kotlin with the aid of withGroovyBuilder
:
withGroovyBuilder {
"repository"("url" to "scp://repos.mycompany.com/releases") {
"authentication"("userName" to "me", "password" to "myPassword")
}
}
See Also
abstract val delegate: Any |
abstract operator fun String.invoke(vararg arguments: Any?): Any? open operator fun String.invoke(): Any? open operator fun <T> String.invoke(vararg arguments: Any?, builder: GroovyBuilderScope.() -> T): Any? open operator fun <T> String.invoke(builder: GroovyBuilderScope.() -> T): Any? open operator fun <T> String.invoke(vararg keywordArguments: Pair<String, Any?>, builder: GroovyBuilderScope.() -> T): Any? open operator fun String.invoke(vararg keywordArguments: Pair<String, Any?>): Any? |
fun of(value: Any): GroovyBuilderScope |
fun <T> Any.closureOf(action: T.() -> Unit): Closure<Any?>
Adapts a Kotlin function to a single argument Groovy Closure. |
|
fun <T> Any.delegateClosureOf(action: T.() -> Unit): Closure<Unit>
Adapts a Kotlin function to a Groovy Closure that operates on the configured Closure delegate. |
|
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. |
|
fun <T> Any.withGroovyBuilder(builder: GroovyBuilderScope.() -> T): T
Executes the given builder against this object's GroovyBuilderScope. |