Skip to content

Commit f101c60

Browse files
committed
use only FoundationEssentials
1 parent b687a09 commit f101c60

File tree

11 files changed

+48
-1
lines changed

11 files changed

+48
-1
lines changed

Examples/BackgroundTasks/Sources/main.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import AWSLambdaRuntime
16+
#if canImport(FoundationEssentials)
17+
import FoundationEssentials
18+
#else
1619
import Foundation
20+
#endif
1721

1822
struct BackgroundProcessingHandler: LambdaWithBackgroundProcessingHandler {
1923
struct Input: Decodable {

Sources/AWSLambdaRuntime/Vendored/ByteBuffer-foundation.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
//
2727
//===----------------------------------------------------------------------===//
2828

29+
#if canImport(FoundationEssentials)
30+
import FoundationEssentials
31+
#else
2932
import Foundation
33+
#endif
3034
import NIOCore
3135

3236
// This is NIO's `NIOFoundationCompat` module which at the moment only adds `ByteBuffer` utility methods

Sources/AWSLambdaRuntimeCore/LambdaRuntime.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import Logging
1721
import NIOConcurrencyHelpers
1822
import NIOCore

Sources/MockServer/main.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import NIOCore
1721
import NIOHTTP1
1822
import NIOPosix
23+
import Dispatch
1924

2025
struct MockServer {
2126
private let group: EventLoopGroup

Tests/AWSLambdaRuntimeCoreTests/InvocationTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import NIOHTTP1
1721
import Testing
1822

Tests/AWSLambdaRuntimeCoreTests/LambdaMockClient.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import AWSLambdaRuntimeCore
16+
#if canImport(FoundationEssentials)
17+
import FoundationEssentials
18+
#else
1619
import Foundation
20+
#endif
1721
import Logging
1822
import NIOCore
1923

Tests/AWSLambdaRuntimeCoreTests/LambdaRequestIDTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import NIOCore
1721
import Testing
1822

@@ -100,6 +104,7 @@ struct LambdaRequestIDTest {
100104
#expect(buffer.readableBytes == readableBeforeRead)
101105
}
102106

107+
#if os(macOS)
103108
@Test
104109
func testInitFromNSStringSuccess() {
105110
let nsString = NSMutableString(capacity: 16)
@@ -121,6 +126,7 @@ struct LambdaRequestIDTest {
121126
#expect(requestID?.uuidString == LambdaRequestID(uuidString: nsString as String)?.uuidString)
122127
#expect(requestID?.uppercased == nsString as String)
123128
}
129+
#endif
124130

125131
@Test
126132
func testUnparse() {

Tests/AWSLambdaRuntimeCoreTests/LambdaRunLoopTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import Logging
1721
import NIOCore
1822
import Testing

Tests/AWSLambdaRuntimeCoreTests/MockLambdaServer.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Foundation // for JSON
15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
18+
import Foundation
19+
#endif
1620
import Logging
1721
import NIOCore
1822
import NIOHTTP1

Tests/AWSLambdaRuntimeCoreTests/Utils.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620

1721
extension Date {
1822
var millisSinceEpoch: Int64 {

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ Background tasks allow code to execute asynchronously after the main response ha
253253
Here is an example of a minimal function that waits 10 seconds after it returned a response but before the handler returns.
254254
```swift
255255
import AWSLambdaRuntime
256+
#if canImport(FoundationEssentials)
257+
import FoundationEssentials
258+
#else
256259
import Foundation
260+
#endif
257261

258262
struct BackgroundProcessingHandler: LambdaWithBackgroundProcessingHandler {
259263
struct Input: Decodable {

0 commit comments

Comments
 (0)