Just checking - if `settings.gradle.kts` includes ...
# community-support
r
Just checking - if
settings.gradle.kts
includes a
build-logic
build, which includes
buildlogic.kotlin-application-conventions.gradle.kts
, my actual projects have to include it as
id("buildlogic.kotlin-application-conventions")
? There's no typesafe accessor for it?
v
That's half-way correct. That's one of the few differences between
buildSrc
and an included build. To have type-safe accessors, that respective plugins have to be present in the classpath already. If you have
id("buildlogic.kotlin-application-conventions")
in your build script, it searches for the plugin by string in included builds (amongst other places) and if found, builds it and then adds it to the classpath. So when it is added to the classpath is past the time the accessor would be used.
buildSrc
classes and dependencies are added to a classloader up the hierarchy of the buildscript classpath classloaders, so there the plugins are already in the classpath and thus type-safe accessors can be used. What you could do to have type-safe accessors in build scripts, is to add the plugin to the settings script classpath. Because the settings classpath class loader again is up the hierarchy of the build script class loaders and thus type-safe accessors are available.
r
Understood, thanks!
👌 1