File tree Expand file tree Collapse file tree 11 files changed +48
-1
lines changed
Examples/BackgroundTasks/Sources
AWSLambdaRuntime/Vendored
Tests/AWSLambdaRuntimeCoreTests Expand file tree Collapse file tree 11 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 13
13
//===----------------------------------------------------------------------===//
14
14
15
15
import AWSLambdaRuntime
16
+ #if canImport(FoundationEssentials)
17
+ import FoundationEssentials
18
+ #else
16
19
import Foundation
20
+ #endif
17
21
18
22
struct BackgroundProcessingHandler : LambdaWithBackgroundProcessingHandler {
19
23
struct Input : Decodable {
Original file line number Diff line number Diff line change 26
26
//
27
27
//===----------------------------------------------------------------------===//
28
28
29
+ #if canImport(FoundationEssentials)
30
+ import FoundationEssentials
31
+ #else
29
32
import Foundation
33
+ #endif
30
34
import NIOCore
31
35
32
36
// This is NIO's `NIOFoundationCompat` module which at the moment only adds `ByteBuffer` utility methods
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
15
18
import Foundation
19
+ #endif
16
20
import Logging
17
21
import NIOConcurrencyHelpers
18
22
import NIOCore
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
15
18
import Foundation
19
+ #endif
16
20
import NIOCore
17
21
import NIOHTTP1
18
22
import NIOPosix
23
+ import Dispatch
19
24
20
25
struct MockServer {
21
26
private let group : EventLoopGroup
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
15
18
import Foundation
19
+ #endif
16
20
import NIOHTTP1
17
21
import Testing
18
22
Original file line number Diff line number Diff line change 13
13
//===----------------------------------------------------------------------===//
14
14
15
15
import AWSLambdaRuntimeCore
16
+ #if canImport(FoundationEssentials)
17
+ import FoundationEssentials
18
+ #else
16
19
import Foundation
20
+ #endif
17
21
import Logging
18
22
import NIOCore
19
23
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
15
18
import Foundation
19
+ #endif
16
20
import NIOCore
17
21
import Testing
18
22
@@ -100,6 +104,7 @@ struct LambdaRequestIDTest {
100
104
#expect( buffer. readableBytes == readableBeforeRead)
101
105
}
102
106
107
+ #if os(macOS)
103
108
@Test
104
109
func testInitFromNSStringSuccess( ) {
105
110
let nsString = NSMutableString ( capacity: 16 )
@@ -121,6 +126,7 @@ struct LambdaRequestIDTest {
121
126
#expect( requestID? . uuidString == LambdaRequestID ( uuidString: nsString as String ) ? . uuidString)
122
127
#expect( requestID? . uppercased == nsString as String )
123
128
}
129
+ #endif
124
130
125
131
@Test
126
132
func testUnparse( ) {
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
15
18
import Foundation
19
+ #endif
16
20
import Logging
17
21
import NIOCore
18
22
import Testing
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- import Foundation // for JSON
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
18
+ import Foundation
19
+ #endif
16
20
import Logging
17
21
import NIOCore
18
22
import NIOHTTP1
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ #if canImport(FoundationEssentials)
16
+ import FoundationEssentials
17
+ #else
15
18
import Foundation
19
+ #endif
16
20
17
21
extension Date {
18
22
var millisSinceEpoch : Int64 {
Original file line number Diff line number Diff line change @@ -253,7 +253,11 @@ Background tasks allow code to execute asynchronously after the main response ha
253
253
Here is an example of a minimal function that waits 10 seconds after it returned a response but before the handler returns.
254
254
``` swift
255
255
import AWSLambdaRuntime
256
+ #if canImport (FoundationEssentials )
257
+ import FoundationEssentials
258
+ #else
256
259
import Foundation
260
+ #endif
257
261
258
262
struct BackgroundProcessingHandler : LambdaWithBackgroundProcessingHandler {
259
263
struct Input : Decodable {
You can’t perform that action at this time.
0 commit comments