diff --git a/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt b/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt index 325ac1444a7e9..2b2ebab77c346 100644 --- a/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt +++ b/plugins/package-managers/cocoapods/src/main/kotlin/CocoaPods.kt @@ -249,6 +249,26 @@ private fun getPackageReferences(podfileLock: File): Set { val dependencies = node[entry]?.map { it.textValue().substringBefore(" ") }.orEmpty() dependenciesForName.getOrPut(name) { mutableSetOf() } += dependencies + + // If this node has sub dependencies, append them to the dependency tracking. + // Sub dependencies are additional dependencies that are required. + // For more details, refer to issue #7523. + if (node is ObjectNode) { + val subEntries = node[entry].map { it.textValue() } + subEntries.filter { it.contains("(= ") }.forEach { subEntry -> + val (subDependencyName, subDependencyVersion) = NAME_AND_VERSION_REGEX.find(subEntry)!!.groups.let { + it[1]!!.value to it[2]!!.value.removeSurrounding("(= ", ")") + } + + // Add sub dependency if it's not already tracked + if (!versionForName.containsKey(subDependencyName)) { + versionForName[subDependencyName] = subDependencyVersion + + val subDependencies = node[subEntry]?.map { it.textValue().substringBefore(" ") }.orEmpty() + dependenciesForName.getOrPut(subDependencyName) { mutableSetOf() } += subDependencies + } + } + } } fun createPackageReference(name: String): PackageReference =