From 4abca13b7374cec9c0185c673305e65f385dcfa1 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 19 Jan 2018 14:06:00 +0300 Subject: [PATCH] Fix .dSYM bundle location for produced frameworks --- .../kotlin/backend/konan/LinkStage.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt index 7a3b4138f66..c932059b8a0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt @@ -129,10 +129,11 @@ internal open class MacOSBasedPlatform(distribution: Distribution) } } - fun dsymUtilCommand(executable: ExecutableFile) = object : Command(dsymutilCommand(executable)) { - override fun runProcess(): Int = - executeCommandWithFilter(command) - } + fun dsymUtilCommand(executable: ExecutableFile, outputDsymBundle: String) = + object : Command(dsymutilCommand(executable, outputDsymBundle)) { + override fun runProcess(): Int = + executeCommandWithFilter(command) + } // TODO: consider introducing a better filtering directly in Command. private fun executeCommandWithFilter(command: List): Int { @@ -165,7 +166,8 @@ internal open class MacOSBasedPlatform(distribution: Distribution) return exitCode } - open fun dsymutilCommand(executable: ExecutableFile): List = listOf(dsymutil, executable) + open fun dsymutilCommand(executable: ExecutableFile, outputDsymBundle: String): List = + listOf(dsymutil, executable, "-o", outputDsymBundle) open fun dsymutilDryRunVerboseCommand(executable: ExecutableFile): List = listOf(dsymutil, "-dump-debug-map" ,executable) @@ -450,9 +452,11 @@ internal class LinkStage(val context: Context) { }.execute() if (debug && platform is MacOSBasedPlatform) { - platform.dsymUtilCommand(executable) - .logWith(context::log) - .execute() + val outputDsymBundle = context.config.outputFile + ".dSYM" // `outputFile` is either binary or bundle. + + platform.dsymUtilCommand(executable, outputDsymBundle) + .logWith(context::log) + .execute() } } catch (e: KonanExternalToolFailure) { context.reportCompilationError("${e.toolName} invocation reported errors")