This message was deleted.
# configuration-cache
s
This message was deleted.
v
Yes, it does
🤯 1
m
Wow that's impressive. But I guess there's no real other way. Thanks for the insights!
v
If you look at the
--info
output when a new daemon is started, for example when using
--no-daemon
, you see that one of the daemon arguments is
-javaagent:...\.gradle\wrapper\dists\gradle-x.y-bin\...\gradle-x.y\lib\agents\gradle-instrumentation-agent-x.y.jar
šŸ‘€ 1
This agent instruments the whole build script classpath to track the configuration cache inputs as good as it can.
m
Sounds like that could potentially be expensive? You'd have to visit/rewrite every class on the fly?
v
That's also the reason some builds break if they do dirty things like looking up some jar from the build script classpath and using it outside to start a separate process or similar. This then fails with missing classes, as the instrumented classes are used and then miss the injected Gradle classes.
😮 1
Sounds like that could potentially be expensive? You'd have to visit/rewrite every class on the fly?
It is persisted and reused. So on first usage it might need some more time than before, but then it should just work. And anytime worth the time you save in return for using CC
šŸ‘ 1
m
Fair enough. Thanks for the details, as always! thank you
šŸ‘Œ 1
j
In any case I would strive for consistently accessing all such state through
layout...
and
providers...
. Then it's clearer for you and for Gradle what is part of the build configuration. E.g.:
Copy code
layout.projectDirectory.file("....")
providers.environmentVariable("...")
(I think if it would have been my call, I would have used the instrumentation to forbidden
System.env
and such in future versions and direct everyone to a consistent API. But that's would have been a too drastic breaking change for Gradle I presume.)
v
That would be a horrible idea imho. The instrumentation is important for 3rd party libs you use in your build logic that you cannot gradlify. If such calls would simply be forbidden, you just couldn't use them anymore.
j
I guess. Although I am not sure if I want libraries reading state from "somewhere" without me knowing. But yes, you are right that it is quite common and probably unpractical because of that.
m
I wish this was a setting: • Warn (current) • Error (suggestion from Jendrik) • None (if I'm confident with my build and want to remove the associated overhead)
j
But would be nice to see this instrumentation etc being used in the future to generates reports of this. Then I can know where my build gets state from.
v
Shouldn't this be visible from CC report?