Slackbot
12/07/2023, 6:24 AMVampire
12/07/2023, 10:06 AMbuildSrc behave more like included builds in some respects. But there are slight differences.
For example buildSrc is always built automatically and the result and dependencies put to a parent classloader over the build script class loaders. This means it does not take part in conflict resolution but overrides what would be used in the build scripts. This can also lead to some classloader issues or problems with applying plugins with version that are also declared as dependency in buildSrc. But also with an included build there can be similar but slightly different problems.
An included build is only built if actually used and only put to the classpath where used, and also taking part in conflict resolution if conflicts arise for example in transitive dependencies.
By being in the parent class loader of all build scripts a change in buildSrc means that the classpath of all build scritps changes and nothing is up-to-date, while a change in an included build only makes things out of date where it is used.
But if you have for example a small build where all convention plugins are used in all projects for example, the difference does not really matter much. If you have dozens of custom tasks and plugins and only use some in some projects and some in others, it might be better to have one or more included builds and there maybe even muliple projects.
I personally prefer to have an included build in gradle/build-logic unless I really need buildSrc, for example to monkey-patch a 3rd party plugin, which is not possible with an included build.A Abhishek
12/07/2023, 10:23 AM