Skip to content

Commit 86b78fb

Browse files
authored
Fix crash for Xcode 15.3
1 parent 8720965 commit 86b78fb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/macosMain/kotlin/co/touchlab/xcode/cli/PluginManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ object PluginManager {
7373

7474
Console.echo("Synchronizing plugin compatibility list.")
7575
val additionalPluginCompatibilityIds =
76-
xcodeInstallations.map { PropertyList.Object.String(it.pluginCompatabilityId) }
76+
xcodeInstallations.mapNotNull { it.pluginCompatabilityId?.let { PropertyList.Object.String(it) } }
7777
logger.v { "Xcode installation IDs to include: ${additionalPluginCompatibilityIds.joinToString { it.value }}" }
7878
val infoPlist = PropertyList.create(pluginTargetInfoFile)
7979
val rootDictionary = infoPlist.root.dictionary

src/macosMain/kotlin/co/touchlab/xcode/cli/XcodeHelper.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import co.touchlab.xcode.cli.XcodeHelper.Defaults.nonApplePlugins
55
import co.touchlab.xcode.cli.util.BackupHelper
66
import co.touchlab.xcode.cli.util.Console
77
import co.touchlab.xcode.cli.util.File
8+
import co.touchlab.xcode.cli.util.fromString
89
import co.touchlab.xcode.cli.util.Path
910
import co.touchlab.xcode.cli.util.PropertyList
1011
import co.touchlab.xcode.cli.util.Shell
12+
import co.touchlab.xcode.cli.util.Version
1113
import kotlinx.serialization.SerialName
1214
import kotlinx.serialization.Serializable
1315
import kotlinx.serialization.json.Json
@@ -83,6 +85,14 @@ object XcodeHelper {
8385
checkNotNull(versionPlist.build?.trim()) { "Couldn't get build number of Xcode at $path." }
8486
}
8587

88+
if (Version.fromString(version) >= Version.fromString("15.3")) {
89+
return XcodeInstallation(
90+
version = version,
91+
build = build,
92+
path = path
93+
)
94+
}
95+
8696
val xcodeInfoPath = path / "Contents" / "Info"
8797
val pluginCompatabilityIdResult = Shell.exec("/usr/bin/defaults", "read", xcodeInfoPath.value, "DVTPlugInCompatibilityUUID")
8898
.checkSuccessful {
@@ -154,7 +164,7 @@ object XcodeHelper {
154164
val version: String,
155165
val build: String,
156166
val path: Path,
157-
val pluginCompatabilityId: String,
167+
val pluginCompatabilityId: String? = null,
158168
) {
159169
val name: String = "Xcode $version ($build)"
160170
}

0 commit comments

Comments
 (0)