Skip to content

Commit f96740a

Browse files
committed
Use explicit NIO imports
1 parent 48dc507 commit f96740a

25 files changed

+41
-29
lines changed

Package.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@ let package = Package(
1515
.library(name: "AWSLambdaTesting", targets: ["AWSLambdaTesting"]),
1616
],
1717
dependencies: [
18-
.package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.30.0")),
18+
.package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.32.0")),
1919
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.4.2")),
2020
.package(url: "https://github.com/swift-server/swift-backtrace.git", .upToNextMajor(from: "1.2.3")),
2121
],
2222
targets: [
2323
.target(name: "AWSLambdaRuntime", dependencies: [
2424
.byName(name: "AWSLambdaRuntimeCore"),
25-
.product(name: "NIO", package: "swift-nio"),
25+
.product(name: "NIOCore", package: "swift-nio"),
2626
.product(name: "NIOFoundationCompat", package: "swift-nio"),
2727
]),
2828
.target(name: "AWSLambdaRuntimeCore", dependencies: [
2929
.product(name: "Logging", package: "swift-log"),
3030
.product(name: "Backtrace", package: "swift-backtrace"),
3131
.product(name: "NIOHTTP1", package: "swift-nio"),
32-
.product(name: "NIO", package: "swift-nio"),
32+
.product(name: "NIOCore", package: "swift-nio"),
33+
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
34+
.product(name: "NIOPosix", package: "swift-nio"),
3335
.product(name: "_NIOConcurrency", package: "swift-nio"),
3436
]),
3537
.testTarget(name: "AWSLambdaRuntimeCoreTests", dependencies: [

Sources/AWSLambdaRuntime/Lambda+Codable.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import struct Foundation.Data
1717
import class Foundation.JSONDecoder
1818
import class Foundation.JSONEncoder
19-
import NIO
19+
import NIOCore
2020
import NIOFoundationCompat
2121

2222
/// Extension to the `Lambda` companion to enable execution of Lambdas that take and return `Codable` events.

Sources/AWSLambdaRuntimeCore/HTTPClient.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import NIO
15+
import NIOCore
16+
import NIOPosix
1617
import NIOConcurrencyHelpers
1718
import NIOHTTP1
1819

Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#if DEBUG
1616
import Dispatch
1717
import Logging
18-
import NIO
18+
import NIOCore
19+
import NIOPosix
1920
import NIOConcurrencyHelpers
2021
import NIOHTTP1
2122

Sources/AWSLambdaRuntimeCore/Lambda+String.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14-
import NIO
14+
import NIOCore
1515

1616
/// Extension to the `Lambda` companion to enable execution of Lambdas that take and return `String` events.
1717
extension Lambda {

Sources/AWSLambdaRuntimeCore/Lambda.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import Darwin.C
2121
import _NIOConcurrency
2222
import Backtrace
2323
import Logging
24-
import NIO
24+
import NIOCore
25+
import NIOPosix
2526

2627
public enum Lambda {
2728
public typealias Handler = ByteBufferLambdaHandler

Sources/AWSLambdaRuntimeCore/LambdaConfiguration.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Dispatch
1616
import Logging
17-
import NIO
17+
import NIOCore
1818

1919
extension Lambda {
2020
internal struct Configuration: CustomStringConvertible {

Sources/AWSLambdaRuntimeCore/LambdaContext.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Dispatch
1616
import Logging
17-
import NIO
17+
import NIOCore
1818

1919
// MARK: - InitializationContext
2020

Sources/AWSLambdaRuntimeCore/LambdaHandler.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import _NIOConcurrency
1616
import Dispatch
17-
import NIO
17+
import NIOCore
1818

1919
// MARK: - LambdaHandler
2020

@@ -115,7 +115,7 @@ public protocol AsyncLambdaHandler: EventLoopLambdaHandler {
115115
extension AsyncLambdaHandler {
116116
public func handle(context: Lambda.Context, event: In) -> EventLoopFuture<Out> {
117117
let promise = context.eventLoop.makePromise(of: Out.self)
118-
promise.completeWithAsync {
118+
promise.completeWithTask {
119119
try await self.handle(event: event, context: context)
120120
}
121121
return promise.futureResult
@@ -127,7 +127,7 @@ extension AsyncLambdaHandler {
127127
public static func main() {
128128
Lambda.run { context -> EventLoopFuture<ByteBufferLambdaHandler> in
129129
let promise = context.eventLoop.makePromise(of: ByteBufferLambdaHandler.self)
130-
promise.completeWithAsync {
130+
promise.completeWithTask {
131131
try await Self(context: context)
132132
}
133133
return promise.futureResult

Sources/AWSLambdaRuntimeCore/LambdaLifecycle.swift

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

1515
import Logging
16-
import NIO
16+
import NIOCore
1717
import NIOConcurrencyHelpers
1818

1919
extension Lambda {

Sources/AWSLambdaRuntimeCore/LambdaRunner.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Dispatch
1616
import Logging
17-
import NIO
17+
import NIOCore
1818

1919
extension Lambda {
2020
/// LambdaRunner manages the Lambda runtime workflow, or business logic.

Sources/AWSLambdaRuntimeCore/LambdaRuntimeClient.swift

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

1515
import Logging
16-
import NIO
16+
import NIOCore
1717
import NIOHTTP1
1818

1919
/// An HTTP based client for AWS Runtime Engine. This encapsulates the RESTful methods exposed by the Runtime Engine:

Sources/AWSLambdaRuntimeCore/Utils.swift

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Dispatch
16-
import NIO
1716

1817
internal enum Consts {
1918
static let apiPrefix = "/2018-06-01"

Sources/AWSLambdaTesting/Lambda+Testing.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
@testable import AWSLambdaRuntimeCore
3939
import Dispatch
4040
import Logging
41-
import NIO
41+
import NIOCore
42+
import NIOPosix
4243

4344
extension Lambda {
4445
public struct TestConfig {

Sources/CodableSample/main.swift

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

1515
import AWSLambdaRuntime
16-
import NIO
16+
import NIOCore
1717

1818
struct Request: Codable {
1919
let body: String

Sources/MockServer/main.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Foundation
16-
import NIO
16+
import NIOCore
17+
import NIOPosix
1718
import NIOHTTP1
1819

1920
internal struct MockServer {

Sources/StringSample/main.swift

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

1515
import AWSLambdaRuntimeCore
16-
import NIO
16+
import NIOCore
1717

1818
// in this example we are receiving and responding with strings
1919
struct Handler: EventLoopLambdaHandler {

Tests/AWSLambdaRuntimeCoreTests/LambdaHandlerTest.swift

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

1515
@testable import AWSLambdaRuntimeCore
16-
import NIO
16+
import NIOCore
1717
import XCTest
1818

1919
class LambdaHandlerTest: XCTestCase {

Tests/AWSLambdaRuntimeCoreTests/LambdaLifecycleTest.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
@testable import AWSLambdaRuntimeCore
1616
import Logging
17-
import NIO
17+
import NIOCore
18+
import NIOPosix
1819
import NIOHTTP1
1920
import XCTest
2021

Tests/AWSLambdaRuntimeCoreTests/LambdaRuntimeClientTest.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
@testable import AWSLambdaRuntimeCore
1616
import Logging
17-
import NIO
17+
import NIOCore
18+
import NIOPosix
1819
import NIOFoundationCompat
1920
import NIOHTTP1
2021
import NIOTestUtils

Tests/AWSLambdaRuntimeCoreTests/LambdaTest.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
@testable import AWSLambdaRuntimeCore
1616
import Logging
17-
import NIO
17+
import NIOCore
18+
import NIOPosix
1819
import XCTest
1920

2021
class LambdaTest: XCTestCase {

Tests/AWSLambdaRuntimeCoreTests/MockLambdaServer.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
@testable import AWSLambdaRuntimeCore
1616
import Foundation // for JSON
1717
import Logging
18-
import NIO
18+
import NIOCore
19+
import NIOPosix
1920
import NIOHTTP1
2021

2122
internal final class MockLambdaServer {

Tests/AWSLambdaRuntimeCoreTests/Utils.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
@testable import AWSLambdaRuntimeCore
1616
import Logging
17-
import NIO
17+
import NIOCore
18+
import NIOPosix
1819
import XCTest
1920

2021
func runLambda(behavior: LambdaServerBehavior, handler: Lambda.Handler) throws {

Tests/AWSLambdaRuntimeTests/Lambda+CodeableTest.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
@testable import AWSLambdaRuntime
1616
@testable import AWSLambdaRuntimeCore
1717
import Logging
18-
import NIO
18+
import NIOCore
19+
import NIOPosix
1920
import NIOFoundationCompat
2021
import XCTest
2122

Tests/AWSLambdaTestingTests/Tests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import AWSLambdaRuntime
1616
import AWSLambdaTesting
17-
import NIO
17+
import NIOCore
1818
import XCTest
1919

2020
class LambdaTestingTests: XCTestCase {

0 commit comments

Comments
 (0)