Does anybody use composite builds ("build-logic") ...
# gradle
h
Does anybody use composite builds ("build-logic") with applying the kotlin multiplatform plugin? I always get the error
The root project is not yet available for build
called in
registerProjectStructureMetadata
e
does it work with
Copy code
plugins {
    kotlin("multiplatform") apply false
}
in your root project? (may need a version)
KMP plugin needs to coordinate installation of Konan, NodeJS, etc. between projects and does so through the root project. AGP has similar requirements too
h
Yeah, that did work too. I found another workaround, instead of using a
.gradle.kts
plugin, I used a "normal" plugin (defined in kt file), then it worked too. But still strange
e
oh the plugin precompiled process would have issues with that, yeah
Gradle runs the plugin in order to learn what its extensions are so it can generate type-safe accessors, but the KMP plugin can't run in the "not a real project" world
h
Oh, that sounds more complex. I thought the precompiled plugins were basically "normal" plugins putting everything into the
apply(project: Project)
functions.
e
if I have a
.gradle.kts
that contains
Copy code
plugins {
    `java-library`
}
then I can use
Copy code
java {
    ...
}
in that script, because Gradle has executed the Java library plugin during the build (it will execute again when applied)
with binary plugins, you do everything yourself, so you need to rely on
Copy code
project.the<JavaExtension>()
or whatever it is, there are no type-safe accessors generated for you
(ditto Kotlin, except I can't use it as an example on the first part for reasons discussed)
h
Makes sense, thanks.