I have `build-logic` included build I use for conv...
# community-support
m
I have
build-logic
included build I use for convention plugins, the type you apply to gradle projects to unify declarations like
android { }
In my gradle scan I get this message
Copy code
The build cache configuration of the root build differs from the build cache configuration of the early evaluated ':build-logic' included build. It is recommended to keep them consistent, see here.
From what I could look up this is due to the fact I compose my included build inside
pluginManagement { }
instead of directly on the
settings.gradle.kts
itself I guess I have a few questions: 1. Can I include my
build-logic
outside of
pluginManagement { }
? 2. Alternatively I could copy over buildCache configuration to the
build-logic
? What's the right approach? Is using pluginManagement includeBuild() a specific case that should be used only in some situations? Like providing a plugin that targets the
settings.gradle.kts
itself?
v
If you have a settings plugin, you must do it inside
pluginManagement { ... }
or it will not work. If you only have project plugins, you indeed could do the include outside of
pluginManagement { ... }
, most probably because previously inside
pluginManagement { ... }
it was not possible. But actually it is usually better practice to indeed include build logic inside
pluginManagement { ... }
even if you only have project plugins. The important point is, that if you have an included build outside
pluginManagement { ... }
(or also
buildSrc
) then the build cache configuration of the including build is inherited to the included build and the included build's build cache configuration is ignored. But for builds included inside
pluginManagement { ... }
those are loaded before the cache configuration of the including build and so there the build's own cache configuration is used and due to that the build scan recommends to synchronize the build cache settings.
m
Can you then confirm I got it right? I am thinking about making a
Plugin<Settings>
possibly inside my existing
build-logic
or making a separate
settings-logic
included build to also connect inside
pluginManagement { }
I would then publish this plugin so that it's possible to apply it to the included build that provides it and in that plugins I would setup common build cache configuration for all gradle builds. It seems like this way I can write build cache configuration once & keep my convention plugin included build inside
pluginManagement { }
v
Sounds like a plan 🙂
🙂 1