v0.11.1
版本发布时间: 2017-09-02 00:29:40
gradle/kotlin-dsl-samples最新发布版本:v1.1.3(2019-01-29 18:57:52)
Gradle Kotlin DSL 0.11.1 Release Notes
Gradle Kotlin DSL v0.11.1 brings the latest and greatest Kotlin (1.1.4-3) and takes big steps toward general usability with utilities for Groovy-heavy DSLs such as Maven POM customization, Ant usage and those provided by Groovy-biased community plugins.
v0.11.1 is expected to be included in the upcoming Gradle 4.2 RC1.
The features in this release are also available for immediate use within the latest Gradle Kotlin DSL distribution snapshot. To use it, upgrade your Gradle wrapper in the following fashion:
$ cd $YOUR_PROJECT_ROOT
$ gradle wrapper --gradle-distribution-url https://repo.gradle.org/gradle/kotlin-dsl-snapshots-local/gradle-kotlin-dsl-4.2-20170901130305+0000-all.zip
Once Gradle 4.2 RC1 is out, we encourage all users to upgrade in the following fashion:
$ cd $YOUR_PROJECT_ROOT
$ gradle wrapper --gradle-version 4.2-rc-1 --distribution-type all
Updates since v0.10.3
-
Kotlin 1.1.4-3 (#414). Bringing performance improvements and more.
-
Better support for Groovy-heavy DSLs (#142, #47, #259). With the introduction of the
withGroovyBuilder
andwithConvention
utility extensions.withGroovyBuilder
provides a dynamic dispatching DSL with Groovy semantics for better integration with plugins that rely on Groovy builders such as the coremaven
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
to:withGroovyBuilder { "repository"("url" to "scp://repos.mycompany.com/releases") { "authentication"("userName" to "me", "password" to "myPassword") } }
Check out the maven plugin configuration sample and the ant usage sample to see these extensions in action.
-
Projects using the
kotlin-dsl
plugin can be edited correctly in IntelliJ (#373). Before this release, lambda expressions passed asorg.gradle.api.Action<T>
arguments were not being typed accurately and soT
member references were highlighted as errors and code completion provided wrong suggestions. These are now working properly except inbuildSrc
projects. -
Seamless testing for projects using the
kotlin-dsl
plugin (#450). As thegradleKotlinDsl()
dependency is now added to thetestRuntimeOnly
configuration. -
IntelliJ IDEA resolves Gradle script classpath asynchronously (#355). A long awaited feature, IntelliJ no longer blocks the editor while the classpath of the open script is being resolved.
-
Maven repository shortcut (#256). Due to popular demand a shortcut has been added to the DSL that simplifies the configuration of
maven
repositories.Instead of writing:
repositories { maven { url = uri("...") } }
Users can now simply write:
repositories { maven(url = "...") // or maven("...") }
-
Improved Gradle API null safety (#403, #420). An effort is under way to add nullability annotations to the whole Gradle API. Expect more improvements in upcoming releases.
-
New samples (#456, #260). A new sample demonstrating how to write a Kotlin DSL friendly Gradle plugin in Groovy has been added as well as another one demonstrating how to configure the (now deprecated) Software Model in Kotlin.
-
applyFrom(uri)
removed from the DSL (#444). For symmetry, scripts should useapply { from(uri) }
instead.