I have a custom task and for one of the inputs I want a single file, but I would like a user to be able to specify anything that resolves to a file with the Project.files(Object o…) method. Here’s what I have at this point :
class MyTask extends DefaultTask {
private Object cfc
@TaskAction
protected void upload() {
// upload
}
@InputFile
public File getCfcFile() { project.files(cfc).singleFile }
public void setCfc(Object cfc) {
this.cfc = cfc
}
}
With the annotation on the getter it doesn’t find that MyTask depends on cfc
if cfc
is a task. If I annotate the field and remove the private modifier, it runs the dependency but fails the annotation validation to verify its a File.
Any suggestion here as to how to get this to work?