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.

(cherry picked from commit bfa9de1)
  • Loading branch information
ting-yuan authored and KSP Auto Pick committed Nov 1, 2024
1 parent 36d36e6 commit b2c20a5
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 b2c20a5

Please sign in to comment.