CocoaPods: Replace '-' with '_' in podspec name

This commit is contained in:
Ilya Matveev
2019-03-05 19:31:09 +03:00
parent 230f11df42
commit 45c2489a53
2 changed files with 15 additions and 4 deletions
@@ -128,7 +128,7 @@ open class KotlinCocoapodsPlugin: Plugin<Project> {
interop.packageName = "cocoapods.${pod.moduleName}"
project.findProperty(CFLAGS_PROPERTY)?.toString()?.let { args ->
// XCode quotes around paths with spaces.
// Xcode quotes around paths with spaces.
// Here and below we need to split such paths taking this into account.
interop.compilerOpts.addAll(args.splitQuotedArgs())
}
@@ -19,8 +19,10 @@ import java.io.File
*/
open class PodspecTask : DefaultTask() {
private val specName = project.name.asValidFrameworkName()
@OutputFile
val outputFile: File = project.projectDir.resolve("${project.name}.podspec")
val outputFile: File = project.projectDir.resolve("$specName.podspec")
@Nested
lateinit var settings: CocoapodsExtension
@@ -34,7 +36,6 @@ open class PodspecTask : DefaultTask() {
val versionSuffix = if (pod.version != null) ", '${pod.version}'" else ""
"| spec.dependency '${pod.name}'$versionSuffix"
}.joinToString(separator = "\n")
val specName = project.name.asValidFrameworkName()
outputFile.writeText("""
|Pod::Spec.new do |spec|
@@ -78,6 +79,16 @@ open class PodspecTask : DefaultTask() {
| ]
|end
""".trimMargin())
logger.quiet(
"""
Generated a podspec file at: ${outputFile.absolutePath}.
To include it in your Xcode project, add the following dependency snippet in your Podfile:
pod '$specName', :path => '${outputFile.parentFile.absolutePath}'
""".trimIndent()
)
}
}
@@ -86,7 +97,7 @@ open class PodspecTask : DefaultTask() {
*
* We represent a Kotlin/Native module to CocoaPods as a vendored framework.
* CocoaPods needs access to such frameworks during installation process to obtain
* their type (static or dynamic) and configure the XCode project accordingly.
* their type (static or dynamic) and configure the Xcode project accordingly.
* But we cannot build the real framework before installation because it may
* depend on CocoaPods libraries which are not downloaded and built at this stage.
* So we create a dummy static framework to allow CocoaPods install our pod correctly