Slackbot
10/16/2023, 1:35 AMMarcin Erdmann
10/16/2023, 1:36 PMMarcin Erdmann
10/16/2023, 1:36 PMfile() rather than files()?tony
10/16/2023, 6:10 PM// task
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:InputFiles
abstract val source: ConfigurableFileTree
// plugin
source.from(/* a SourceDirectorySet */)
// I also tried
source.setDir(/* a SourceDirectorySet */)
both failed with the above errortony
10/16/2023, 6:11 PMConfigureFileCollection, where I would call setFrom(/* a FileCollection */)Marcin Erdmann
10/17/2023, 8:06 AMFileTree.from() as far as I understandMarcin Erdmann
10/17/2023, 8:20 AMConfigurableFileCollection as your input. I believe that if you do ConfigurableFileCollection.from(FileTree) what actually is then returned from getFiles() on that FileCollection are files in the file tree and not file tree roots (which would be just source directories in the case of a SourceDirectorySet).Marcin Erdmann
10/17/2023, 8:24 AMfrom() on ConfigurableFileCollection (but not ConfigurableFileTree as from() for it is overloaded) is first turned into a FileTree using FileCollection.getAsFileTree()Marcin Erdmann
10/17/2023, 8:25 AMFileTree contains only files, a FileColleciton contains whatever you put into it, can be both files and directories"Marcin Erdmann
10/17/2023, 8:29 AMMarcin Erdmann
10/17/2023, 8:31 AMtony
10/17/2023, 4:50 PMtony
10/17/2023, 4:52 PMConfigurableFileCollection, it just seems wrong, or at least inconsistent, that I can't just take a FileTree I have and set it as a task input, very simply and naively. It should Just Work ™️
cc @Tom Tresansky since you seem to care about Gradle docs 🙂Marcin Erdmann
10/18/2023, 9:50 AMFileTree property and pass your existing tree to the setter for it but that would be a somewhat constraining API if all your task wants to do is to iterate over files. I think using a ConfigurableFileCollection for your input is much more flexible because that way it can be easily set from both an existing file tree, any FileCollection, paths or file objects.Marcin Erdmann
10/18/2023, 9:53 AMConfigurableFileTree.set(FileTree) which would make the configuration of the ConfigurableFileTree match exactly the one of the passed FileTree.Tom Tresansky
10/18/2023, 2:10 PMTom Tresansky
10/18/2023, 2:13 PMtony
10/18/2023, 5:38 PMConfigurableFileTree exists and seemed a natural API to use. Tom, I've made a note to write up an issueMarcin Erdmann
10/19/2023, 3:21 PMTom Tresansky
10/19/2023, 3:24 PMMarcin Erdmann
10/19/2023, 3:24 PMConfigurableFileTree as task input type would make sense, @tony. It seems like the usecase for that API is to find/filter files in a directory structure and then pass it to ConfigurableFileCollection as a source of files.Marcin Erdmann
10/19/2023, 3:27 PMConfigurableFileTree in gradle codebase then there is very little and there is not a single usage of that class as a task input property.Marcin Erdmann
10/19/2023, 3:29 PMFileTree seems to be only used when you care about relative paths of the files and not just the files themselves.tony
10/19/2023, 4:34 PM