[Gradle] Explicitly forbid an interop-binding self-dependency in CocoaPods plugin
This commit is contained in:
committed by
Space Team
parent
bff1520c9e
commit
f7acbb5252
+15
@@ -1334,6 +1334,21 @@ class CocoaPodsIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `configuration fails when pod depends on itself`() = with(getProjectByName("native-cocoapods-dependant-pods")) {
|
||||||
|
gradleBuildScript().appendToCocoapodsBlock("""
|
||||||
|
pod("Foo") { useInteropBindingFrom("Foo") }
|
||||||
|
""".trimIndent())
|
||||||
|
|
||||||
|
build(
|
||||||
|
":help",
|
||||||
|
"-Pkotlin.native.cocoapods.generate.wrapper=true",
|
||||||
|
) {
|
||||||
|
assertFailed()
|
||||||
|
assertContains("Pod 'Foo' has an interop-binding dependency on itself")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// test configuration phase
|
// test configuration phase
|
||||||
|
|
||||||
private class CustomHooks {
|
private class CustomHooks {
|
||||||
|
|||||||
+4
@@ -378,6 +378,10 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
interop: DefaultCInteropSettings,
|
interop: DefaultCInteropSettings,
|
||||||
dependencyName: String,
|
dependencyName: String,
|
||||||
) {
|
) {
|
||||||
|
if (pod.name == dependencyName) {
|
||||||
|
error("Pod '${pod.name}' has an interop-binding dependency on itself")
|
||||||
|
}
|
||||||
|
|
||||||
val dependencyPod = cocoapodsExtension.pods.findByName(dependencyName)
|
val dependencyPod = cocoapodsExtension.pods.findByName(dependencyName)
|
||||||
?: error("Couldn't find declaration of pod '$dependencyName' (interop-binding dependency of pod '${pod.name}')")
|
?: error("Couldn't find declaration of pod '$dependencyName' (interop-binding dependency of pod '${pod.name}')")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user