Slackbot
09/14/2022, 7:38 PMRafael Chaves
09/14/2022, 10:14 PMFleshgrinder
09/15/2022, 5:43 AMTapchicoma
09/15/2022, 6:37 AMWhat kind of work would you want to do on a build that has no task work to perform?write reports
Tapchicoma
09/15/2022, 6:38 AMJust 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
Fleshgrinder
09/15/2022, 6:40 AMapply
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?Tapchicoma
09/15/2022, 6:48 AMapply()
method is not called on configuration cache reuseFleshgrinder
09/15/2022, 6:48 AMapply
function if it never evaluates the project.Tapchicoma
09/15/2022, 6:51 AMTapchicoma
09/15/2022, 6:52 AMFleshgrinder
09/15/2022, 6:53 AMsimpleProject
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.Tapchicoma
09/15/2022, 7:01 AMsimpleProject
is a single project 🙂
How settings plugin will help here? I suppose if settings classpath was not changed - Gradle will also skip settings evaluation 🤔Fleshgrinder
09/15/2022, 7:02 AMprintln("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.Tapchicoma
09/15/2022, 7:10 AMprintln("hello")
into settings.gradle
and build on configuration cache reuse does not print "hello" 🤷♂️Fleshgrinder
09/15/2022, 7:15 AMBuild 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
•build configuration inputs and source files.buildSrc
— https://docs.gradle.org/current/userguide/configuration_cache.htmlYeah, 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).
Tapchicoma
09/15/2022, 11:49 AMOperationCompletionListener
and register itself to BuildEventsListenerRegistryFleshgrinder
09/15/2022, 11:49 AMFleshgrinder
09/15/2022, 11:53 AMTapchicoma
09/15/2022, 4:31 PMDavid Chang
09/15/2022, 6:06 PMbuildSrc
, I was able to get around it by creating a plugin to do that which I'm appying in settings.gradle