Skip to content

Commit 61a3a32

Browse files
committed
Build: Add workaround for KSP execution in common-only modules
This commit adds a workaround to the build scripts for the `fluent`, `fluent-icons-core`, and `fluent-icons-extended` modules to address an issue with KSP task dependencies. When KSP is configured only for the `commonMain` source set, other compilation tasks do not automatically depend on the `kspCommonMainKotlinMetadata` task. This change explicitly adds this dependency to all Kotlin compilation tasks, ensuring that KSP runs before them.
1 parent dcc80e6 commit 61a3a32

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

fluent-icons-core/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import io.github.composefluent.plugin.build.BuildConfig
22
import io.github.composefluent.plugin.build.applyTargets
3+
import org.gradle.kotlin.dsl.withType
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
35

46
plugins {
57
alias(libs.plugins.kotlin.multiplatform)
@@ -27,6 +29,14 @@ dependencies {
2729
add("kspCommonMainMetadata", processor)
2830
}
2931

32+
// workaround for KSP only in Common Main.
33+
// https://github.com/google/ksp/issues/567
34+
tasks.withType<KotlinCompilationTask<*>>().configureEach {
35+
if (name != "kspCommonMainKotlinMetadata") {
36+
dependsOn("kspCommonMainKotlinMetadata")
37+
}
38+
}
39+
3040
ksp {
3141
arg("source.generated.module.name", "FluentIconCore")
3242
arg("source.generated.module.enabled", false.toString())

fluent-icons-extended/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import io.github.composefluent.plugin.build.BuildConfig
22
import io.github.composefluent.plugin.build.applyTargets
3+
import org.gradle.kotlin.dsl.withType
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
35

46
plugins {
57
alias(libs.plugins.kotlin.multiplatform)
@@ -28,6 +30,14 @@ dependencies {
2830
add("kspCommonMainMetadata", processor)
2931
}
3032

33+
// workaround for KSP only in Common Main.
34+
// https://github.com/google/ksp/issues/567
35+
tasks.withType<KotlinCompilationTask<*>>().configureEach {
36+
if (name != "kspCommonMainKotlinMetadata") {
37+
dependsOn("kspCommonMainKotlinMetadata")
38+
}
39+
}
40+
3141
ksp {
3242
arg("source.generated.module.name", "FluentIconExtended")
3343
arg("source.generated.module.enabled", false.toString())

fluent/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import io.github.composefluent.plugin.build.BuildConfig
22
import io.github.composefluent.plugin.build.applyTargets
3+
import org.gradle.kotlin.dsl.withType
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
35

46
plugins {
57
alias(libs.plugins.kotlin.multiplatform)
@@ -34,6 +36,14 @@ dependencies {
3436
add("kspCommonMainMetadata", processor)
3537
}
3638

39+
// workaround for KSP only in Common Main.
40+
// https://github.com/google/ksp/issues/567
41+
tasks.withType<KotlinCompilationTask<*>>().configureEach {
42+
if (name != "kspCommonMainKotlinMetadata") {
43+
dependsOn("kspCommonMainKotlinMetadata")
44+
}
45+
}
46+
3747
ksp {
3848
arg("source.generated.module.name", project.name)
3949
}

0 commit comments

Comments
 (0)