Slackbot
08/29/2022, 11:51 PMgrossws
08/29/2022, 11:55 PMConfigurableFileCollection
solve the same? I'm not sure if it's resettable but it's #from(Any)
method is god-sendRyan Schmitt
08/30/2022, 12:04 AMI'm not sure if it's resettableYou can call
#clear
. The problem is that the user has to call files.clear()
in that case. The Property#convention
solution is way more elegant in that respectThomas Broyer
08/30/2022, 9:15 AMConfigurableFileCollection
. Mark your configurable property @Internal
and add another @InputFiles
property that checks whether your configurable property is empty and then returns a default value otherwise.Thomas Broyer
08/30/2022, 9:20 AM@Internal
public abstract ConfigurableFileCollection getMyProperty();
@InputFiles
/* does not need to be public */ FileCollection getActualFiles() {
var myProperty = getMyProperty();
if (myProperty.isEmpty()) {
return getProject().files(…);
}
return myProperty;
}
// use getActualFiles() in the task action
Paul Merlin
08/30/2022, 9:32 AMConfigurableFileCollection
would be a good feature request.
In the meantime, +1 to Thomas solutionRyan Schmitt
08/31/2022, 12:14 AMmyProperty
being empty and myProperty
being unset (another thing properties/conventions are good at)Ryan Schmitt
08/31/2022, 12:15 AM