I would need a way to remove files from a task inputs.
I’m creating a task with type: JavaExec: this type of task seems to consider any file passed as an arg as a task input. This is quite smart, but in my case one of the arg is actually an OUTPUT, not an input. I’ve added it to the task outputs, but since it’s also considered by Gradle a task input, I cannot make the up-to-date mechanism work appropriately (since at any execution the output file contents change).
The problem is I can’t find any way to remove files from the task inputs: neither TaskInputs API seems to allow this, nor the FileCollection I can get from task.inputs.files does. I can’t even do: task.inputs.files -= task-outputs.files because task.inputs.files is a read-only property.
The only workaround I can think of is to rewrite my task as a generic task and use Project.javaExec(…) for execution. Any help/suggestion would be really appreciated.
Well, I actually discovered that it was not due to the args that some of the outputs fell in the inputs, but it was due to the way the classpath was built. It’s hard to explain the whole use case, however I fixed this.
What I’m still missing is the possibility to remove elements from the task inputs.
Right now I’ve solved my problem, so my use case is not significant anymore. However I find it quite limitating to be able to add files but not to remove them from the inputs. Thanks anyway for your help.
i’m stuck with similar problem. I’m declaring some dynamic gwt tasks and somehow they all get (or inherit in some way) inputs like ‘src/main/java’ and ‘src/main/resources’. Obviously this it not desired, because gwt module would be rebuilt every time something changes in these folders. I descared task inputs/outputs but i’m not able to remove this ‘‘default’’ input.
gradle build file and some additional info (output of ‘taskInfo’ task):
Thank you Daniil Bubnov, that seems to be the problem. Is that documented? Where? If not, it should be. I’ve problems with modifing the classpath of the javaExec task I want to exclude the resource-folders, I tried this: