[Cocoapods] Fail import if project's version wasn't specified
#Fixed KT-44000
This commit is contained in:
+16
@@ -309,6 +309,22 @@ class CocoaPodsIT : BaseGradleIT() {
|
||||
project.test(":kotlin-library:podDownload")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun errorIfVersionIsNotSpecified() {
|
||||
with(project.gradleBuildScript()) {
|
||||
useLines { lines ->
|
||||
lines.filter { line -> "version = \"1.0\"" !in line }.joinToString(separator = "\n")
|
||||
}.also { writeText(it) }
|
||||
}
|
||||
hooks.addHook {
|
||||
assertContains("Cocoapods Integration requires version of this project to be specified.")
|
||||
}
|
||||
|
||||
project.build(POD_IMPORT_TASK_NAME, "-Pkotlin.native.cocoapods.generate.wrapper=true") {
|
||||
assertFailed()
|
||||
hooks.trigger(this)
|
||||
}
|
||||
}
|
||||
|
||||
// up-to-date tests
|
||||
|
||||
|
||||
+9
-1
@@ -19,7 +19,15 @@ import java.net.URI
|
||||
open class CocoapodsExtension(private val project: Project) {
|
||||
@get:Input
|
||||
val version: String
|
||||
get() = project.version.toString()
|
||||
get() {
|
||||
require(project.version != Project.DEFAULT_VERSION) { """
|
||||
Cocoapods Integration requires version of this project to be specified.
|
||||
Please, add line 'version = "<version>"' to project's build file.
|
||||
For more details, please, see https://guides.cocoapods.org/syntax/podspec.html#version
|
||||
""".trimIndent()
|
||||
}
|
||||
return project.version.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure authors of the pod built from this project.
|
||||
|
||||
Reference in New Issue
Block a user