Skip to content

Commit 9140817

Browse files
Issue-2900 - Add VisionOS support (#2947)
Add Vision support ### Motivation: #2900 - close this ### Modifications: - Bump SystemPackage to 1.4.0 and remove @preconcurrency - remove `#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)` to allow for visionOS support - Remove conditional import for swift system ### Result: Vision OS support
1 parent 062b28e commit 9140817

Some content is hidden

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

55 files changed

+30
-169
lines changed

Package.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ import class Foundation.ProcessInfo
2121

2222
let swiftAtomics: PackageDescription.Target.Dependency = .product(name: "Atomics", package: "swift-atomics")
2323
let swiftCollections: PackageDescription.Target.Dependency = .product(name: "DequeModule", package: "swift-collections")
24-
let swiftSystem: PackageDescription.Target.Dependency = .product(
25-
name: "SystemPackage",
26-
package: "swift-system",
27-
condition: .when(platforms: [.macOS, .iOS, .tvOS, .watchOS, .linux, .android])
28-
)
24+
let swiftSystem: PackageDescription.Target.Dependency = .product(name: "SystemPackage", package: "swift-system")
2925

3026
// These platforms require a depdency on `NIOPosix` from `NIOHTTP1` to maintain backward
3127
// compatibility with previous NIO versions.
@@ -558,7 +554,7 @@ if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
558554
package.dependencies += [
559555
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
560556
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.2"),
561-
.package(url: "https://github.com/apple/swift-system.git", from: "1.2.0"),
557+
.package(url: "https://github.com/apple/swift-system.git", from: "1.4.0"),
562558
]
563559
} else {
564560
package.dependencies += [

Sources/NIOFileSystem/BufferedReader.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
1615
import DequeModule
1716
import NIOCore
1817

@@ -240,5 +239,3 @@ extension ReadableFileHandleProtocol {
240239
BufferedReader(wrapping: self, initialOffset: initialOffset, capacity: Int(capacity.bytes))
241240
}
242241
}
243-
244-
#endif

Sources/NIOFileSystem/BufferedWriter.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
1615
import NIOCore
1716

1817
/// A writer which buffers bytes in memory before writing them to the file system.
@@ -244,5 +243,3 @@ extension WritableFileHandleProtocol {
244243
}
245244
}
246245
}
247-
248-
#endif

Sources/NIOFileSystem/ByteBuffer+FileSystem.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
1615
import NIOCore
1716

1817
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
@@ -96,5 +95,3 @@ extension ByteBuffer {
9695
)
9796
}
9897
}
99-
100-
#endif

Sources/NIOFileSystem/ByteCount.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
16-
1715
/// Represents the number of bytes.
1816
public struct ByteCount: Hashable, Sendable {
1917
/// The number of bytes
@@ -117,5 +115,3 @@ extension ByteCount: Comparable {
117115
lhs.bytes < rhs.bytes
118116
}
119117
}
120-
121-
#endif

Sources/NIOFileSystem/Convenience.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
1615
import SystemPackage
1716

1817
extension String {
@@ -201,5 +200,3 @@ extension AsyncSequence where Self.Element == UInt8, Self: Sendable {
201200
)
202201
}
203202
}
204-
205-
#endif

Sources/NIOFileSystem/DirectoryEntries.swift

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

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
1615
import CNIODarwin
1716
import CNIOLinux
1817
import NIOConcurrencyHelpers
1918
import NIOCore
2019
import NIOPosix
21-
@preconcurrency import SystemPackage
20+
import SystemPackage
2221

2322
/// An `AsyncSequence` of entries in a directory.
2423
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
@@ -737,5 +736,3 @@ extension UnsafeMutablePointer<CInterop.FTSEnt> {
737736
FilePath(platformString: self.pointee.fts_path!)
738737
}
739738
}
740-
741-
#endif

Sources/NIOFileSystem/DirectoryEntry.swift

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

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
16-
@preconcurrency import SystemPackage
15+
import SystemPackage
1716

1817
/// Information about an item within a directory.
1918
public struct DirectoryEntry: Sendable, Hashable, Equatable {
@@ -46,5 +45,3 @@ public struct DirectoryEntry: Sendable, Hashable, Equatable {
4645
self.type = type
4746
}
4847
}
49-
50-
#endif

Sources/NIOFileSystem/Exports.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
16-
1715
// These types are used in our public API; expose them to make
1816
// life easier for users.
1917
@_exported import enum SystemPackage.CInterop
2018
@_exported import struct SystemPackage.Errno
2119
@_exported import struct SystemPackage.FileDescriptor
2220
@_exported import struct SystemPackage.FilePath
2321
@_exported import struct SystemPackage.FilePermissions
24-
25-
#endif

Sources/NIOFileSystem/FileChunks.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
1615
import NIOConcurrencyHelpers
1716
import NIOCore
1817
import NIOPosix
19-
@preconcurrency import SystemPackage
18+
import SystemPackage
2019

2120
/// An `AsyncSequence` of ordered chunks read from a file.
2221
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
@@ -544,4 +543,3 @@ extension ProducerState.Producing {
544543
return .moreToRead
545544
}
546545
}
547-
#endif

0 commit comments

Comments
 (0)