From 5a033bf745c14a4be24b0b85e30ec9bf47a3c341 Mon Sep 17 00:00:00 2001 From: Finagolfin Date: Mon, 2 Dec 2024 00:35:57 +0530 Subject: [PATCH] Remove upstreamed NIO patches from the CI --- .github/workflows/sdks.yml | 2 +- swift-nio-filesystem.patch | 31 ++++++--- swift-nio-ndk27.patch | 130 ------------------------------------- 3 files changed, 24 insertions(+), 139 deletions(-) delete mode 100644 swift-nio-ndk27.patch diff --git a/.github/workflows/sdks.yml b/.github/workflows/sdks.yml index 6ad8f1c8..fea497c5 100644 --- a/.github/workflows/sdks.yml +++ b/.github/workflows/sdks.yml @@ -328,7 +328,7 @@ jobs: - name: Build Swift NIO package run: | cd swift-nio - git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem.patch ../sdk-config/swift-nio-ndk27.patch + git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem.patch ${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_FLAGS} - name: Get Swift Numerics package uses: actions/checkout@v4 diff --git a/swift-nio-filesystem.patch b/swift-nio-filesystem.patch index 41bf6eb0..f27844f2 100644 --- a/swift-nio-filesystem.patch +++ b/swift-nio-filesystem.patch @@ -24,28 +24,28 @@ diff --git a/Sources/NIOFileSystem/Internal/System Calls/Syscalls.swift b/Source index 1e9c1661..2a4935e7 100644 --- a/Sources/NIOFileSystem/Internal/System Calls/Syscalls.swift +++ b/Sources/NIOFileSystem/Internal/System Calls/Syscalls.swift -@@ -454,12 +454,21 @@ internal func libc_confstr( +@@ -452,12 +452,21 @@ internal func libc_confstr( + #endif /// fts(3) - #if os(Android) -+#if compiler(>=6.1) ++#if compiler(<6.1) +internal func libc_fts_open( -+ _ path: [UnsafeMutablePointer?], ++ _ path: [UnsafeMutablePointer], + _ options: CInt +) -> UnsafeMutablePointer { + fts_open(path, options, nil)! +} +#else internal func libc_fts_open( - _ path: [UnsafeMutablePointer], + _ path: [UnsafeMutablePointer?], _ options: CInt ) -> UnsafeMutablePointer { fts_open(path, options, nil)! } +#endif - #else - internal func libc_fts_open( - _ path: [UnsafeMutablePointer?], + + /// fts(3) + internal func libc_fts_read( diff --git a/Sources/NIOFileSystem/Internal/SystemFileHandle.swift b/Sources/NIOFileSystem/Internal/SystemFileHandle.swift index 3dc51872..49aeeeca 100644 --- a/Sources/NIOFileSystem/Internal/SystemFileHandle.swift @@ -247,3 +247,18 @@ index f24736a7..310d9691 100644 let info = try await handle.info() let size = info.size +diff --git a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift +index 66ed1171..5253a650 100644 +--- a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift ++++ b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift +@@ -17,6 +17,10 @@ + import XCTest + @_spi(Testing) import _NIOFileSystem + ++#if canImport(Android) ++import Android ++#endif ++ + #if ENABLE_MOCKING + final class SyscallTests: XCTestCase { + func test_openat() throws { diff --git a/swift-nio-ndk27.patch b/swift-nio-ndk27.patch deleted file mode 100644 index 716ee3d7..00000000 --- a/swift-nio-ndk27.patch +++ /dev/null @@ -1,130 +0,0 @@ -diff --git a/Sources/NIOPosix/System.swift b/Sources/NIOPosix/System.swift -index 33b3be73..b97fa645 100644 ---- a/Sources/NIOPosix/System.swift -+++ b/Sources/NIOPosix/System.swift -@@ -125,15 +125,15 @@ private let sysWritev = sysWritev_wrapper - private let sysWritev: @convention(c) (Int32, UnsafePointer?, CInt) -> CLong = writev - #endif - #if !os(Windows) --private let sysRecvMsg: @convention(c) (CInt, UnsafeMutablePointer?, CInt) -> ssize_t = recvmsg --private let sysSendMsg: @convention(c) (CInt, UnsafePointer?, CInt) -> ssize_t = sendmsg -+private let sysRecvMsg: @convention(c) (CInt, UnsafeMutablePointer, CInt) -> ssize_t = recvmsg -+private let sysSendMsg: @convention(c) (CInt, UnsafePointer, CInt) -> ssize_t = sendmsg - #endif - private let sysDup: @convention(c) (CInt) -> CInt = dup - #if !os(Windows) - private let sysGetpeername: -- @convention(c) (CInt, UnsafeMutablePointer?, UnsafeMutablePointer?) -> CInt = getpeername -+ @convention(c) (CInt, UnsafeMutablePointer, UnsafeMutablePointer) -> CInt = getpeername - private let sysGetsockname: -- @convention(c) (CInt, UnsafeMutablePointer?, UnsafeMutablePointer?) -> CInt = getsockname -+ @convention(c) (CInt, UnsafeMutablePointer, UnsafeMutablePointer) -> CInt = getsockname - #endif - - #if os(Android) -@@ -142,7 +142,7 @@ private let sysIfNameToIndex: @convention(c) (UnsafePointer) -> CUnsigned - private let sysIfNameToIndex: @convention(c) (UnsafePointer?) -> CUnsignedInt = if_nametoindex - #endif - #if !os(Windows) --private let sysSocketpair: @convention(c) (CInt, CInt, CInt, UnsafeMutablePointer?) -> CInt = socketpair -+private let sysSocketpair: @convention(c) (CInt, CInt, CInt, UnsafeMutablePointer) -> CInt = socketpair - #endif - - #if os(Linux) || os(Android) || canImport(Darwin) -@@ -966,7 +966,7 @@ internal enum Posix { - socketVector: UnsafeMutablePointer? - ) throws { - _ = try syscall(blocking: false) { -- sysSocketpair(domain.rawValue, type.rawValue, protocolSubtype.rawValue, socketVector) -+ sysSocketpair(domain.rawValue, type.rawValue, protocolSubtype.rawValue, socketVector!) - } - } - #endif -diff --git a/Tests/NIOConcurrencyHelpersTests/NIOConcurrencyHelpersTests.swift b/Tests/NIOConcurrencyHelpersTests/NIOConcurrencyHelpersTests.swift -index 53864db0..bb062226 100644 ---- a/Tests/NIOConcurrencyHelpersTests/NIOConcurrencyHelpersTests.swift -+++ b/Tests/NIOConcurrencyHelpersTests/NIOConcurrencyHelpersTests.swift -@@ -22,8 +22,8 @@ import XCTest - import Darwin - #elseif canImport(Glibc) - import Glibc --#elseif canImport(Bionic) --import Bionic -+#elseif canImport(Android) -+import Android - #else - #error("The Concurrency helpers test module was unable to identify your C library.") - #endif -diff --git a/Tests/NIOCoreTests/XCTest+Extensions.swift b/Tests/NIOCoreTests/XCTest+Extensions.swift -index 1717542d..99474008 100644 ---- a/Tests/NIOCoreTests/XCTest+Extensions.swift -+++ b/Tests/NIOCoreTests/XCTest+Extensions.swift -@@ -15,6 +15,10 @@ - import NIOCore - import XCTest - -+#if canImport(Android) -+import Android -+#endif -+ - func assert( - _ condition: @autoclosure () -> Bool, - within time: TimeAmount, -diff --git a/Tests/NIOEmbeddedTests/TestUtils.swift b/Tests/NIOEmbeddedTests/TestUtils.swift -index 02fe152e..c25bc44a 100644 ---- a/Tests/NIOEmbeddedTests/TestUtils.swift -+++ b/Tests/NIOEmbeddedTests/TestUtils.swift -@@ -17,6 +17,10 @@ import NIOConcurrencyHelpers - import NIOCore - import XCTest - -+#if canImport(Android) -+import Android -+#endif -+ - // FIXME: Duplicated with NIO - func assert( - _ condition: @autoclosure () -> Bool, -diff --git a/Tests/NIOFileSystemTests/FileInfoTests.swift b/Tests/NIOFileSystemTests/FileInfoTests.swift -index e69e7720..d944e425 100644 ---- a/Tests/NIOFileSystemTests/FileInfoTests.swift -+++ b/Tests/NIOFileSystemTests/FileInfoTests.swift -@@ -20,8 +20,8 @@ import XCTest - import Darwin - #elseif canImport(Glibc) - import Glibc --#elseif canImport(Bionic) --import Bionic -+#elseif canImport(Android) -+import Android - #endif - - final class FileInfoTests: XCTestCase { -diff --git a/Tests/NIOFileSystemTests/FileTypeTests.swift b/Tests/NIOFileSystemTests/FileTypeTests.swift -index 4b436d87..537b4642 100644 ---- a/Tests/NIOFileSystemTests/FileTypeTests.swift -+++ b/Tests/NIOFileSystemTests/FileTypeTests.swift -@@ -20,6 +20,8 @@ import XCTest - import Darwin - #elseif canImport(Glibc) - import Glibc -+#elseif canImport(Android) -+import Android - #endif - - final class FileTypeTests: XCTestCase { -diff --git a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift -index 66ed1171..5253a650 100644 ---- a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift -+++ b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift -@@ -17,6 +17,10 @@ - import XCTest - @_spi(Testing) import _NIOFileSystem - -+#if canImport(Android) -+import Android -+#endif -+ - #if ENABLE_MOCKING - final class SyscallTests: XCTestCase { - func test_openat() throws {