Slackbot
09/28/2022, 7:16 PMZak Taccardi
09/28/2022, 7:17 PMSet<FileSystemLocation>
instead of FileSystemLocation
), however works:
fun TaskProvider<Sync>.asFileSystemLocationSet(): Provider<Set<FileSystemLocation>> {
return map {
it.outputs.files.asFileTree.elements.get()
}
}
I think this is because Gradle understands that the Set<..>
is live, and pulling a single FileSystemLocation
out of it breaks that behaviorZak Taccardi
09/28/2022, 7:18 PMSet<FileSystemLocation>
when it’s only 1 file - I want to define it as FileSystemLocation
Rodrigo Oliveira
09/28/2022, 9:47 PMfun TaskProvider<Sync>.asFileSystemLocationSingleFile(): Provider<FileSystemLocation> {
return flatMap { sync ->
sync.outputs.files.asFileTree.elements.map { it.first() }
}
}
Rodrigo Oliveira
09/28/2022, 9:48 PMasFileTree
step looks redundant:
fun TaskProvider<Sync>.asFileSystemLocationSingleFile(): Provider<FileSystemLocation> {
return flatMap { sync ->
sync.outputs.files.elements.map { it.first() }
}
}
Zak Taccardi
09/28/2022, 9:49 PMZak Taccardi
09/28/2022, 9:57 PMfun TaskProvider<Sync>.asFileSystemLocationSingleFile(): Provider<FileSystemLocation> {
return flatMap { sync ->
sync.outputs.files.asFileTree.elements.map { it.first() }
}
}
worked! Needed to use .asFileTree
to get the actual file output instead of the directory