withSweetSpi

fun KotlinProjectExtension.withSweetSpi(compilationFilter: (KotlinCompilation<*>) -> Boolean = { it.name.endsWith("main", ignoreCase = true) })(source)

Adds the sweet-spi runtime and KSP processor dependencies to the compilations of all targets.

It's possible to filter compilations which should receive those dependencies using compilationFilter. By default, only main compilations are affected

Usage:

// in build.gradle.kts

// don't forget to add an import
import dev.whyoleg.sweetspi.gradle.*

kotlin {
// to add to `main` compilations only
withSweetSpi()

// to add to `test` compilation
withSweetSpi { it.name == "test" }
}

fun KotlinTarget.withSweetSpi(compilationFilter: (KotlinCompilation<*>) -> Boolean = { it.name.endsWith("main", ignoreCase = true) })(source)

Adds the sweet-spi runtime and KSP processor dependencies to the compilations of this target.

It's possible to filter compilations which should receive those dependencies using compilationFilter. By default, only main compilations are affected

Usage:

// in build.gradle.kts

// don't forget to add an import
import dev.whyoleg.sweetspi.gradle.*

kotlin {
jvm {
// to add to `main` compilations only
withSweetSpi()

// to add to all compilations
withSweetSpi { true }
}
}

fun KotlinCompilation<*>.withSweetSpi()(source)

Adds the sweet-spi runtime and KSP processor dependencies to the specified Kotlin compilation.

Usage:

// in build.gradle.kts

// don't forget to add an import
import dev.whyoleg.sweetspi.gradle.*

kotlin {
wasmJs {
compilations.named("test") {
withSweetSpi()
}
}
}