This message was deleted.
# configuration-cache
s
This message was deleted.
1
r
What kind of work would you want to do on a build that has no task work to perform?
f
Just call get on the provider in your plugin or build script.
👎 1
t
What kind of work would you want to do on a build that has no task work to perform?
write reports
Just call get on the provider in your plugin or build script.
I've tried - didn't work. Which is logical as plugin configuration is skipped on configuration cache reuse
f
What do you mean with plugin configuration? The
apply
function in a plugin should always be called, otherwise the tasks that Gradle needs to find out if something changed would never get registered. What is probably happening is that the project you are running it against never gets evaluated, because it's not needed. Do you have a minimal reproducer?
👎 1
🤔 1
t
just checked - plugin
apply()
method is not called on configuration cache reuse
f
Is the project being evaluated? Is it the root project? Gradle won't call the
apply
function if it never evaluates the project.
t
On configuration cache reuse Gradle does not reevaluate the project if nothing was changed
same with Gradle 7+
f
Your log is showing exactly what I'm getting at. It never evaluates the
simpleProject
because there is no task requested for the project. If you want your plugin to always be executed apply it to the root project, or turn it into a settings plugin.
👎 1
t
simpleProject
is a single project 🙂 How settings plugin will help here? I suppose if settings classpath was not changed - Gradle will also skip settings evaluation 🤔
👍 1
f
Just throw a
println("hello")
into your settings script, it is always going to be printed, always. Same goes for the build script of your root project. Now replace the
println
with
gradle.sharedServices.registerIfAbsent(...).get()
and your build service is always created, always.
🤔 1
👎 1
t
I've thrown
println("hello")
into
settings.gradle
and build on configuration cache reuse does not print "hello" 🤷‍♂️
f
Build configuration inputs include:
• Init scripts, settings scripts, build scripts.
• System properties, Gradle properties, environment variables used during the configuration phase
• Configuration files accessed using value suppliers such as providers
buildSrc
build configuration inputs and source files.
https://docs.gradle.org/current/userguide/configuration_cache.html
Yeah, seems like the scripts themselves are cached away as well. It actually makes sense to force people to turn their builds into side effect free builds. Well, I guess you're out of luck (for good reason).
t
Proper fix - service should implement
OperationCompletionListener
and register itself to BuildEventsListenerRegistry
f
👍
What kind of report are you creating so that you need it even if nothing executed? Some kind of performance measuring?
t
yes
d
i had issues with Gradle Enterprise scans not sending our custom data when it was being added in
buildSrc
, I was able to get around it by creating a plugin to do that which I'm appying in
settings.gradle