I have a task with an input: ```@get:InputFiles @g...
# configuration-cache
c
I have a task with an input:
Copy code
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val inputFiles: ConfigurableFileCollection
and I set the value like:
Copy code
inputFiles.from(fileTree("src/main/resources/myfiles").sortedBy { it.name })
Why the task ouput is not changing when I add or remove files from that folder?
obviously I mean it happens with CC enabled when ireusing it
it seems to be because sortedBy transforms it into eager List<File>
but...FileTree order is not guaranteed
j
with a file directory it would work only if a direct child has changed, not deeper ones?
c
Directory sais "contents" no idea if recursive, but in this case it works for me, and is the way i fixed it, but... anyway I guerr it's possible to use a `FileTree`and as it doesn't have reproducible order...it might be an issue
(no idea if directory contents have reproducible order or if the normalization ignores order)
v
Order should be irrelevant for input files
You have relative path sensitivity configued, so the content should be snapshotted by path. No reason to employ any sorting on your side for the input-hanlding of Gradle I think.
c
Ok, so I should only order inside the task to traverse the list of files in a reproducible order.
v
If that is important for the execution of your task, yes
You never know who supplies the input, so it is better to enforce this internally than to rely it comes in sorted
c
Really my "mistake" was to think that using a filetree as input could make it miss buildcache sometimes as the order is not reproducible
But is the snapshoting doesn't care about the order then everything is easier
👌 1
Thanks BTW (that I forgot to say it before)
👍 1
❤️ 1