Setup Lyricist for Kotlin Multiplatform (KMP)
mainDue to current KSP limitations, code generation for KMP must be performed at commonMain. Use the following configuration to apply the processor to commonMainMetadata and manually include the generated directory in your commonMain source set.
dependencies {
add("kspCommonMainMetadata", "cafe.adriel.lyricist:lyricist-processor:${latest-version}")
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if(name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
kotlin.sourceSets.commonMain {
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
}