[KT-53127] Add pod dependency version for synthetic generated project.
This commit is contained in:
committed by
Space
parent
07c9cfd486
commit
6d594d1a08
+22
@@ -29,6 +29,7 @@ import java.io.File
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
import kotlin.test.assertContentEquals
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
import kotlin.test.fail
|
import kotlin.test.fail
|
||||||
@@ -235,6 +236,27 @@ class CocoaPodsIT : BaseGradleIT() {
|
|||||||
project.testImportWithAsserts(listOf(podRepo))
|
project.testImportWithAsserts(listOf(podRepo))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testSyntheticProjectPodspecGeneration() {
|
||||||
|
val gradleProject = transformProjectWithPluginsDsl(cocoapodsSingleKtPod, gradleVersion)
|
||||||
|
gradleProject.gradleBuildScript().appendToCocoapodsBlock("""
|
||||||
|
pod("SSZipArchive")
|
||||||
|
pod("AFNetworking", "~> 4.0.1")
|
||||||
|
pod("Alamofire") {
|
||||||
|
source = git("https://github.com/Alamofire/Alamofire.git") {
|
||||||
|
tag = "5.6.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".trimIndent())
|
||||||
|
gradleProject.build("podGenIOS", "-Pkotlin.native.cocoapods.generate.wrapper=true") {
|
||||||
|
assertSuccessful()
|
||||||
|
val podfileText = gradleProject.projectDir.resolve("build/cocoapods/synthetic/IOS/Podfile").readText().trim()
|
||||||
|
assertTrue(podfileText.contains("pod 'SSZipArchive'"))
|
||||||
|
assertTrue(podfileText.contains("pod 'AFNetworking', '~> 4.0.1'"))
|
||||||
|
assertTrue(podfileText.contains("pod 'Alamofire', :git => '${gradleProject.projectDir.absolutePath}/build/cocoapods/externalSources/git/Alamofire', :tag => '5.6.1'"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testPodDownloadGitNoTagNorCommit() {
|
fun testPodDownloadGitNoTagNorCommit() {
|
||||||
doTestGit()
|
doTestGit()
|
||||||
|
|||||||
+19
-9
@@ -478,17 +478,27 @@ open class PodGenTask : CocoapodsTask() {
|
|||||||
buildString {
|
buildString {
|
||||||
append("pod '${it.name}'")
|
append("pod '${it.name}'")
|
||||||
|
|
||||||
val pathType = when (it.source) {
|
val version = it.version
|
||||||
is Path -> "path"
|
val source = it.source
|
||||||
is Url -> "path"
|
|
||||||
is Git -> "git"
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
|
|
||||||
val path = it.source?.getLocalPath(project, it.name)
|
if (source != null) {
|
||||||
|
val path = source.getLocalPath(project, it.name)
|
||||||
|
when (source) {
|
||||||
|
is Path, is Url -> {
|
||||||
|
append(", :path => '$path'")
|
||||||
|
}
|
||||||
|
|
||||||
if (path != null && pathType != null) {
|
is Git -> {
|
||||||
append(", :$pathType => '$path'")
|
append(", :git => '$path'")
|
||||||
|
when {
|
||||||
|
source.branch != null -> append(", :branch => '${source.branch}'")
|
||||||
|
source.tag != null -> append(", :tag => '${source.tag}'")
|
||||||
|
source.commit != null -> append(", :commit => '${source.commit}'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (version != null) {
|
||||||
|
append(", '$version'")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user