KT-44155: Add 'headers' option to Cocoapod config.
It is needed for Cinteroping with pods without module map inside
This commit is contained in:
committed by
Space
parent
4753c3f4a3
commit
84add3a27e
+3
-2
@@ -154,7 +154,7 @@ open class CocoapodsExtension(private val project: Project) {
|
|||||||
* Add a CocoaPods dependency to the pod built from this project.
|
* Add a CocoaPods dependency to the pod built from this project.
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun pod(name: String, version: String? = null, path: File? = null, moduleName: String = name.asModuleName()) {
|
fun pod(name: String, version: String? = null, path: File? = null, moduleName: String = name.asModuleName(), headers: String? = null) {
|
||||||
// Empty string will lead to an attempt to create two podDownload tasks.
|
// Empty string will lead to an attempt to create two podDownload tasks.
|
||||||
// One is original podDownload and second is podDownload + pod.name
|
// One is original podDownload and second is podDownload + pod.name
|
||||||
require(name.isNotEmpty()) { "Please provide not empty pod name to avoid ambiguity" }
|
require(name.isNotEmpty()) { "Please provide not empty pod name to avoid ambiguity" }
|
||||||
@@ -183,7 +183,7 @@ open class CocoapodsExtension(private val project: Project) {
|
|||||||
project.logger.warn(warnMessage)
|
project.logger.warn(warnMessage)
|
||||||
podSource = path.parentFile
|
podSource = path.parentFile
|
||||||
}
|
}
|
||||||
addToPods(CocoapodsDependency(name, moduleName, version, podSource?.let { Path(it) }))
|
addToPods(CocoapodsDependency(name, moduleName, headers, version, podSource?.let { Path(it) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -271,6 +271,7 @@ open class CocoapodsExtension(private val project: Project) {
|
|||||||
data class CocoapodsDependency(
|
data class CocoapodsDependency(
|
||||||
private val name: String,
|
private val name: String,
|
||||||
@get:Input var moduleName: String,
|
@get:Input var moduleName: String,
|
||||||
|
@get:Optional @get:Input var headers: String? = null,
|
||||||
@get:Optional @get:Input var version: String? = null,
|
@get:Optional @get:Input var version: String? = null,
|
||||||
@get:Optional @get:Nested var source: PodLocation? = null,
|
@get:Optional @get:Nested var source: PodLocation? = null,
|
||||||
@get:Internal var extraOpts: List<String> = listOf(),
|
@get:Internal var extraOpts: List<String> = listOf(),
|
||||||
|
|||||||
+8
-6
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Compan
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.GENERATE_WRAPPER_PROPERTY
|
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.GENERATE_WRAPPER_PROPERTY
|
||||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.SYNC_TASK_NAME
|
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin.Companion.SYNC_TASK_NAME
|
||||||
import org.jetbrains.kotlin.gradle.plugin.cocoapods.cocoapodsBuildDirs
|
import org.jetbrains.kotlin.gradle.plugin.cocoapods.cocoapodsBuildDirs
|
||||||
|
import org.jetbrains.kotlin.gradle.utils.appendLine
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,11 +330,12 @@ open class DefFileTask : DefaultTask() {
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
fun generate() {
|
fun generate() {
|
||||||
outputFile.parentFile.mkdirs()
|
outputFile.parentFile.mkdirs()
|
||||||
outputFile.writeText(
|
outputFile.writeText(buildString {
|
||||||
"""
|
appendLine("language = Objective-C")
|
||||||
language = Objective-C
|
with(pod.get()) {
|
||||||
modules = ${pod.get().moduleName}
|
if (headers != null) appendLine("headers = $headers")
|
||||||
""".trimIndent()
|
else appendLine("modules = $moduleName")
|
||||||
)
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user