Gradle missing inputs properties

421 Views Asked by At

After update from Gradle 6 to 7.x i cannot solve and find the cause of missing properties. For fields File and File Collection that being annotated @Input

`Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.

Possible solutions:
  1. Annotate with @InputFile for regular files.
  2. Annotate with @InputDirectory for directories.
  3. If you want to track the path, return File.absolutePath as a String and keep @Input.`

there is some code example

Gradle plugin(which is behave as a task) from third party framework

someTask {
upstreamSourceSets = ["algorithm", "feature"]
verbose = false
verify = project.properties["instrument.verify"].toBoolean()
buildDirectory = file("build")
sourceDirectories = files("src/main/java")
ignoreFiles = fileTree("src/main/java") {
  include "org/**"
}
nullabilityAnnotations = true

}



There is run class



class Task extends DefaultTask {

@InputFiles
FileCollection someDirectories

@InputFiles
@Optional
FileCollection someIgnore

@Input
@Optional
Boolean nullabilityAnnotations

@Input

@Optional
File someBuildDirectory


@TaskAction
def run() {
 
inputs.properties.findAll { it.value != null && it.key != "buildDirectory" }.each {
params."$it.key" = it.value
}
}

So, the issue is: after the upgrade these fields are missing in inputs.properties how i can fix it?

I've tried to combine with different annotations such as @InputFile, @InputFiles, @InputDirectory and parse the path, return File.absolutePath as a String, and keep @Input.`

Help!

0

There are 0 best solutions below