[KT-53174] Add platform version to synthetic generated Podfile.
This commit is contained in:
committed by
Space
parent
b26155dd9e
commit
7d6cf449b1
+2
@@ -240,6 +240,7 @@ class CocoaPodsIT : BaseGradleIT() {
|
|||||||
fun testSyntheticProjectPodspecGeneration() {
|
fun testSyntheticProjectPodspecGeneration() {
|
||||||
val gradleProject = transformProjectWithPluginsDsl(cocoapodsSingleKtPod, gradleVersion)
|
val gradleProject = transformProjectWithPluginsDsl(cocoapodsSingleKtPod, gradleVersion)
|
||||||
gradleProject.gradleBuildScript().appendToCocoapodsBlock("""
|
gradleProject.gradleBuildScript().appendToCocoapodsBlock("""
|
||||||
|
ios.deploymentTarget = "14.1"
|
||||||
pod("SSZipArchive")
|
pod("SSZipArchive")
|
||||||
pod("AFNetworking", "~> 4.0.1")
|
pod("AFNetworking", "~> 4.0.1")
|
||||||
pod("Alamofire") {
|
pod("Alamofire") {
|
||||||
@@ -251,6 +252,7 @@ class CocoaPodsIT : BaseGradleIT() {
|
|||||||
gradleProject.build("podGenIOS", "-Pkotlin.native.cocoapods.generate.wrapper=true") {
|
gradleProject.build("podGenIOS", "-Pkotlin.native.cocoapods.generate.wrapper=true") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
val podfileText = gradleProject.projectDir.resolve("build/cocoapods/synthetic/IOS/Podfile").readText().trim()
|
val podfileText = gradleProject.projectDir.resolve("build/cocoapods/synthetic/IOS/Podfile").readText().trim()
|
||||||
|
assertTrue(podfileText.contains("platform :ios, '14.1'"))
|
||||||
assertTrue(podfileText.contains("pod 'SSZipArchive'"))
|
assertTrue(podfileText.contains("pod 'SSZipArchive'"))
|
||||||
assertTrue(podfileText.contains("pod 'AFNetworking', '~> 4.0.1'"))
|
assertTrue(podfileText.contains("pod 'AFNetworking', '~> 4.0.1'"))
|
||||||
assertTrue(podfileText.contains("pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '5.6.1'"))
|
assertTrue(podfileText.contains("pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '5.6.1'"))
|
||||||
|
|||||||
+9
@@ -457,6 +457,14 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
families += family
|
families += family
|
||||||
|
|
||||||
|
val platformSettings = when (family) {
|
||||||
|
Family.IOS -> cocoapodsExtension.ios
|
||||||
|
Family.OSX -> cocoapodsExtension.osx
|
||||||
|
Family.TVOS -> cocoapodsExtension.tvos
|
||||||
|
Family.WATCHOS -> cocoapodsExtension.watchos
|
||||||
|
else -> error("Unknown cocoapods platform: $family")
|
||||||
|
}
|
||||||
|
|
||||||
project.tasks.register(family.toPodGenTaskName, PodGenTask::class.java) {
|
project.tasks.register(family.toPodGenTaskName, PodGenTask::class.java) {
|
||||||
it.description = "Сreates a synthetic Xcode project to retrieve CocoaPods dependencies"
|
it.description = "Сreates a synthetic Xcode project to retrieve CocoaPods dependencies"
|
||||||
it.podspec = podspecTaskProvider.map { task -> task.outputFile }
|
it.podspec = podspecTaskProvider.map { task -> task.outputFile }
|
||||||
@@ -464,6 +472,7 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
|
|||||||
it.useLibraries = project.provider { cocoapodsExtension.useLibraries }
|
it.useLibraries = project.provider { cocoapodsExtension.useLibraries }
|
||||||
it.specRepos = project.provider { cocoapodsExtension.specRepos }
|
it.specRepos = project.provider { cocoapodsExtension.specRepos }
|
||||||
it.family = family
|
it.family = family
|
||||||
|
it.platformSettings = platformSettings
|
||||||
it.pods.set(cocoapodsExtension.pods)
|
it.pods.set(cocoapodsExtension.pods)
|
||||||
it.dependsOn(downloadPods)
|
it.dependsOn(downloadPods)
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -408,6 +408,9 @@ open class PodGenTask : CocoapodsTask() {
|
|||||||
@get:Internal
|
@get:Internal
|
||||||
lateinit var family: Family
|
lateinit var family: Family
|
||||||
|
|
||||||
|
@get:Nested
|
||||||
|
internal lateinit var platformSettings: PodspecPlatformSettings
|
||||||
|
|
||||||
@get:Nested
|
@get:Nested
|
||||||
internal lateinit var specRepos: Provider<SpecRepos>
|
internal lateinit var specRepos: Provider<SpecRepos>
|
||||||
|
|
||||||
@@ -480,6 +483,12 @@ open class PodGenTask : CocoapodsTask() {
|
|||||||
if (useLibraries.get().not()) {
|
if (useLibraries.get().not()) {
|
||||||
appendLine("\tuse_frameworks!")
|
appendLine("\tuse_frameworks!")
|
||||||
}
|
}
|
||||||
|
val deploymentTarget = platformSettings.deploymentTarget
|
||||||
|
if (deploymentTarget != null) {
|
||||||
|
appendLine("\tplatform :${platformSettings.name}, '$deploymentTarget'")
|
||||||
|
} else {
|
||||||
|
appendLine("\tplatform :${platformSettings.name}")
|
||||||
|
}
|
||||||
pods.get().mapNotNull {
|
pods.get().mapNotNull {
|
||||||
buildString {
|
buildString {
|
||||||
append("pod '${it.name}'")
|
append("pod '${it.name}'")
|
||||||
|
|||||||
Reference in New Issue
Block a user