Skip to content

Commit f01a9b6

Browse files
authored
Use explicit NIO imports (#220)
- Use explicit NIO modules `NIOCore`, `NIOPosix` and `NIOEmbedded` introduced with SwiftNIO 2.32.0
1 parent 8525b63 commit f01a9b6

25 files changed

+39
-26
lines changed

Package.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ let package = Package(
2020
targets: [
2121
.target(name: "AWSLambdaRuntime", dependencies: [
2222
.byName(name: "AWSLambdaRuntimeCore"),
23-
.product(name: "NIO", package: "swift-nio"),
23+
.product(name: "NIOCore", package: "swift-nio"),
2424
.product(name: "NIOFoundationCompat", package: "swift-nio"),
2525
]),
2626
.target(name: "AWSLambdaRuntimeCore", dependencies: [
2727
.product(name: "Logging", package: "swift-log"),
2828
.product(name: "Backtrace", package: "swift-backtrace"),
2929
.product(name: "NIOHTTP1", package: "swift-nio"),
30-
.product(name: "NIO", package: "swift-nio"),
30+
.product(name: "NIOCore", package: "swift-nio"),
31+
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
32+
.product(name: "NIOPosix", package: "swift-nio"),
3133
.product(name: "_NIOConcurrency", package: "swift-nio"),
3234
]),
3335
.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,9 +12,10 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import NIO
1615
import NIOConcurrencyHelpers
16+
import NIOCore
1717
import NIOHTTP1
18+
import NIOPosix
1819

1920
/// A barebone HTTP client to interact with AWS Runtime Engine which is an HTTP server.
2021
/// Note that Lambda Runtime API dictate that only one requests runs at a time.

Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
#if DEBUG
1616
import Dispatch
1717
import Logging
18-
import NIO
1918
import NIOConcurrencyHelpers
19+
import NIOCore
2020
import NIOHTTP1
21+
import NIOPosix
2122

2223
// This functionality is designed for local testing hence beind a #if DEBUG flag.
2324
// For example:

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

+1-1
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

Sources/AWSLambdaRuntimeCore/LambdaLifecycle.swift

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

1515
import Logging
16-
import NIO
1716
import NIOConcurrencyHelpers
17+
import NIOCore
1818

1919
extension Lambda {
2020
/// `Lifecycle` manages the Lambda process lifecycle.

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-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Dispatch
16-
import NIO
16+
import NIOPosix
1717

1818
internal enum Consts {
1919
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,8 +13,9 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Foundation
16-
import NIO
16+
import NIOCore
1717
import NIOHTTP1
18+
import NIOPosix
1819

1920
internal struct MockServer {
2021
private let group: EventLoopGroup

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,8 +14,9 @@
1414

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

2122
class LambdaLifecycleTest: XCTestCase {

Tests/AWSLambdaRuntimeCoreTests/LambdaRuntimeClientTest.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
@testable import AWSLambdaRuntimeCore
1616
import Logging
17-
import NIO
17+
import NIOCore
1818
import NIOFoundationCompat
1919
import NIOHTTP1
20+
import NIOPosix
2021
import NIOTestUtils
2122
import XCTest
2223

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,8 +15,9 @@
1515
@testable import AWSLambdaRuntimeCore
1616
import Foundation // for JSON
1717
import Logging
18-
import NIO
18+
import NIOCore
1919
import NIOHTTP1
20+
import NIOPosix
2021

2122
internal final class MockLambdaServer {
2223
private let logger = Logger(label: "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,8 +15,9 @@
1515
@testable import AWSLambdaRuntime
1616
@testable import AWSLambdaRuntimeCore
1717
import Logging
18-
import NIO
18+
import NIOCore
1919
import NIOFoundationCompat
20+
import NIOPosix
2021
import XCTest
2122

2223
class CodableLambdaTest: XCTestCase {

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)