Skip to content

Commit 444d93d

Browse files
committed
Fix Linux build and address remaining warnings
1 parent 2e1b4ea commit 444d93d

File tree

6 files changed

+21
-4
lines changed

6 files changed

+21
-4
lines changed

Sources/StructuredAPIClient/Handlers/TokenAuthenticationHandler.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import Foundation
1515
#if canImport(FoundationNetworking)
16-
import FoundationNetworking
16+
@preconcurrency import FoundationNetworking
1717
#endif
1818
import Logging
1919

Sources/StructuredAPIClient/NetworkClient.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import Foundation
1515
#if canImport(FoundationNetworking)
16-
import FoundationNetworking
16+
@preconcurrency import FoundationNetworking
1717
#endif
1818
import Logging
1919

@@ -60,3 +60,13 @@ internal extension DispatchTime {
6060
Double(self.uptimeNanoseconds) / 1_000_000
6161
}
6262
}
63+
64+
#if !canImport(Darwin)
65+
extension NSLocking {
66+
package func withLock<R>(_ body: @Sendable () throws -> R) rethrows -> R {
67+
self.lock()
68+
defer { self.unlock() }
69+
return try body()
70+
}
71+
}
72+
#endif

Sources/StructuredAPIClient/Transport/TransportFailure.swift

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14+
#if !canImport(Darwin)
15+
@preconcurrency
16+
#endif
1417
import Foundation
1518
#if canImport(FoundationNetworking)
1619
import FoundationNetworking

Sources/StructuredAPIClient/Transport/URLSessionTransport+AsyncAwait.swift

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import Foundation
1616
import FoundationNetworking
1717
#endif
1818

19+
#if canImport(Darwin)
20+
1921
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
2022
extension URLSessionTransport {
2123

@@ -38,3 +40,5 @@ extension URLSessionTransport {
3840
}
3941
}
4042
}
43+
44+
#endif

Sources/StructuredAPIClient/Transport/URLSessionTransport.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import Foundation
1515
#if canImport(FoundationNetworking)
16-
import FoundationNetworking
16+
@preconcurrency import FoundationNetworking
1717
#endif
1818
import HTTPTypes
1919

Sources/StructuredAPIClientTestSupport/TestTransport.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import Foundation
1515
#if canImport(FoundationNetworking)
16-
import FoundationNetworking
16+
@preconcurrency import FoundationNetworking
1717
#endif
1818
import StructuredAPIClient
1919

0 commit comments

Comments
 (0)