Would it ever be possible for the cacheKey of two ...
# caching
r
Would it ever be possible for the cacheKey of two tasks in completely separate gradle builds to be identical?
I found an issue here https://github.com/Kotlin/kotlinx-kover/issues/633 where the cache key is identical for the different projects in the same gradle build is identical, causing some issues, but I'm wondering if just adding the
path
of the project is enough, or if there should be more inputs to make sure that entries are not reused between different gradle builds
v
Everything, that influences the output must be an input. So I didn't think that in that case the project path is sufficient. If you have different builds with same project path, but different directories that will be in that file, you have the same problem again. The question also is, what that task does. Is it really worth being cacheable?
r
That's a good question, it's most likely not even worth it to be a task in the first place. All it really does is write a file with directories to consider source directories by other tasks
Recomputing that in every configuration phase is probably faster than having to read from disk every time
v
Well, then maybe that is the way to go. Make it a shared build service that you then use to configure the other tasks. This then also can be skipped when using the configuration cache.
r
I think even a shared build service will be overkill. The task is configured with input directories. Those are all written out to a file and then there's other tasks being configured to take the input of that file and read the contents of those directories.
v
The build service would be the way to only do the calculation once and only if necessary.