From a62f65940d3f227200fe5922e959874eaf251872 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 15 Jul 2020 18:53:55 +0700 Subject: [PATCH] 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. --- .../gradle/targets/native/tasks/AdvancedCocoapodsTasks.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/AdvancedCocoapodsTasks.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/AdvancedCocoapodsTasks.kt index de7c394d0f2..5fa4427e6b5 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/AdvancedCocoapodsTasks.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/AdvancedCocoapodsTasks.kt @@ -124,19 +124,19 @@ open class PodGenTask : CocoapodsWithSyntheticTask() { @TaskAction 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 podGenProcessArgs = listOfNotNull( "pod", "gen", "--platforms=${kotlinNativeTarget.platformLiteral}", - "--gen-directory=${project.cocoapodsBuildDirs.synthetic(kotlinNativeTarget).absolutePath}", + "--gen-directory=${syntheticDir.absolutePath}", localPodspecPaths.takeIf { it.isNotEmpty() }?.joinToString(separator = ",")?.let { "--local-sources=$it" }, - podspecProvider.get().name + podspecProvider.get().absolutePath ) val podGenProcess = ProcessBuilder(podGenProcessArgs).apply { - directory(podspecDir) + directory(syntheticDir) }.start() val podGenRetCode = podGenProcess.waitFor() val outputText = podGenProcess.inputStream.use { it.reader().readText() }