v0.17.4
版本发布时间: 2018-05-16 02:15:39
gradle/kotlin-dsl-samples最新发布版本:v1.1.3(2019-01-29 18:57:52)
Gradle Kotlin DSL 0.17.4 Release Notes
Gradle Kotlin DSL 0.17.4 brings Kotlin 1.2.41 and many improvements to the user experience including location aware runtime error reporting, convenient configuration of nested extensions, faster and leaner configuration time and TestKit support.
At the same time the IntelliJ IDEA Kotlin Plugin fixed many long standing build script editing related issues. It is recommended for everyone to upgrade to the latest and greatest.
v0.17.4 is included in Gradle 4.8 RC1.
To use it, upgrade your Gradle wrapper in the following fashion:
$ cd $YOUR_PROJECT_ROOT
$ gradle wrapper --gradle-version 4.8-rc-1
Updates since v0.16.3
-
Kotlin 1.2.41 (#830) The embedded Kotlin version was upgraded from Kotlin 1.2.31 to the latest official release, Kotlin 1.2.41.
-
Faster and leaner configuration time (#824) Thanks to our great performance testing infrastructure we were able to find and fix the most outstanding hotspots in configuration time contributed by the Kotlin DSL provider. For the
gradle/gradle
build that meant 6% faster and 25% less memory hungry configuration time. -
Convenient configuration of nested extensions (#457, #343) Although a relatively uncommon pattern, project extensions can themselves be extended. Before this release such extensions could only be found by either looking at the plugins documentation or source. Starting with this release, the Kotlin DSL provides accessors for nested extensions found after plugins application. Making them discoverable from the IDE.
For example, the
com.github.jacobono.jaxb
exposes ajaxb
extension which is then extended with axjc
extension:plugins { id("com.github.jacobono.jaxb") version "1.3.5" } jaxb { xsdDir = "src/xsd" xjc { destinationDir = "src/generated/java" } }
-
Gradle TestKit support (#492) A long standing issue that was preventing the use of the Gradle TestKit to its full extent with Kotlin DSL builds is fixed in this release.
See the testkit sample that demonstrates how to test Kotlin DSL builds with TestKit.
-
Support for the
buildscript {}
block in applied scripts (#180) Applied scripts can now declare dependencies to libraries and plugins using thebuildscript {}
block.The modularity sample has been updated to demonstrate how to add dependencies to applied scripts.
IDE support for
buildscript
dependencies is still lacking and it will be implemented in the next release. See #110. -
Cleaner script runtime error reporting (#791) While 0.15.6 included proper script compilation error reporting, this release brings the same experience for runtime errors. It is not more needed to scroll up the log to see what failed, the errors are displayed in context to make diagnosing the cause easier and allow IDEs to provide links to the offending source:
-
JSR-305 package annotations enabled by default (#463) Kotlin 1.1.4 introduced support for package-default nullability annotations. Starting with this release JSR-305 annotations are automatically enabled for Gradle Kotlin DSL scripts. Allowing Kotlin scripts to take advantage of the nullability information present in any referenced library, including the Gradle API of course.
-
Gradle live collections API refinements (#804) The block syntax for Gradle collections has been expanded to support the whole
PolymorphicDomainObjectContainer
API and reified generic versions of the corresponding members were added.tasks { create<Greet>("greet") maybeCreate<Greet>("greet") getByName<Greet>("greet") { message = "Hello from getByName!" } create<Greet>("greet-again") { message = "Hello from create!" } } open class Greet : DefaultTask() { @Input var message = "Hello!" @TaskAction fun greet() = println(message) }
-
Android sample updated to Android Studio 3.1 (#808) The Android sample has been updated to Android Studio 3.1 and now reflects the multi-project structure that Studio creates by default. This Studio release makes it possible to finally use only Kotlin DSL build scripts. It is no more needed to keep some Groovy scripts around.
Plus some other API additions, enhancements and bug fixes. For the complete list see the gradle/kotlin-dsl
issues for 0.17.x.
Breaking changes
This release contains some potential breaking changes:
-
The Kotlin DSL now respects the JSR-305 package annotations As a result, annotated Java elements whose types were previously seen as Kotlin platform types, thus non-nullable, will now be seen as effectively either non-nullable or nullable types depending on the JSR-305 annotations. This change could cause script compilation errors.
-
The named containers API signature changed As a result, a plugin using e.g. delegated properties providers
getting
orcreating
, compiled against this release will fail when run with previous Gradle Kotlin DSL versions.