kind of a weird one. I just fixed up an internal p...
# configuration-cache
kind of a weird one. I just fixed up an internal plugin to work with CC, and I've verified it works. However, when I try to write a spec verifying it, I get this error:
Copy code
1 problem was found storing the configuration cache.
- Task `:app:resignDebug` of type ``: value 'map(org.gradle.api.file.RegularFile map(property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, map(org.gradle.api.file.Directory flatmap(provider(task 'packageDebug', class check-type()))))) check-type())' failed to unpack provider
Any idea why this failure would appear in a test context but not when executed in a real context? It is admittedly a fairly complex chain of providers... (Gradle 7.4.1, AGP 7.0.4)
huh. The chain has an NPE in both the real and test cases, but only fails CC for the latter. That's odd
with configuration cache, does gradle have to resolve all
inputs at configuration time?
My rough understanding is that if a provider resolves to a fixed value post-configuration then that value gets serialized, rather than the provider itself (but often it doesn't, e.g. if you wire a task output to an input the value will only be known at execution time). So maybe a value somewhere in the chain is fixed post-configuration in your test but not in your real usage?
I have observed that in both the real and test situations, the provider is being queried at configuration time, when the final value is not ready yet (in fact the final value is a file that doesn't exist until execution time). I haven't yet found anywhere where I might be querying this value early.
looking at the stack traces, it's gradle all the way down. I'm not seeing any user code triggering this provider to be queried
I find this output extremely weird and confusing
Copy code
0 problems were found storing the configuration cache.

See the complete report at file:///...../build/reports/configuration-cache/8jv613vpgs12l1jt7kvolgyak/c5cqx0h8dlcjykb6opxpucv6s/configuration-cache-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:resignDebug'.
> Failed to query the value of task ':app:resignDebug' property 'packageFile'.
   > java.lang.NullPointerException (no error message)
I feel like those two things (0 problems + failure) are contradicting each other
I'm not sure how readable this is, but this is a diff of two stacktraces. The one on the left is the provider queried during configuration time. The one on the right is when it is queried during execution time. This is the only section where they differ.
Huh. I've seen the 'failed to unpack provider' thing a few times when task dependencies have accidentally been removed (e.g. { it.someProperty.get() }
instead of
taskProvider.flatMap { it.someProperty }
), but beyond that I'm out of my depth. 😛
appreciate it nonetheless 🙂 (and that makes two of us)