[KT-53340] Cocoapods fix: apply config only to registered frameworks.

This commit is contained in:
konstantin.tskhovrebov
2022-08-02 19:37:17 +02:00
committed by Space
parent c37017641a
commit b58d2d72e7
@@ -93,13 +93,15 @@ abstract class CocoapodsExtension @Inject constructor(private val project: Proje
/** /**
* Configure framework of the pod built from this project. * Configure framework of the pod built from this project.
*/ */
fun framework(configure: Framework.() -> Unit) = configureRegisteredFrameworks(configure) fun framework(configure: Framework.() -> Unit) {
forAllPodFrameworks(configure)
}
/** /**
* Configure framework of the pod built from this project. * Configure framework of the pod built from this project.
*/ */
fun framework(configure: Action<Framework>) = framework { fun framework(configure: Action<Framework>) {
configure.execute(this) forAllPodFrameworks(configure)
} }
val ios: PodspecPlatformSettings = PodspecPlatformSettings("ios") val ios: PodspecPlatformSettings = PodspecPlatformSettings("ios")
@@ -238,14 +240,16 @@ abstract class CocoapodsExtension @Inject constructor(private val project: Proje
configure.execute(this) configure.execute(this)
} }
private fun configureRegisteredFrameworks(configure: Framework.() -> Unit) { private fun forAllPodFrameworks(action: Action<in Framework>) {
project.multiplatformExtension.supportedTargets().all { target -> project.multiplatformExtension.supportedTargets().all { target ->
target.binaries.withType(Framework::class.java) { framework -> target.binaries
framework.configure() .matching { it.name.startsWith(POD_FRAMEWORK_PREFIX) }
if (!framework.isStatic) { .withType(Framework::class.java) {
configureLinkingOptions(framework) action.execute(it)
if (!it.isStatic) {
configureLinkingOptions(it)
}
} }
}
} }
} }