Skip to content

Use explicit NIO imports #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ let package = Package(
targets: [
.target(name: "AWSLambdaRuntime", dependencies: [
.byName(name: "AWSLambdaRuntimeCore"),
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
]),
.target(name: "AWSLambdaRuntimeCore", dependencies: [
.product(name: "Logging", package: "swift-log"),
.product(name: "Backtrace", package: "swift-backtrace"),
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "_NIOConcurrency", package: "swift-nio"),
]),
.testTarget(name: "AWSLambdaRuntimeCoreTests", dependencies: [
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntime/Lambda+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import struct Foundation.Data
import class Foundation.JSONDecoder
import class Foundation.JSONEncoder
import NIO
import NIOCore
import NIOFoundationCompat

/// Extension to the `Lambda` companion to enable execution of Lambdas that take and return `Codable` events.
Expand Down
3 changes: 2 additions & 1 deletion Sources/AWSLambdaRuntimeCore/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
//
//===----------------------------------------------------------------------===//

import NIO
import NIOConcurrencyHelpers
import NIOCore
import NIOHTTP1
import NIOPosix

/// A barebone HTTP client to interact with AWS Runtime Engine which is an HTTP server.
/// Note that Lambda Runtime API dictate that only one requests runs at a time.
Expand Down
3 changes: 2 additions & 1 deletion Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
#if DEBUG
import Dispatch
import Logging
import NIO
import NIOConcurrencyHelpers
import NIOCore
import NIOHTTP1
import NIOPosix

// This functionality is designed for local testing hence beind a #if DEBUG flag.
// For example:
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/Lambda+String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOCore

/// Extension to the `Lambda` companion to enable execution of Lambdas that take and return `String` events.
extension Lambda {
Expand Down
3 changes: 2 additions & 1 deletion Sources/AWSLambdaRuntimeCore/Lambda.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import Darwin.C
import _NIOConcurrency
import Backtrace
import Logging
import NIO
import NIOCore
import NIOPosix

public enum Lambda {
public typealias Handler = ByteBufferLambdaHandler
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/LambdaConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Dispatch
import Logging
import NIO
import NIOCore

extension Lambda {
internal struct Configuration: CustomStringConvertible {
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/LambdaContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Dispatch
import Logging
import NIO
import NIOCore

// MARK: - InitializationContext

Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/LambdaHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import _NIOConcurrency
import Dispatch
import NIO
import NIOCore

// MARK: - LambdaHandler

Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/LambdaLifecycle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
//===----------------------------------------------------------------------===//

import Logging
import NIO
import NIOConcurrencyHelpers
import NIOCore

extension Lambda {
/// `Lifecycle` manages the Lambda process lifecycle.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/LambdaRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Dispatch
import Logging
import NIO
import NIOCore

extension Lambda {
/// LambdaRunner manages the Lambda runtime workflow, or business logic.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/LambdaRuntimeClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

import Logging
import NIO
import NIOCore
import NIOHTTP1

/// An HTTP based client for AWS Runtime Engine. This encapsulates the RESTful methods exposed by the Runtime Engine:
Expand Down
2 changes: 1 addition & 1 deletion Sources/AWSLambdaRuntimeCore/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

import Dispatch
import NIO
import NIOPosix

internal enum Consts {
static let apiPrefix = "/2018-06-01"
Expand Down
3 changes: 2 additions & 1 deletion Sources/AWSLambdaTesting/Lambda+Testing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
@testable import AWSLambdaRuntimeCore
import Dispatch
import Logging
import NIO
import NIOCore
import NIOPosix

extension Lambda {
public struct TestConfig {
Expand Down
2 changes: 1 addition & 1 deletion Sources/CodableSample/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

import AWSLambdaRuntime
import NIO
import NIOCore

struct Request: Codable {
let body: String
Expand Down
3 changes: 2 additions & 1 deletion Sources/MockServer/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
//===----------------------------------------------------------------------===//

import Foundation
import NIO
import NIOCore
import NIOHTTP1
import NIOPosix

internal struct MockServer {
private let group: EventLoopGroup
Expand Down
2 changes: 1 addition & 1 deletion Sources/StringSample/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

import AWSLambdaRuntimeCore
import NIO
import NIOCore

// in this example we are receiving and responding with strings
struct Handler: EventLoopLambdaHandler {
Expand Down
2 changes: 1 addition & 1 deletion Tests/AWSLambdaRuntimeCoreTests/LambdaHandlerTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

@testable import AWSLambdaRuntimeCore
import NIO
import NIOCore
import XCTest

class LambdaHandlerTest: XCTestCase {
Expand Down
3 changes: 2 additions & 1 deletion Tests/AWSLambdaRuntimeCoreTests/LambdaLifecycleTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

@testable import AWSLambdaRuntimeCore
import Logging
import NIO
import NIOCore
import NIOHTTP1
import NIOPosix
import XCTest

class LambdaLifecycleTest: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

@testable import AWSLambdaRuntimeCore
import Logging
import NIO
import NIOCore
import NIOFoundationCompat
import NIOHTTP1
import NIOPosix
import NIOTestUtils
import XCTest

Expand Down
3 changes: 2 additions & 1 deletion Tests/AWSLambdaRuntimeCoreTests/LambdaTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

@testable import AWSLambdaRuntimeCore
import Logging
import NIO
import NIOCore
import NIOPosix
import XCTest

class LambdaTest: XCTestCase {
Expand Down
3 changes: 2 additions & 1 deletion Tests/AWSLambdaRuntimeCoreTests/MockLambdaServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
@testable import AWSLambdaRuntimeCore
import Foundation // for JSON
import Logging
import NIO
import NIOCore
import NIOHTTP1
import NIOPosix

internal final class MockLambdaServer {
private let logger = Logger(label: "MockLambdaServer")
Expand Down
3 changes: 2 additions & 1 deletion Tests/AWSLambdaRuntimeCoreTests/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

@testable import AWSLambdaRuntimeCore
import Logging
import NIO
import NIOCore
import NIOPosix
import XCTest

func runLambda(behavior: LambdaServerBehavior, handler: Lambda.Handler) throws {
Expand Down
3 changes: 2 additions & 1 deletion Tests/AWSLambdaRuntimeTests/Lambda+CodeableTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
@testable import AWSLambdaRuntime
@testable import AWSLambdaRuntimeCore
import Logging
import NIO
import NIOCore
import NIOFoundationCompat
import NIOPosix
import XCTest

class CodableLambdaTest: XCTestCase {
Expand Down
2 changes: 1 addition & 1 deletion Tests/AWSLambdaTestingTests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import AWSLambdaRuntime
import AWSLambdaTesting
import NIO
import NIOCore
import XCTest

class LambdaTestingTests: XCTestCase {
Expand Down