Philip W
10/16/2024, 5:40 PMPhilip W
10/16/2024, 5:42 PMinternal abstract class GripEnvValueSource : ValueSource<Map<String, String>, Parameters> {
interface Parameters : ValueSourceParameters {
val apiFiles: ConfigurableFileCollection
}
override fun obtain(): Map<String, String> = buildMap {
for (apiFile in parameters.apiFiles) {
for (createdFlow in Json.decodeFromString<List<CreatedFlow>>(apiFile.readText())) {
}}}Philip W
10/16/2024, 5:43 PMproviders.of(GripEnvValueSource::class) {
parameters {
apiFiles.from(configurations.foo)
}
}
I still get the error when consuming the ValueSource: File does not existVampire
10/16/2024, 6:32 PMVampire
10/16/2024, 6:32 PMVampire
10/16/2024, 6:32 PMPhilip W
10/16/2024, 6:33 PMPhilip W
10/16/2024, 6:34 PMVampire
10/16/2024, 6:39 PMPhilip W
10/16/2024, 6:43 PMPhilip W
10/16/2024, 6:45 PMPhilip W
10/16/2024, 6:45 PMVampire
10/16/2024, 6:49 PMPhilip W
10/16/2024, 6:50 PMMikhail Lopatkin
10/17/2024, 10:12 AMDoes Gradle support task dependencies for ValueSources?No, no task dependencies at the moment.
to configure the list via a file (that is a outcome of another task).It isn't clear why you need a ValueSource for that. When dealing with task outputs, you can have something like
producerTaskProvider.flatMap { it.outputFileProvider }.map { readStringList(it) } and use it as a value for the ListProperty of the consuming task. It will bring task dependencies along. CC is aware of task outputs and won't evaluate these providers when storing the cache, but will record the transformation instead.
The only thing to be mindful of is https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:not_yet_implemented:accessing_top_level_at_execution when declaring readStringList.Philip W
10/17/2024, 10:16 AM