Skip to content

Commit e1e59db

Browse files
committed
Update to only get the computed property once
Previously was getting the computed property multiple times which would reparse files in the filesystem takeing time. Get the propertry once.
1 parent 97a028f commit e1e59db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Sources/SWBGenericUnixPlatform/Plugin.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,14 @@ struct GenericUnixSDKRegistryExtension: SDKRegistryExtension {
130130
switch operatingSystem {
131131
case .freebsd:
132132
return true // FreeBSD is always LLVM-based.
133-
case .linux where operatingSystem.distribution?.kind == .amazon && operatingSystem.distribution?.version == "2":
134-
return true // Amazon Linux 2 has a gold linker bug see: https://sourceware.org/bugzilla/show_bug.cgi?id=23016.
133+
case .linux:
134+
// Amazon Linux 2 has a gold linker bug see: https://sourceware.org/bugzilla/show_bug.cgi?id=23016.
135+
guard let distribution = operatingSystem.distribution else {
136+
return false
137+
}
138+
return distribution.kind == .amazon && distribution.version == "2"
135139
default:
136-
return operatingSystem != context.hostOperatingSystem // Cross-compiling
140+
return operatingSystem != context.hostOperatingSystem // Cross-compiling.
137141
}
138142
}()
139143

0 commit comments

Comments
 (0)