Gradle 4.10-rc-2 is now available for testing

Gradle 4.10-rc-2 is now available for testing. See the release notes for more information and upgrade instructions.

1 Like

With Gradle 4.7 and using the kotlin-dsl plugin, i have a task that has an @Input of RegularFileProperty for its execution

I am wiring in the input files by using a Configuration with a single dependency, as right now I’m using an ivy repository to retrieve the file
I want to resolve that dependency during execution and make it usable to the task’s input.

In Gradle 4.7, the code looks like:

val myconfiguration by configuration.creating
task.myInput.set({ myconfiguration.singleFile }) // seems to work?

The RegularFileProperty is allowing () -> File here, which seems to be working on Gradle 4.7, 4.8.and 4.9.
then in the @TaskAction of my task I can call .asFile.get(), resolution happens execution time, and everything seems to work great.

This seemed to work before, but fails to compile on Gradle 4-10-rc-2.

None of the following functions can be called with the arguments supplied:
public abstract fun set(p0: File): Unit defined in org.gradle.api.file.RegularFileProperty
public abstract fun set(@Nullable p0: RegularFile?): Unit defined in org.gradle.api.file.RegularFileProperty
public abstract fun set(p0: Provider<out RegularFile!>): Unit defined in org.gradle.api.file.RegularFileProperty

I struggled searching through the APIs to see if there was a way to turn a Configuration into a single file provider to set the RegularFileProperty and eventually found one.

Now, I have:

task.myInput.set(layout.file(provider { myconfiguration.singleFile }))

It is a little bit odd to use buildLayout considering that the directory doesn’t come anywhere from the project itself. Maybe there is a missing API/use case on these APIs?
Anyways, just adding it here as feedback in case others run into similar problems.

I am using the following gradle kotlin DSL code:

    java.sourceSets["main"].java {

works perfectly in gradle 4.9, but in 4.10 rc1 and 4.10rc2 gives the following error:

  Line 5: java.sourceSets["main"].java {
               ^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
                   public val Project.sourceSets: SourceSetContainer defined in org.gradle.kotlin.dsl

Has this changed? If so, is there any doco on the change?

I answered the above in How to set sourceSets with Gradle 4.10 rc2

1 Like