hi folks, i’m trying to wrap my head around the order of gradle scripts in a multi-project build with a buildSrc for convention plugins. I’ve placed printlns across my *.gradle.kts files so I have a sense of the order from that:
1. ./settings.gradle.kts
2. ./buildSrc/settings.gradle.kts
3. ./buildSrc/build.gradle.kts
4. /build.gradle.kts
5. buildSrc convention plugins
6. project build.gradle.kts
From that I see that I cannot define say the kotlin jvm plugin version in /build.gradle.kts if it is also defined in buildSrc/build.gradle.kts because gradle seems to only want the version declared once and as early as possible.
So my question is, where can i find more information on this ordering and details about when/where versions can be defined?
c
cristiangm
05/28/2022, 7:56 PM
I think what you want is not exactly what you asked
cristiangm
05/28/2022, 7:58 PM
buildSrc/build.gradle[.kts] dependencies are added to the classpath for all the projects, and they o override any classpath you defined in them
cristiangm
05/28/2022, 7:59 PM
Does that answer your question?
t
tim
05/28/2022, 8:00 PM
I think so … whatever is in buildSrc/build.gradle.kts takes priority?
e
ephemient
05/28/2022, 8:13 PM
buildSrc runtime dependencies are inserted before the root project's buildscript classpath, which takes precedence over whatever any subprojects add
ephemient
05/28/2022, 8:14 PM
includeBuild removes the special-ness and acts like any other buildscript classpath or plugin
t
tim
05/28/2022, 8:23 PM
makes sense 🙏
tim
05/28/2022, 8:23 PM
i assume i’d need to dig into gradle’s source to understand this?