From 0793353e3603a19bc9ab2ef9d87d54dc7557efe5 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Mon, 1 Jul 2024 09:54:35 +0200 Subject: [PATCH] [Oztechan/CCC#3647] Fix agvtool output error (#3648) * [Oztechan/CCC#3647] Fix agvtool output error * [Oztechan/CCC#3647] Fix agvtool output error * [Oztechan/CCC#3647] Fix agvtool output error * [Oztechan/CCC#3647] Fix agvtool output error * [Oztechan/CCC#3647] Fix agvtool output error * [Oztechan/CCC#3647] Fix agvtool output error --- buildSrc/src/main/kotlin/ProjectSettings.kt | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/buildSrc/src/main/kotlin/ProjectSettings.kt b/buildSrc/src/main/kotlin/ProjectSettings.kt index e6a7c2596b..d22fb2d6f7 100644 --- a/buildSrc/src/main/kotlin/ProjectSettings.kt +++ b/buildSrc/src/main/kotlin/ProjectSettings.kt @@ -60,17 +60,24 @@ object ProjectSettings { private fun isCI() = System.getenv("CI") == "true" @Suppress("TooGenericExceptionCaught", "UnstableApiUsage") - private fun Project.setIOSVersion(versionName: String) = try { - providers.exec { - workingDir = File("${rootDir}/ios") - commandLine("agvtool new-version -all ${getVersionCode(this@setIOSVersion)}".split(" ")) - }.standardOutput.asText.get() // needed for completing the execution - providers.exec { - workingDir = File("${rootDir}/ios") - commandLine("agvtool new-marketing-version $versionName".split(" ")) - }.standardOutput.asText.get() // needed for completing the execution - } catch (e: Exception) { - println("agvtool exist only mac environment") - println(e.localizedMessage) + private fun Project.setIOSVersion(versionName: String) { + if (System.getProperty("os.name").contains("Mac")) { + providers.exec { + workingDir = File("$rootDir/ios") + commandLine("agvtool new-version -all ${getVersionCode(this@setIOSVersion)}".split(" ")) + }.also { + // needed for completing the execution + println("agvtool new-version -all ${it.standardOutput.asText.get()}") + } + providers.exec { + workingDir = File("$rootDir/ios") + commandLine("agvtool new-marketing-version $versionName".split(" ")) + }.also { + // needed for completing the execution + println("agvtool new-marketing-version ${it.standardOutput.asText.get()}") + } + } else { + println("agvtool exist only mac environment") + } } }