plugins
A module in a large project spends most of its build file repeating the same setup: the same target platforms, the same compiler flags, the same test dependencies. These plugins move that setup out of the build file and leave behind a scaffold {} block where a module declares only the choices it actually has to make.
Apply the root plugin on the root project, then one plugin per module.
// root build.gradle.kts
plugins {
id("io.github.thomaskioko.gradle.plugins.root")
}Content copied to clipboard
// a module's build.gradle.kts
plugins {
id("io.github.thomaskioko.gradle.plugins.multiplatform")
}
scaffold {
useMetro()
}Content copied to clipboard
The root plugin registers the aggregate test tasks, sets the daemon toolchain vendor, configures dependency analysis and the module graph tasks, and checks that it was applied to the root project and not a module. Every module plugin checks that the root plugin is present and fails with a clear message when it is not.