@eskatos eskatos released this Dec 13, 2018

Assets 2

Gradle Kotlin DSL 1.1.0 Release Notes

Gradle Kotlin DSL 1.1.0 brings Kotlin 1.3.11, support for Kotlin lambdas in the Gradle APIs, multiple fixes and enhancements for a better behavior in IntelliJ script dependency resolution, bug fixes in the kotlin-dsl plugin for build authors, selected type-safe accessors additions and better build-cache support.

In order to benefit from the best user experience, please update IntelliJ IDEA to 2018.3.1, Android Studio to 3.3 and their Kotlin Plugin to the latest 1.3.

v1.1.0 is included in Gradle 5.1.

To use it, upgrade your Gradle wrapper in the following fashion:

$ cd $YOUR_PROJECT_ROOT
$ gradle wrapper --gradle-version 5.1 --distribution-type all

Updates since v1.0.4 (Gradle 5.0)

  • Kotlin 1.3.11 (#1285)

    Please see the Kotlin 1.3.11 release notes for more information.

  • Gradle APIs now accept Kotlin lambdas (#1077)

    Gradle API members accepting Any and unpacking Groovy closures and Callables lazily now also accept Kotlin lambdas. Instead of

    file(Callable { "foo" })
    files(Callable { "bar" })
    copy {
        from(Callable { "compute/inputs/lazily" })
        // ...
    }

    it is now possible to write:

    file({ "foo" })
    files({ "bar" })
    copy {
        from({ "compute/inputs/lazily" })
        // ...
    }
  • Type-safe accessors for configurations in artifacts {} (#889, #1020, #1276)

    The artifacts {} block now has type-safe accessors to add artifacts to existing configurations. Instead of

    artifacts {
        add("archives", tasks.jar)
    }

    it is now possible to write:

    artifacts {
        archives(tasks.jar)
    }
  • Type-safe accessors for extensions in dependencies {} (#1185, #1190, #1278)

    The dependencies {} block now has type-safe accessors to existing extensions. For example, given an existing extension on the DependencyHandler named acme and providing dependencies declarations one could now write:

    dependencies {
        implementation(acme.core)
    }
  • Script compilation and kotlin-dsl plugin tasks cached outputs can now be shared (#1286, #1288)

    All the generated code is now reproducible byte to byte allowing the Gradle Build Cache support to share the cached outputs between different operating systems.

  • kotlin-dsl plugin tasks are now all cacheable (#1243, #1275)

    The :generateScriptPluginAdapters task contributed by the kotlin-dsl plugin is now cacheable, relocatable and its outputs can be shared between different operating systems.

  • kotlin-dsl plugin now sets Kotlin apiVersion and languageVersion to 1.3 (#1274, #1277)

    For uniformity with script compilation.

  • IDE editor script dependencies is now correct for scripts outside the project root (#1231, #1289)

    Prior to this release, when the layout of a build included subprojects stored outside the build root directory, the script dependencies resolver wouldn't consider those subprojects to be part of the imported project. Instead, the subprojects would be treated as standalone projects most likely causing the wrong classpath to be served to the IDE.

    For example, in the following Gradle build layout where root is the actual Gradle root project directory imported into IntelliJ IDEA and p1 is a subproject outside the root directory tree:

    ├── root
    │   ├── build.gradle.kts
    │   ├── buildSrc
    │   │   └── build.gradle.kts
    │   └── settings.gradle.kts 
    └── p1
        └── build.gradle.kts
    

    With the old and incorrect behaviour, IntelliJ IDEA would receive the wrong classpath for the p1/build.gradle.kts script which was treated as a script plugin with no connection to the p1 subproject.

    This behaviour has been fixed and now scripts for subprojects stored outside the imported project root directory will be correctly recognised as such.

  • IDE editor script dependencies resolution consumes less resources (#1155)

    When editing a .gradle.kts script in IntelliJ IDEA, resolving the script classpath for the first time can take a relatively long time due to the downloading of dependencies and their sources (including the Gradle sources if using a -bin distribution).

    Making changes to a script while a resolution request is pending causes further requests to be enqueued for later processing.

    Prior to this release, the Kotlin DSL would simply serve all pending requests one by one which could end up consuming a lot of resources unnecessarily considering that repeated requests for the uptodate classpath of the same script only needs to be resolved once.

    Starting with this release, the Kotlin DSL script dependencies resolver will only process the most recent request for each script avoiding a lot of unnecessary work.

  • IDE editor script dependencies resolution now better manage its logs (#1267, #1273, #1280, #1281)

    On Windows, the log directory moved from $HOME/Application Data/gradle-kotlin-dsl/log to the more idiomatic and always local $HOME/AppData/Local/gradle-kotlin-dsl/log.

    On all systems, the log directory is now checked periodically (at most every 24 hours) and log files are deleted if they are more than 7 days old.

For the complete list see the gradle/kotlin-dsl issues for 1.1.0.