Skip to content

Commit

Permalink
Clean up imports and dependencies.
Browse files Browse the repository at this point in the history
Motivation:

With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.

Modifications:

- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded imports where necessary in tests.
- Note that the main package still _depends_ on NIO, which is necessary
  for backwards-compatibility reasons. This dependency is unused.

Result:

No need to use NIOPosix.
  • Loading branch information
Lukasa committed Sep 14, 2021
1 parent 9571a61 commit bba3c4e
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 53 deletions.
8 changes: 5 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ let package = Package(
name: "NIOTransportServices",
dependencies: [
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
.product(name: "NIOTLS", package: "swift-nio"),
Expand All @@ -36,21 +37,22 @@ let package = Package(
name: "NIOTSHTTPClient",
dependencies: [
"NIOTransportServices",
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.target(
name: "NIOTSHTTPServer",
dependencies: [
"NIOTransportServices",
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.testTarget(
name: "NIOTransportServicesTests",
dependencies: [
"NIOTransportServices",
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
]),
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTSHTTPClient/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

#if canImport(Network)
import NIO
import NIOCore
import NIOTransportServices
import NIOHTTP1
import Network
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTSHTTPServer/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

#if canImport(Network)
import NIO
import NIOCore
import NIOTransportServices
import NIOHTTP1
import Network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

import NIO
import NIOCore


/// A `ChannelHandler` that checks for outbound writes of zero length, which are then dropped. This is
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSBootstraps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

#if canImport(Network)
import NIO
import NIOCore

/// Shared functionality across NIOTS bootstraps.
internal enum NIOTSBootstraps {
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSChannelOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
#if canImport(Network)
import NIO
import NIOCore
import Network

/// Options that can be set explicitly and only on bootstraps provided by `NIOTransportServices`.
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSConnectionBootstrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

#if canImport(Network)
import NIO
import NIOCore
import Dispatch
import Network

Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSConnectionChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import Foundation
import NIO
import NIOCore
import NIOConcurrencyHelpers
import NIOFoundationCompat
import NIOTLS
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
#if canImport(Network)
import NIO
import NIOCore

/// A tag protocol that can be used to cover all errors thrown by `NIOTransportServices`.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSEventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -17,7 +17,7 @@ import Dispatch
import Foundation
import Network

import NIO
import NIOCore
import NIOConcurrencyHelpers

/// An `EventLoop` that interacts with `DispatchQoS` to help schedule upcoming work.
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSEventLoopGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import Foundation
import NIO
import NIOCore
import NIOConcurrencyHelpers
import Dispatch
import Network
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSListenerBootstrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

#if canImport(Network)
import NIO
import NIOCore
import Dispatch
import Network

Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSListenerChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import Foundation
import NIO
import NIOCore
import NIOFoundationCompat
import NIOConcurrencyHelpers
import Dispatch
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/NIOTSNetworkEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import Network
import NIO
import NIOCore

/// A tag protocol that can be used to cover all network events emitted by `NIOTS`.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/SocketAddress+NWEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -15,7 +15,7 @@
#if canImport(Network)
import Darwin
import Foundation
import NIO
import NIOCore
import Network

@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOTransportServices/StateManagedChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import Foundation
import NIO
import NIOCore
import NIOFoundationCompat
import NIOConcurrencyHelpers
import Dispatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import Foundation
import NIO
import NIOCore
import Network

@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,8 @@

#if canImport(Network)
import XCTest
import NIO
import NIOCore
import NIOEmbedded
import NIOTransportServices


Expand Down
5 changes: 3 additions & 2 deletions Tests/NIOTransportServicesTests/NIOTSBootstrapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -15,7 +15,8 @@
#if canImport(Network)
import XCTest
import Network
import NIO
import NIOCore
import NIOEmbedded
import NIOTransportServices
import NIOConcurrencyHelpers
import Foundation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -14,7 +14,7 @@

#if canImport(Network)
import XCTest
import NIO
import NIOCore
import NIOConcurrencyHelpers
import NIOTransportServices
import Network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
Expand All @@ -15,7 +15,7 @@
#if canImport(Network)
import XCTest
import Network
import NIO
import NIOCore
import NIOTransportServices
import Foundation

Expand Down
Loading

0 comments on commit bba3c4e

Please sign in to comment.