Slackbot
07/20/2022, 7:26 PMJavi
07/20/2022, 7:30 PMtoString
so it uses myProp.get().toString()
Ryan Schmitt
07/20/2022, 7:48 PMRyan Schmitt
07/20/2022, 7:48 PMJavi
07/20/2022, 8:01 PMValueSource
APIRyan Schmitt
07/20/2022, 8:39 PMValueSource
that the obtain()
method is called on each build, and the ValueSource
implementation deals with things like caching? For example, I can shell out to an external process, cache what it returns, and invalidate the cache when an input changes that I know about (but I have to handle all this myself instead of Gradle tracking it)Vampire
07/20/2022, 9:10 PMproject.version
is serializable should be irrelevant for configuration cache.
Iirc the config cache stores the tasks and their configuration / state.
and a task also is not allowed to access the project at execution time.Vampire
07/20/2022, 9:12 PMValueSource
, if you know the external processes delivers the same output for the same input, you can of course add some caching. The ValueSource
is indeed evaluated on each build and if the value changes, the cache entry is discarded. In that case, the value source is even calculated a second time during normal configuration phase.Ryan Schmitt
07/21/2022, 1:54 AMIn that case, the value source is even calculated a second time during normal configuration phase.Interesting; is that deliberate or just a bug?
Vampire
07/21/2022, 7:25 AMVampire
07/21/2022, 6:39 PMIn both approaches, if the value of the provider is used at configuration time then it will become a build configuration input. The external process will be executed for every build to determine if the configuration cache is up-to-date, so it is recommended to only call fast-running processes at configuration time. If the value changes then the cache is invalidated and the process will be run again during this build as part of the configuration phase.This is about running processes, but the second of the "both approaches" is using a
ValueSource
.