Skip to content

Commit

Permalink
Disable KSP2 tasks with corresponding compilation
Browse files Browse the repository at this point in the history
If the corresponding Kotlin native compilation is disabled, KSP should
be disabled as well.

This aligns with KSP1's behavior.
  • Loading branch information
ting-yuan committed Nov 1, 2024
1 parent 2a571ad commit bfa9de1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmAndroidCompilation
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
import org.jetbrains.kotlin.konan.target.HostManager
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.ObjectOutputStream
Expand Down Expand Up @@ -269,6 +270,11 @@ abstract class KspAATask @Inject constructor(
val konanTargetName = kotlinCompilation.target.konanTarget.name
cfg.konanTargetName.value(konanTargetName)
cfg.konanHome.value((kotlinCompileProvider.get() as KotlinNativeCompile).konanHome)
kspAATask.onlyIf {
HostManager().enabled.any {
it.name == konanTargetName
}
}
}

// TODO: pass targets of common
Expand Down

0 comments on commit bfa9de1

Please sign in to comment.