Slackbot
08/09/2022, 9:13 AMNiels Doucet
08/09/2022, 9:24 AMproject.getLayout().dir(regularFileProperty.getAsFile().map(File::getParentFile))Eli Graber
08/09/2022, 9:38 AMProvider<Directory> but I need a DirectoryPropertyNiels Doucet
08/09/2022, 9:43 AMproject.getObjects().directoryProperty().value(Provider<Directory>)Niels Doucet
08/09/2022, 9:44 AMEli Graber
08/09/2022, 10:00 AMmap before the task runs. Although that may be the fault of the API I'm calling.Niels Doucet
08/09/2022, 10:05 AMgetAsFile and use a mapper there as well, that way the entire chain should be safe to use, I think.Vampire
08/09/2022, 11:00 AMDirectoryProperty is probably badly designed or could even be called buggy. It should accept instead a Provider<Directory>, then it would also accept DirectoryProvider and DirectoryProperty.Chris Lee
08/09/2022, 1:14 PMDirectoryProperty.set is overloaded with variants taking Directory and Provider<Directory>Eli Graber
08/26/2022, 6:39 PMAlso the consumer expectingThe reasoning I got from them is:is probably badly designed or could even be called buggy. It should accept instead aDirectoryProperty, then it would also acceptProvider<Directory>andDirectoryProvider.DirectoryProperty
the problem of Provider<Directory> is that we cannot set the location ourselves which we want to do in order to avoid accidental overrides with 2 tasks outputing in the same location. That's why we use DirectoryProperty.
Perhaps you should avoid theHere's what I ended up with:and use a mapper there as wellgetAsFile
objects.directoryProperty().run {
fileProvider(
task.output.map { outputFile ->
outputFile.asFile.parentFile
}
)
}
How can I avoid calling asFile here?