Gradle, CocoaPods: Use synthetic dir as a working dir for pod gen
'Pod gen' creates an empty folder named 'Pods' in a directory where it is executed. Earlier, 'pod gen' was executed in a project root directory, so this `Pods` folder was created in a VCS-controlled place. This patch fixes this issue by running 'pod gen' in a directory where the synthetic project is located.
This commit is contained in:
committed by
Ilya Matveev
parent
7c3eda31fa
commit
a62f65940d
+4
-4
@@ -124,19 +124,19 @@ open class PodGenTask : CocoapodsWithSyntheticTask() {
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun generate() {
|
fun generate() {
|
||||||
val podspecDir = podspecProvider.get().parentFile
|
val syntheticDir = project.cocoapodsBuildDirs.synthetic(kotlinNativeTarget).apply { mkdirs() }
|
||||||
val localPodspecPaths = cocoapodsExtension.pods.mapNotNull { it.podspec?.parentFile?.absolutePath }
|
val localPodspecPaths = cocoapodsExtension.pods.mapNotNull { it.podspec?.parentFile?.absolutePath }
|
||||||
|
|
||||||
val podGenProcessArgs = listOfNotNull(
|
val podGenProcessArgs = listOfNotNull(
|
||||||
"pod", "gen",
|
"pod", "gen",
|
||||||
"--platforms=${kotlinNativeTarget.platformLiteral}",
|
"--platforms=${kotlinNativeTarget.platformLiteral}",
|
||||||
"--gen-directory=${project.cocoapodsBuildDirs.synthetic(kotlinNativeTarget).absolutePath}",
|
"--gen-directory=${syntheticDir.absolutePath}",
|
||||||
localPodspecPaths.takeIf { it.isNotEmpty() }?.joinToString(separator = ",")?.let { "--local-sources=$it" },
|
localPodspecPaths.takeIf { it.isNotEmpty() }?.joinToString(separator = ",")?.let { "--local-sources=$it" },
|
||||||
podspecProvider.get().name
|
podspecProvider.get().absolutePath
|
||||||
)
|
)
|
||||||
|
|
||||||
val podGenProcess = ProcessBuilder(podGenProcessArgs).apply {
|
val podGenProcess = ProcessBuilder(podGenProcessArgs).apply {
|
||||||
directory(podspecDir)
|
directory(syntheticDir)
|
||||||
}.start()
|
}.start()
|
||||||
val podGenRetCode = podGenProcess.waitFor()
|
val podGenRetCode = podGenProcess.waitFor()
|
||||||
val outputText = podGenProcess.inputStream.use { it.reader().readText() }
|
val outputText = podGenProcess.inputStream.use { it.reader().readText() }
|
||||||
|
|||||||
Reference in New Issue
Block a user