Kelvin Chung
07/09/2024, 8:50 PM@PathSensitive work with output file properties? I have this task here:
abstract class DownloadSomethingTask : DefaultTask() {
@get:Input
abstract val filepaths: ListProperty<String>
@get:OutputFiles
val outputFiles: Provider<List<RegularFile>> = ... // computed from filepaths
}
I'm seeing issues where running an instance of a task gives UP-TO-DATE, indicating that no files were downloaded, and probably in need of a fix on that front.Martin
07/09/2024, 9:42 PM@PathSensitiveMartin
07/09/2024, 9:43 PMUP-TO-DATE , it means your filepaths inputs did not changeMartin
07/09/2024, 9:43 PMKelvin Chung
07/09/2024, 9:45 PMfilepaths and downloads files from some remote, each to an output location; outputFiles is computed from filepaths, indicating which each input file path corresponds to which output file.Kelvin Chung
07/09/2024, 9:46 PMMartin
07/09/2024, 9:46 PMKelvin Chung
07/09/2024, 9:47 PMMartin
07/09/2024, 9:47 PM@get:InputMartin
07/09/2024, 9:47 PMUP-TO-DATE but if you’re downloading from the internet it’s probably what you want.Martin
07/09/2024, 9:48 PMMartin
07/09/2024, 9:48 PMEric Haag
07/09/2024, 9:54 PM@UntrackedTask.
https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/UntrackedTask.html
Martin is right that when you're downloading something, you don't know if the remote resource has changed, so it should opt-out of incremental building and build caching. Unless there is some value you can use to "reasonably assume" the remote resource hasn't changed, like the version number of a GitHub release.Kelvin Chung
07/09/2024, 9:57 PMVampire
07/10/2024, 6:37 AMI think the issue is that if the inputs didn't change, there is an assumption that the output files exist, which I have to break somehow since that might not be true.
Should not be the case, unless you used something like
outputs.upToDateWhen { true } or similar.
A task is only considered up-to-date if the inputs did not change, the outputs did not change, and the classpath / implementation of the task did not change.
But yeah, if it depends on external input it is most often to mark the task untracked, but still have the inputs and outputs annotated properly, for example to wire task inputs and outputs together properly.