Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

1.0-RC12

Pre-release
Pre-release
Compare
Choose a tag to compare
@eskatos eskatos released this 03 Oct 00:38
v1.0-RC12
87a5402

Gradle Kotlin DSL 1.0 RC12 Release Notes

Gradle Kotlin DSL 1.0 RC12 brings Kotlin 1.3.0 RC2, fixes to issues identified since 1.0 RC6, API/DSL refinements and enables the script compilation build cache.

In order to benefit from the best user experience, please update IntelliJ IDEA to 2018.3 EAP, Android Studio to 3.2 and their Kotlin Plugin to the latest 1.3 EAP (1.3.0-rc-116 at the time of this writing).

Thanks to a great help from the community, the Gradle User Manual now contains samples for both the Groovy and Kotlin DSLs. This is now the best place to find information on how to use the Gradle Kotlin DSL as it covers all Gradle features from using plugins to customizing the dependency resolution behavior.

A new user manual chapter dedicated to the Gradle Kotlin DSL has also been added.

This release contains potential breaking changes, see below.

v1.0-RC12 is included in Gradle 5.0-M1.

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

$ cd $YOUR_PROJECT_ROOT
$ gradle wrapper --gradle-version 5.0-milestone-1 --distribution-type all

Updates since v1.0-RC6

  • Upgrade embedded Kotlin to 1.3.0-RC2 (#1149, #1005, #1112, #1125, #1132)

    Note that Gradle Kotlin DSL 1.0 will ship with Kotlin 1.3 GA.

  • Script compilation build cache is now enabled alongside the Gradle Build Cache (#1152)

    If you enable the Gradle Build Cache then the Gradle Kotlin DSL will store and fetch the outputs of script compilation, avoiding the expensive work of recompiling them.

  • Accessors for plugins present in buildSrc (#1156)

    You can now refer statically to plugins declared in buildSrc. Instead of:

    plugins {
        id("my.buildSrc.plugin.ID")
    }

    you can now write:

    plugins {
        my.buildSrc.plugin.ID
    }
  • Accessors for elements of collections (#879, #1041)

    It is now possible to refer to elements of collections available at build script body compilation time via type-safe accessors. This is applied to configurations, tasks and all Gradle extensions that are collections such as sourceSets. For tasks, it means that instead of writing:

    plugins {
        java
    }
    
    tasks {
        named<Test>("test") {
            testLogging.showStacktraces = true
        }
    }

    you can now write:

    plugins {
        java
    }
    
    tasks {
        test {
            testLogging.showStacktraces = true
        }
    }
  • Accessors for artifact configurations in configurations {} (#1118, #1129)

    Accessors for artifact configurations were missing in the configurations {} block. This has been fixed the same way as for all collections, see above. Instead of:

    plugins {
        java
    }
    
    configurations {
        named("implementation") {
            exclude(group = "org.foo")
        }
    }

    you can now write:

    plugins {
        java
    }
    
    configurations {
        implementation {
            exclude(group = "org.foo")
        }
    }
  • Refine dependency constraints DSL (#710, #1091)

    Accessors for artifact configurations were missing in the dependencies { constraints {} } block. This has been fixed. Instead of:

    plugins {
        java
    }
    
    dependencies {
        constraints {
            add("implementation", "com.google.collections:google-collections") {
                version { rejectAll() }
                because("Google collections is superceded by Guava")
            }
        }
    }

    you can now write:

    plugins {
        java
    }
    
    dependencies {
        constraints {
            implementation("com.google.collections:google-collections") {
                version { rejectAll() }
                because("Google collections is superceded by Guava")
            }
        }
    }
  • Refine containers API (#1042, #1104, #1108, #1116)

    During the RC phase, several discrepancies were found in the domain object collections and containers API. Special care has been taken to iron it in this release. Please see the linked issues for more information.

  • Let the kotlin-dsl plugin configure precompiled script plugins support (#1135)

    Applying the kotlin-dsl plugin now also applies the kotlin-dsl-precompiled-script-plugins plugin. See the Gradle Kotlin DSL Primer chapter of the Gradle User Manual for more information.

  • Refine IDE script dependencies resolver (#1133, #1124, #1139)

    The dependencies resolver backing IDE editors for .gradle.kts scripts has been refined to emit warnings only when necessary and display actionable messages. Please see the linked issues for more information.

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

Breaking changes

This release contains some potential breaking changes:

  • Upgrade embedded Kotlin to 1.3.0-RC2

    Kotlin DSL 1.0-rc-12 ships with Kotlin 1.3 RC2 (1.3.0-rc-116) which is only available via the kotlin-eap repository.
    Usually, that would mean that in order to use the kotlin-dsl plugin or the embedded Kotlin plugin version, the kotlin-eap repository would have to be added to settings.pluginManagement.repositories
    and allprojects.repositories. With the intent of making it easier to try, Kotlin DSL 1.0-rc-12 does it automatically for any project that includes a settings.gradle.kts.
    This behaviour will be removed once Kotlin 1.3 GA is available.

  • Artifact configuration accessors are now typed NamedDomainObjectProvider<Configuration>

    Instead of simply Configuration. This goes in line with the fact that the Kotlin DSL sugar embrace the new configuration avoidance APIs.

Avoiding Gradle Kotlin DSL internal APIs

Use of Kotlin DSL internal APIs in plugins and build scripts has the potential to break builds when either Gradle or plugins change.

The Kotlin DSL extends the Gradle public API definition with org/gradle/kotlin/dsl/* excluding any subpackages.