@@ -25,10 +25,10 @@ class KspConfigurations(private val project: Project) {
2525 ? : true
2626
2727 // The "ksp" configuration, applied to every compilation.
28- private val configurationForAll = project.configurations.create (PREFIX ). apply {
29- isCanBeConsumed = false
30- isCanBeResolved = false
31- isVisible = false
28+ private val configurationForAll = project.configurations.register (PREFIX ) {
29+ it. isCanBeConsumed = false
30+ it. isCanBeResolved = false
31+ it. isVisible = false
3232 }
3333
3434 private fun configurationNameOf (vararg parts : String ): String {
@@ -118,17 +118,19 @@ class KspConfigurations(private val project: Project) {
118118 is KotlinMultiplatformExtension -> {
119119 kotlin.targets.configureEach { decorateKotlinTarget(it, isKotlinMultiplatform = true ) }
120120
121- var reported = false
122- configurationForAll.dependencies.whenObjectAdded {
123- if (! reported) {
124- reported = true
125- val msg = " The 'ksp' configuration is deprecated in Kotlin Multiplatform projects. " +
126- " Please use target-specific configurations like 'kspJvm' instead."
127-
128- if (allowAllTargetConfiguration) {
129- project.logger.warn(msg)
130- } else {
131- throw InvalidUserCodeException (msg)
121+ configurationForAll.configure { configuration ->
122+ var reported = false
123+ configuration.dependencies.configureEach {
124+ if (! reported) {
125+ reported = true
126+ val msg = " The 'ksp' configuration is deprecated in Kotlin Multiplatform projects. " +
127+ " Please use target-specific configurations like 'kspJvm' instead."
128+
129+ if (allowAllTargetConfiguration) {
130+ project.logger.warn(msg)
131+ } else {
132+ throw InvalidUserCodeException (msg)
133+ }
132134 }
133135 }
134136 }
0 commit comments