Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've switched to
FileCollection
for the extension/task property and added a convenience method to the extension so users won't necessarily have to deal with theFileCollection.from()
syntax.This appeared to me as the most "natural" approach, opposed to having a
ListProperty<File>
(inconsistent with the other properties) oder evenListProperty<RegularFile>
(a bit painful to handle,layout.file()
syntax being not commonly known/understood by users).~~ One thing where I wasn't 100% sure was how to configure the
FileCollection
task property from the extension property. Here the convention approach is not available and there aren't any super clear docs/examples how to do this. But it seems to work alright the way it's done here. ~~Edit: after being a bit more versed in the approach to lazy configuration of gradle tasks, I'd argue that the approach taken in the plugin is not 100% idiomatic. Typically one would not refer to the extension properties in the task implementation.
Rather there the task properties should be "unbiased" and preferable empty, except obvious defaults.
The plugin implementation should instead be responsible of connecting the extension properties to the task properties.
However, in this PR I've gone along with the approach taken here.