Hi,
according to the documentation, it should be possible to define a task property of type File
annotated with @InputFile
which will be lazily evaluated (using Closure).
I am trying to write such case, I was not successful:
task execBinary(type: MyTask) {
// binary = file('build.gradle')
binary { file('build.gradle') }
}
class MyTask extends DefaultTask {
@Optional @InputFile
Object binary
@TaskAction
def exec() {
println "binary: $binary"
}
}
I am getting either casting exceptions or internal Gradle checking errors.
How can I do that using Gradle 4.0?