@@ -195,12 +195,11 @@ public struct Destination: Encodable, Equatable {
195
195
var extraCCFlags : [ String ] = [ ]
196
196
var extraSwiftCFlags : [ String ] = [ ]
197
197
#if os(macOS)
198
- if let sdkPaths = try Destination . sdkPlatformFrameworkPaths ( environment: environment) {
199
- extraCCFlags += [ " -F " , sdkPaths. fwk. pathString]
200
- extraSwiftCFlags += [ " -F " , sdkPaths. fwk. pathString]
201
- extraSwiftCFlags += [ " -I " , sdkPaths. lib. pathString]
202
- extraSwiftCFlags += [ " -L " , sdkPaths. lib. pathString]
203
- }
198
+ let sdkPaths = try Destination . sdkPlatformFrameworkPaths ( environment: environment)
199
+ extraCCFlags += [ " -F " , sdkPaths. fwk. pathString]
200
+ extraSwiftCFlags += [ " -F " , sdkPaths. fwk. pathString]
201
+ extraSwiftCFlags += [ " -I " , sdkPaths. lib. pathString]
202
+ extraSwiftCFlags += [ " -L " , sdkPaths. lib. pathString]
204
203
#endif
205
204
206
205
#if !os(Windows)
@@ -217,26 +216,29 @@ public struct Destination: Encodable, Equatable {
217
216
/// Returns macosx sdk platform framework path.
218
217
public static func sdkPlatformFrameworkPaths(
219
218
environment: EnvironmentVariables = . process( )
220
- ) throws -> ( fwk: AbsolutePath , lib: AbsolutePath ) ? {
219
+ ) throws -> ( fwk: AbsolutePath , lib: AbsolutePath ) {
221
220
if let path = _sdkPlatformFrameworkPath {
222
221
return path
223
222
}
224
- let platformPath = try ? TSCBasic . Process. checkNonZeroExit (
223
+ let platformPath = try TSCBasic . Process. checkNonZeroExit (
225
224
arguments: [ " /usr/bin/xcrun " , " --sdk " , " macosx " , " --show-sdk-platform-path " ] ,
226
225
environment: environment) . spm_chomp ( )
227
226
228
- if let platformPath = platformPath, !platformPath. isEmpty {
229
- // For XCTest framework.
230
- let fwk = try AbsolutePath ( validating: platformPath) . appending (
231
- components: " Developer " , " Library " , " Frameworks " )
227
+ guard !platformPath. isEmpty else {
228
+ throw StringError ( " could not determine SDK platform path " )
229
+ }
230
+
231
+ // For XCTest framework.
232
+ let fwk = try AbsolutePath ( validating: platformPath) . appending (
233
+ components: " Developer " , " Library " , " Frameworks " )
232
234
233
- // For XCTest Swift library.
234
- let lib = try AbsolutePath ( validating: platformPath) . appending (
235
- components: " Developer " , " usr " , " lib " )
235
+ // For XCTest Swift library.
236
+ let lib = try AbsolutePath ( validating: platformPath) . appending (
237
+ components: " Developer " , " usr " , " lib " )
236
238
237
- _sdkPlatformFrameworkPath = ( fwk, lib)
238
- }
239
- return _sdkPlatformFrameworkPath
239
+ let sdkPlatformFrameworkPath = ( fwk, lib)
240
+ _sdkPlatformFrameworkPath = sdkPlatformFrameworkPath
241
+ return sdkPlatformFrameworkPath
240
242
}
241
243
242
244
/// Cache storage for sdk platform path.
0 commit comments