From 60089114f8af82d8fb290579fbde46e11f07a552 Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Tue, 17 Dec 2024 11:21:02 +0000 Subject: [PATCH] Enable MemberImportVisibility check - attempt 2 (#3029) Enable MemberImportVisibility check on all targets. Use a standard string header and footer to bracket the new block for ease of updating in the future with scripts. See https://github.com/apple/swift-nio/pull/3021 --- Package.swift | 11 +++++++++++ Sources/NIOCrashTester/CrashTests+Strict.swift | 1 + Sources/NIOCrashTester/CrashTests+System.swift | 1 + Sources/NIOMulticastChat/main.swift | 1 + Sources/NIOPosix/BaseSocket.swift | 1 + Sources/NIOPosix/Bootstrap.swift | 1 + Sources/NIOPosix/DatagramVectorReadManager.swift | 1 + Sources/NIOPosix/NonBlockingFileIO.swift | 1 + Sources/NIOPosix/PendingDatagramWritesManager.swift | 1 + Sources/NIOPosix/PendingWritesManager.swift | 1 + Sources/NIOPosix/SelectorEpoll.swift | 1 + Sources/NIOPosix/Socket.swift | 1 + Sources/NIOPosix/SocketChannel.swift | 1 + Tests/NIOFileSystemTests/FileInfoTests.swift | 9 +++++++++ Tests/NIOFileSystemTests/Internal/SyscallTests.swift | 1 + Tests/NIOPosixTests/BlockingIOThreadPoolTest.swift | 1 + Tests/NIOPosixTests/ControlMessageTests.swift | 1 + Tests/NIOPosixTests/NIOThreadPoolTest.swift | 1 + Tests/NIOPosixTests/NonBlockingFileIOTest.swift | 1 + .../PendingDatagramWritesManagerTests.swift | 1 + Tests/NIOPosixTests/SocketAddressTest.swift | 1 + Tests/NIOPosixTests/SocketOptionProviderTest.swift | 1 + Tests/NIOPosixTests/StreamChannelsTest.swift | 1 + Tests/NIOPosixTests/SyscallAbstractionLayer.swift | 1 + Tests/NIOPosixTests/SystemTest.swift | 1 + Tests/NIOPosixTests/ThreadTest.swift | 1 + 26 files changed, 44 insertions(+) diff --git a/Package.swift b/Package.swift index 1b63eae193..610fbf6dbd 100644 --- a/Package.swift +++ b/Package.swift @@ -568,3 +568,14 @@ if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { .package(path: "../swift-system"), ] } + +// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // +for target in package.targets { + if target.type != .plugin { + var settings = target.swiftSettings ?? [] + // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + settings.append(.enableUpcomingFeature("MemberImportVisibility")) + target.swiftSettings = settings + } +} +// --- END: STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- // diff --git a/Sources/NIOCrashTester/CrashTests+Strict.swift b/Sources/NIOCrashTester/CrashTests+Strict.swift index d97a737a00..cbbe46a52e 100644 --- a/Sources/NIOCrashTester/CrashTests+Strict.swift +++ b/Sources/NIOCrashTester/CrashTests+Strict.swift @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #if !canImport(Darwin) || os(macOS) +import NIOCore import NIOPosix struct StrictCrashTests { diff --git a/Sources/NIOCrashTester/CrashTests+System.swift b/Sources/NIOCrashTester/CrashTests+System.swift index 3147ff081a..b5863eb20a 100644 --- a/Sources/NIOCrashTester/CrashTests+System.swift +++ b/Sources/NIOCrashTester/CrashTests+System.swift @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #if !canImport(Darwin) || os(macOS) +import NIOCore import NIOPosix import Foundation diff --git a/Sources/NIOMulticastChat/main.swift b/Sources/NIOMulticastChat/main.swift index 94beddc8fd..7d3298ee7e 100644 --- a/Sources/NIOMulticastChat/main.swift +++ b/Sources/NIOMulticastChat/main.swift @@ -11,6 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore import NIOPosix diff --git a/Sources/NIOPosix/BaseSocket.swift b/Sources/NIOPosix/BaseSocket.swift index 58e20d3e86..5c5ab3ceb8 100644 --- a/Sources/NIOPosix/BaseSocket.swift +++ b/Sources/NIOPosix/BaseSocket.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOConcurrencyHelpers import NIOCore diff --git a/Sources/NIOPosix/Bootstrap.swift b/Sources/NIOPosix/Bootstrap.swift index e3b5710ffe..20a0a4844d 100644 --- a/Sources/NIOPosix/Bootstrap.swift +++ b/Sources/NIOPosix/Bootstrap.swift @@ -11,6 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore #if os(Windows) diff --git a/Sources/NIOPosix/DatagramVectorReadManager.swift b/Sources/NIOPosix/DatagramVectorReadManager.swift index 2d4987a9d6..7f6ced454e 100644 --- a/Sources/NIOPosix/DatagramVectorReadManager.swift +++ b/Sources/NIOPosix/DatagramVectorReadManager.swift @@ -11,6 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore /// An object that manages issuing vector reads for datagram channels. diff --git a/Sources/NIOPosix/NonBlockingFileIO.swift b/Sources/NIOPosix/NonBlockingFileIO.swift index fe3448d11a..7b8c9a8233 100644 --- a/Sources/NIOPosix/NonBlockingFileIO.swift +++ b/Sources/NIOPosix/NonBlockingFileIO.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOConcurrencyHelpers import NIOCore diff --git a/Sources/NIOPosix/PendingDatagramWritesManager.swift b/Sources/NIOPosix/PendingDatagramWritesManager.swift index ace953fbcc..8c058bd4e4 100644 --- a/Sources/NIOPosix/PendingDatagramWritesManager.swift +++ b/Sources/NIOPosix/PendingDatagramWritesManager.swift @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// import Atomics +import CNIOLinux import NIOCore private struct PendingDatagramWrite { diff --git a/Sources/NIOPosix/PendingWritesManager.swift b/Sources/NIOPosix/PendingWritesManager.swift index 001b05c215..6e6b3fff7d 100644 --- a/Sources/NIOPosix/PendingWritesManager.swift +++ b/Sources/NIOPosix/PendingWritesManager.swift @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// import Atomics +import CNIOLinux import NIOCore private struct PendingStreamWrite { diff --git a/Sources/NIOPosix/SelectorEpoll.swift b/Sources/NIOPosix/SelectorEpoll.swift index 832dc41dff..d0dbf09ed9 100644 --- a/Sources/NIOPosix/SelectorEpoll.swift +++ b/Sources/NIOPosix/SelectorEpoll.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import NIOConcurrencyHelpers import NIOCore #if !SWIFTNIO_USE_IO_URING diff --git a/Sources/NIOPosix/Socket.swift b/Sources/NIOPosix/Socket.swift index 1535e42d03..b8434d62e9 100644 --- a/Sources/NIOPosix/Socket.swift +++ b/Sources/NIOPosix/Socket.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore /// The container used for writing multiple buffers via `writev`. diff --git a/Sources/NIOPosix/SocketChannel.swift b/Sources/NIOPosix/SocketChannel.swift index e1a9a473c0..6dd2271311 100644 --- a/Sources/NIOPosix/SocketChannel.swift +++ b/Sources/NIOPosix/SocketChannel.swift @@ -11,6 +11,7 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore #if os(Windows) diff --git a/Tests/NIOFileSystemTests/FileInfoTests.swift b/Tests/NIOFileSystemTests/FileInfoTests.swift index ae06ab5e29..6760b5d3a9 100644 --- a/Tests/NIOFileSystemTests/FileInfoTests.swift +++ b/Tests/NIOFileSystemTests/FileInfoTests.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import XCTest import _NIOFileSystem @@ -23,6 +24,14 @@ import Glibc import Android #endif +#if canImport(Darwin) +private let S_IFREG = Darwin.S_IFREG +#elseif canImport(Glibc) +private let S_IFREG = Glibc.S_IFREG +#elseif canImport(Musl) +private let S_IFREG = Musl.S_IFREG +#endif + final class FileInfoTests: XCTestCase { private var status: CInterop.Stat { var status = CInterop.Stat() diff --git a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift index 2ca5204211..aa067798f7 100644 --- a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift +++ b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import SystemPackage import XCTest @_spi(Testing) import _NIOFileSystem diff --git a/Tests/NIOPosixTests/BlockingIOThreadPoolTest.swift b/Tests/NIOPosixTests/BlockingIOThreadPoolTest.swift index 1545d88ad8..38dabf7d08 100644 --- a/Tests/NIOPosixTests/BlockingIOThreadPoolTest.swift +++ b/Tests/NIOPosixTests/BlockingIOThreadPoolTest.swift @@ -14,6 +14,7 @@ import Dispatch import Foundation +import NIOCore import NIOPosix import XCTest diff --git a/Tests/NIOPosixTests/ControlMessageTests.swift b/Tests/NIOPosixTests/ControlMessageTests.swift index fc33f634a5..26b6634bb0 100644 --- a/Tests/NIOPosixTests/ControlMessageTests.swift +++ b/Tests/NIOPosixTests/ControlMessageTests.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import XCTest @testable import NIOPosix diff --git a/Tests/NIOPosixTests/NIOThreadPoolTest.swift b/Tests/NIOPosixTests/NIOThreadPoolTest.swift index 21eda2b446..d88f7c87ec 100644 --- a/Tests/NIOPosixTests/NIOThreadPoolTest.swift +++ b/Tests/NIOPosixTests/NIOThreadPoolTest.swift @@ -15,6 +15,7 @@ import Atomics import Dispatch import NIOConcurrencyHelpers +import NIOCore import NIOEmbedded import XCTest diff --git a/Tests/NIOPosixTests/NonBlockingFileIOTest.swift b/Tests/NIOPosixTests/NonBlockingFileIOTest.swift index 26ab80d614..4e452b1f12 100644 --- a/Tests/NIOPosixTests/NonBlockingFileIOTest.swift +++ b/Tests/NIOPosixTests/NonBlockingFileIOTest.swift @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// import Atomics +import CNIOLinux import NIOCore import XCTest diff --git a/Tests/NIOPosixTests/PendingDatagramWritesManagerTests.swift b/Tests/NIOPosixTests/PendingDatagramWritesManagerTests.swift index 3ef944b19f..b94e37cf94 100644 --- a/Tests/NIOPosixTests/PendingDatagramWritesManagerTests.swift +++ b/Tests/NIOPosixTests/PendingDatagramWritesManagerTests.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOEmbedded import XCTest diff --git a/Tests/NIOPosixTests/SocketAddressTest.swift b/Tests/NIOPosixTests/SocketAddressTest.swift index d12d8e626a..e08ebbe743 100644 --- a/Tests/NIOPosixTests/SocketAddressTest.swift +++ b/Tests/NIOPosixTests/SocketAddressTest.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import XCTest @testable import NIOCore diff --git a/Tests/NIOPosixTests/SocketOptionProviderTest.swift b/Tests/NIOPosixTests/SocketOptionProviderTest.swift index 962a620da0..32d2c704ec 100644 --- a/Tests/NIOPosixTests/SocketOptionProviderTest.swift +++ b/Tests/NIOPosixTests/SocketOptionProviderTest.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore import NIOPosix import XCTest diff --git a/Tests/NIOPosixTests/StreamChannelsTest.swift b/Tests/NIOPosixTests/StreamChannelsTest.swift index 072f35d41b..668dd1d331 100644 --- a/Tests/NIOPosixTests/StreamChannelsTest.swift +++ b/Tests/NIOPosixTests/StreamChannelsTest.swift @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// import Atomics +import CNIOLinux import NIOCore import NIOTestUtils import XCTest diff --git a/Tests/NIOPosixTests/SyscallAbstractionLayer.swift b/Tests/NIOPosixTests/SyscallAbstractionLayer.swift index 6137b43491..36e774e2d2 100644 --- a/Tests/NIOPosixTests/SyscallAbstractionLayer.swift +++ b/Tests/NIOPosixTests/SyscallAbstractionLayer.swift @@ -15,6 +15,7 @@ // This file contains a syscall abstraction layer (SAL) which hooks the Selector and the Socket in a way that we can // play the kernel whilst NIO thinks it's running on a real OS. +import CNIOLinux import NIOConcurrencyHelpers import NIOCore import XCTest diff --git a/Tests/NIOPosixTests/SystemTest.swift b/Tests/NIOPosixTests/SystemTest.swift index aabe800904..41840e3d02 100644 --- a/Tests/NIOPosixTests/SystemTest.swift +++ b/Tests/NIOPosixTests/SystemTest.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +import CNIOLinux import NIOCore import XCTest diff --git a/Tests/NIOPosixTests/ThreadTest.swift b/Tests/NIOPosixTests/ThreadTest.swift index 8320f068dd..d0d5b11726 100644 --- a/Tests/NIOPosixTests/ThreadTest.swift +++ b/Tests/NIOPosixTests/ThreadTest.swift @@ -14,6 +14,7 @@ import Dispatch import NIOConcurrencyHelpers +import NIOCore import XCTest @testable import NIOPosix