Skip to content

Commit 86d627b

Browse files
committed
Adjust non-darwin default toolchain lookupwq
1 parent 4badd65 commit 86d627b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Sources/SWBCore/ToolchainRegistry.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,15 +508,19 @@ public final class ToolchainRegistry: @unchecked Sendable {
508508
/// Look up the toolchain with the given identifier.
509509
public func lookup(_ identifier: String) -> Toolchain? {
510510
let lowercasedIdentifier = identifier.lowercased()
511-
if ["default", "xcode"].contains(lowercasedIdentifier) {
512-
if hostOperatingSystem == .macOS {
511+
if hostOperatingSystem == .macOS {
512+
if ["default", "xcode"].contains(lowercasedIdentifier) {
513513
return toolchainsByIdentifier[ToolchainRegistry.defaultToolchainIdentifier] ?? toolchainsByAlias[lowercasedIdentifier]
514514
} else {
515-
// On non-Darwin, assume if there is only one registered toolchain, it is the default.
516-
return toolchainsByIdentifier[ToolchainRegistry.defaultToolchainIdentifier] ?? toolchainsByAlias[lowercasedIdentifier] ?? toolchainsByIdentifier.values.only
515+
return toolchainsByIdentifier[identifier] ?? toolchainsByAlias[lowercasedIdentifier]
517516
}
518517
} else {
519-
return toolchainsByIdentifier[identifier] ?? toolchainsByAlias[lowercasedIdentifier]
518+
// On non-Darwin, assume if there is only one registered toolchain, it is the default.
519+
if ["default", "xcode"].contains(lowercasedIdentifier) || identifier == ToolchainRegistry.defaultToolchainIdentifier {
520+
return toolchainsByIdentifier[ToolchainRegistry.defaultToolchainIdentifier] ?? toolchainsByAlias[lowercasedIdentifier] ?? toolchainsByIdentifier.values.only
521+
} else {
522+
return toolchainsByIdentifier[identifier] ?? toolchainsByAlias[lowercasedIdentifier]
523+
}
520524
}
521525
}
522526

0 commit comments

Comments
 (0)