Skip to content

Commit 64285cb

Browse files
Lukasaglbrntt
andauthored
Clean up dependencies and imports. (#1935)
Motivation: As we've largely completed our move to split out our core abstractions, we now have an opportunity to clean up our dependencies and imports. We should arrange for everything to only import NIO if it actually needs it, and to correctly express dependencies on NIOCore and NIOEmbedded where they exist. We aren't yet splitting out tests that only test functionality in NIOCore, that will follow in a separate patch. Modifications: - Fixed up imports - Made sure our protocols only require NIOCore. Result: Better expression of dependencies. Co-authored-by: George Barnett <[email protected]>
1 parent f2ab9ab commit 64285cb

File tree

81 files changed

+199
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+199
-188
lines changed

Package.swift

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ var targets: [PackageDescription.Target] = [
2929
"_NIODataStructures",
3030
"NIOEmbedded"]),
3131
.target(name: "_NIOConcurrency",
32-
dependencies: ["NIO"]),
33-
.target(name: "NIOFoundationCompat", dependencies: ["NIO"]),
32+
dependencies: ["NIOCore"]),
33+
.target(name: "NIOFoundationCompat", dependencies: ["NIOCore"]),
3434
.target(name: "CNIOAtomics", dependencies: []),
3535
.target(name: "CNIOSHA1", dependencies: []),
3636
.target(name: "CNIOLinux", dependencies: []),
@@ -39,59 +39,59 @@ var targets: [PackageDescription.Target] = [
3939
.target(name: "NIOConcurrencyHelpers",
4040
dependencies: ["CNIOAtomics"]),
4141
.target(name: "NIOHTTP1",
42-
dependencies: ["NIO", "NIOConcurrencyHelpers", "CNIOHTTPParser"]),
42+
dependencies: ["NIOCore", "NIOConcurrencyHelpers", "CNIOHTTPParser"]),
4343
.target(name: "NIOEchoServer",
44-
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
44+
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
4545
.target(name: "NIOEchoClient",
46-
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
46+
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
4747
.target(name: "NIOHTTP1Server",
48-
dependencies: ["NIO", "NIOHTTP1", "NIOConcurrencyHelpers"]),
48+
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOConcurrencyHelpers"]),
4949
.target(name: "NIOHTTP1Client",
50-
dependencies: ["NIO", "NIOHTTP1", "NIOConcurrencyHelpers"]),
50+
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOConcurrencyHelpers"]),
5151
.target(name: "CNIOHTTPParser"),
52-
.target(name: "NIOTLS", dependencies: ["NIO"]),
52+
.target(name: "NIOTLS", dependencies: ["NIOCore"]),
5353
.target(name: "NIOChatServer",
54-
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
54+
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
5555
.target(name: "NIOChatClient",
56-
dependencies: ["NIO", "NIOConcurrencyHelpers"]),
56+
dependencies: ["NIO", "NIOCore", "NIOConcurrencyHelpers"]),
5757
.target(name: "NIOWebSocket",
58-
dependencies: ["NIO", "NIOHTTP1", "CNIOSHA1"]),
58+
dependencies: ["NIOCore", "NIOHTTP1", "CNIOSHA1"]),
5959
.target(name: "NIOWebSocketServer",
60-
dependencies: ["NIO", "NIOHTTP1", "NIOWebSocket"]),
60+
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOWebSocket"]),
6161
.target(name: "NIOWebSocketClient",
62-
dependencies: ["NIO", "NIOHTTP1", "NIOWebSocket"]),
62+
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "NIOWebSocket"]),
6363
.target(name: "NIOPerformanceTester",
64-
dependencies: ["NIO", "NIOHTTP1", "NIOFoundationCompat", "NIOWebSocket"]),
64+
dependencies: ["NIO", "NIOCore", "NIOEmbedded", "NIOHTTP1", "NIOFoundationCompat", "NIOWebSocket"]),
6565
.target(name: "NIOMulticastChat",
66-
dependencies: ["NIO"]),
66+
dependencies: ["NIO", "NIOCore"]),
6767
.target(name: "NIOUDPEchoServer",
68-
dependencies: ["NIO"]),
68+
dependencies: ["NIO", "NIOCore"]),
6969
.target(name: "NIOUDPEchoClient",
70-
dependencies: ["NIO"]),
70+
dependencies: ["NIO", "NIOCore"]),
7171
.target(name: "NIOTestUtils",
72-
dependencies: ["NIO", "NIOHTTP1"]),
72+
dependencies: ["NIO", "NIOCore", "NIOEmbedded", "NIOHTTP1"]),
7373
.target(name: "NIOCrashTester",
74-
dependencies: ["NIO", "NIOHTTP1", "NIOWebSocket", "NIOFoundationCompat"]),
74+
dependencies: ["NIO", "NIOCore", "NIOEmbedded", "NIOHTTP1", "NIOWebSocket", "NIOFoundationCompat"]),
7575
.target(name: "NIOAsyncAwaitDemo",
76-
dependencies: ["NIO", "NIOHTTP1", "_NIOConcurrency"]),
76+
dependencies: ["NIO", "NIOCore", "NIOHTTP1", "_NIOConcurrency"]),
7777
.testTarget(name: "NIOEmbeddedTests",
7878
dependencies: ["NIOConcurrencyHelpers", "NIOCore", "NIOEmbedded"]),
7979
.testTarget(name: "NIOTests",
80-
dependencies: ["NIO", "NIOFoundationCompat", "NIOTestUtils", "NIOConcurrencyHelpers", "NIOEmbedded"]),
80+
dependencies: ["NIO", "NIOCore", "NIOFoundationCompat", "NIOTestUtils", "NIOConcurrencyHelpers", "NIOEmbedded"]),
8181
.testTarget(name: "NIOConcurrencyHelpersTests",
82-
dependencies: ["NIOConcurrencyHelpers", "NIO"]),
82+
dependencies: ["NIOConcurrencyHelpers", "NIOCore"]),
8383
.testTarget(name: "NIODataStructuresTests",
8484
dependencies: ["_NIODataStructures"]),
8585
.testTarget(name: "NIOHTTP1Tests",
86-
dependencies: ["NIOHTTP1", "NIOFoundationCompat", "NIOTestUtils"]),
86+
dependencies: ["NIOCore", "NIOEmbedded", "NIO", "NIOHTTP1", "NIOFoundationCompat", "NIOTestUtils"]),
8787
.testTarget(name: "NIOTLSTests",
88-
dependencies: ["NIO", "NIOTLS", "NIOFoundationCompat"]),
88+
dependencies: ["NIOCore", "NIOEmbedded", "NIOTLS", "NIOFoundationCompat"]),
8989
.testTarget(name: "NIOWebSocketTests",
90-
dependencies: ["NIO", "NIOWebSocket"]),
90+
dependencies: ["NIOCore", "NIOEmbedded", "NIOWebSocket"]),
9191
.testTarget(name: "NIOTestUtilsTests",
9292
dependencies: ["NIOTestUtils"]),
9393
.testTarget(name: "NIOFoundationCompatTests",
94-
dependencies: ["NIO", "NIOFoundationCompat"]),
94+
dependencies: ["NIOCore", "NIOFoundationCompat"]),
9595
]
9696

9797
let package = Package(

Sources/NIOAsyncAwaitDemo/AsyncChannelIO.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import NIO
15+
import NIOCore
1616
import NIOHTTP1
1717

1818
#if compiler(>=5.5) // we cannot write this on one line with `&&` because Swift 5.0 doesn't like it...

Sources/NIOAsyncAwaitDemo/FullRequestResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
// THIS FILE IS MOSTLY COPIED FROM swift-nio-extras
1616

17-
import NIO
17+
import NIOCore
1818
import NIOHTTP1
1919

2020
public final class MakeFullRequestHandler: ChannelOutboundHandler {

Sources/NIOAsyncAwaitDemo/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14-
14+
import NIOCore
1515
import NIO
1616
import _NIOConcurrency
1717
import NIOHTTP1

Sources/NIOChatClient/main.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftNIO open source project
44
//
5-
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
5+
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14+
import NIOCore
1415
import NIO
1516

1617
private final class ChatHandler: ChannelInboundHandler {

Sources/NIOChatServer/main.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftNIO open source project
44
//
5-
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
5+
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -11,6 +11,7 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14+
import NIOCore
1415
import NIO
1516
import Dispatch
1617

Sources/NIOCrashTester/CrashTests+ByteBuffer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftNIO open source project
44
//
5-
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
5+
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import NIO
15+
import NIOCore
1616

1717
struct ByteBufferCrashTests {
1818
let testMovingReaderIndexPastWriterIndex = CrashTest(

Sources/NIOCrashTester/CrashTests+EventLoop.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftNIO open source project
44
//
5-
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
5+
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14-
14+
import NIOCore
1515
import NIO
1616

1717
fileprivate let group = MultiThreadedEventLoopGroup(numberOfThreads: 2)

Sources/NIOCrashTester/CrashTests+HTTP.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftNIO open source project
44
//
5-
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
5+
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -11,8 +11,8 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14-
15-
import NIO
14+
import NIOEmbedded
15+
import NIOCore
1616
import NIOHTTP1
1717

1818
struct HTTPCrashTests {

Sources/NIOCrashTester/OutputGrepper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftNIO open source project
44
//
5-
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
5+
// Copyright (c) 2020-2021 Apple Inc. and the SwiftNIO project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -11,7 +11,7 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14-
14+
import NIOCore
1515
import NIO
1616
import NIOFoundationCompat
1717
import class Foundation.Pipe

0 commit comments

Comments
 (0)