Skip to content

Commit 16667a3

Browse files
authored
Merge pull request #25 from milseman/dyadically_distributed
Ease binary distribution
2 parents 37e23f2 + b9d290d commit 16667a3

27 files changed

+410
-388
lines changed

Package.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@ import PackageDescription
1515
let targets: [PackageDescription.Target] = [
1616
.target(
1717
name: "SystemPackage",
18-
dependencies: ["SystemInternals"],
19-
path: "Sources/System"),
20-
.target(
21-
name: "SystemInternals",
2218
dependencies: ["CSystem"],
19+
path: "Sources/System",
2320
swiftSettings: [
2421
.define("ENABLE_MOCKING", .when(configuration: .debug))
2522
]),
2623
.target(
2724
name: "CSystem",
2825
dependencies: []),
29-
3026
.testTarget(
3127
name: "SystemTests",
32-
dependencies: ["SystemPackage"]),
28+
dependencies: ["SystemPackage"],
29+
swiftSettings: [
30+
.define("SYSTEM_PACKAGE")
31+
]),
3332
]
3433

3534
let package = Package(

Sources/System/Errno.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,6 @@ extension Errno {
14721472
#endif
14731473
}
14741474

1475-
@_implementationOnly import SystemInternals
14761475
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
14771476
extension Errno {
14781477
// TODO: We want to provide safe access to `errno`, but we need a

Sources/System/FileOperations.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
See https://swift.org/LICENSE.txt for license information
88
*/
99

10-
@_implementationOnly import SystemInternals
11-
1210
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
1311
extension FileDescriptor {
1412
/// Opens or creates a file for reading or writing.
@@ -122,7 +120,7 @@ extension FileDescriptor {
122120
internal func _seek(
123121
offset: Int64, from whence: FileDescriptor.SeekOrigin
124122
) -> Result<Int64, Errno> {
125-
let newOffset = system_lseek(self.rawValue, COffT(offset), whence.rawValue)
123+
let newOffset = system_lseek(self.rawValue, _COffT(offset), whence.rawValue)
126124
return valueOrErrno(Int64(newOffset))
127125
}
128126

@@ -210,7 +208,7 @@ extension FileDescriptor {
210208
retryOnInterrupt: Bool
211209
) -> Result<Int, Errno> {
212210
valueOrErrno(retryOnInterrupt: retryOnInterrupt) {
213-
system_pread(self.rawValue, buffer.baseAddress, buffer.count, COffT(offset))
211+
system_pread(self.rawValue, buffer.baseAddress, buffer.count, _COffT(offset))
214212
}
215213
}
216214

@@ -292,7 +290,7 @@ extension FileDescriptor {
292290
retryOnInterrupt: Bool
293291
) -> Result<Int, Errno> {
294292
valueOrErrno(retryOnInterrupt: retryOnInterrupt) {
295-
system_pwrite(self.rawValue, buffer.baseAddress, buffer.count, COffT(offset))
293+
system_pwrite(self.rawValue, buffer.baseAddress, buffer.count, _COffT(offset))
296294
}
297295
}
298296

Sources/System/FilePath/FilePathComponentView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
// MARK: - API
1111

12+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1213
extension FilePath {
1314
/// A bidirectional, range replaceable collection of the non-root components
1415
/// that make up a file path.
@@ -97,6 +98,7 @@ extension FilePath.ComponentView: BidirectionalCollection {
9798
}
9899
}
99100

101+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
100102
extension FilePath.ComponentView: RangeReplaceableCollection {
101103
public init() {
102104
self.init(FilePath())

Sources/System/FilePath/FilePathComponents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ extension FilePath {
7373
}
7474
}
7575

76+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
7677
extension FilePath.Component {
7778

7879
/// Whether a component is a regular file or directory name, or a special
@@ -253,7 +254,6 @@ extension FilePath.Root {
253254

254255
// MARK: - Invariants
255256

256-
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
257257
extension FilePath.Component {
258258
// TODO: ensure this all gets easily optimized away in release...
259259
internal func _invariantCheck() {

Sources/System/FilePath/FilePathParsing.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ extension SystemString {
111111
}
112112
}
113113

114-
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
115114
extension FilePath {
116115
internal mutating func _removeTrailingSeparator() {
117116
_storage._removeTrailingSeparator()
@@ -323,7 +322,6 @@ extension FilePath {
323322
}
324323

325324
// Whether we are providing Windows paths
326-
@_implementationOnly import var SystemInternals.forceWindowsPaths
327325
@inline(__always)
328326
internal var _windowsPaths: Bool {
329327
#if os(Windows)

Sources/System/FilePath/FilePathString.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// MARK: - Platform string
1111

12-
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
12+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1313
extension FilePath {
1414
/// Creates a file path by copying bytes from a null-terminated platform
1515
/// string.
@@ -39,6 +39,7 @@ extension FilePath {
3939
}
4040
}
4141

42+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4243
extension FilePath.Component {
4344
/// Creates a file path component by copying bytes from a null-terminated
4445
/// platform string.
@@ -75,6 +76,7 @@ extension FilePath.Component {
7576
}
7677
}
7778

79+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
7880
extension FilePath.Root {
7981
/// Creates a file path root by copying bytes from a null-terminated platform
8082
/// string.
@@ -234,6 +236,7 @@ extension FilePath.Root: CustomStringConvertible, CustomDebugStringConvertible {
234236
// MARK: - Convenience helpers
235237

236238
// Convenience helpers
239+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
237240
extension FilePath {
238241
/// Creates a string by interpreting the path’s content as UTF-8 on Unix
239242
/// and UTF-16 on Windows.
@@ -244,6 +247,7 @@ extension FilePath {
244247
}
245248
}
246249

250+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
247251
extension FilePath.Component {
248252
/// Creates a string by interpreting the component’s content as UTF-8 on Unix
249253
/// and UTF-16 on Windows.
@@ -254,6 +258,7 @@ extension FilePath.Component {
254258
}
255259
}
256260

261+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
257262
extension FilePath.Root {
258263
/// On Unix, this returns `"/"`.
259264
///
@@ -380,6 +385,7 @@ extension String {
380385

381386
// MARK: - Deprecations
382387

388+
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
383389
extension String {
384390
@available(*, deprecated, renamed: "init(decoding:)")
385391
public init(_ path: FilePath) { self.init(decoding: path) }
@@ -388,6 +394,7 @@ extension String {
388394
public init?(validatingUTF8 path: FilePath) { self.init(validating: path) }
389395
}
390396

397+
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
391398
extension FilePath {
392399
@available(*, deprecated, renamed: "init(platformString:)")
393400
public init(cString: UnsafePointer<CChar>) {

Sources/System/FilePath/FilePathSyntax.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// MARK: - Query API
1111

12-
// @available(...)
12+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1313
extension FilePath {
1414
/// Returns true if this path uniquely identifies the location of
1515
/// a file without reference to an additional starting location.
@@ -103,6 +103,7 @@ extension FilePath {
103103
}
104104

105105
// MARK: - Decompose a path
106+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
106107
extension FilePath {
107108
/// Returns the root of a path if there is one, otherwise `nil`.
108109
///
@@ -187,6 +188,7 @@ extension FilePath {
187188
}
188189
}
189190

191+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
190192
extension FilePath {
191193
/// Returns the final component of the path.
192194
/// Returns `nil` if the path is empty or only contains a root.
@@ -258,6 +260,7 @@ extension FilePath {
258260
}
259261
}
260262

263+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
261264
extension FilePath.Component {
262265
/// The extension of this file or directory component.
263266
///
@@ -290,6 +293,7 @@ extension FilePath.Component {
290293
}
291294
}
292295

296+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
293297
extension FilePath {
294298

295299
/// The extension of the file or directory last component.
@@ -356,6 +360,7 @@ extension FilePath {
356360

357361
}
358362

363+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
359364
extension FilePath {
360365
/// Whether the path is in lexical-normal form, that is `.` and `..`
361366
/// components have been collapsed lexically (i.e. without following
@@ -436,6 +441,7 @@ extension FilePath {
436441
}
437442

438443
// Modification and concatenation API
444+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
439445
extension FilePath {
440446
/// If `prefix` is a prefix of `self`, removes it and returns `true`.
441447
/// Otherwise returns `false`.
@@ -605,6 +611,7 @@ extension FilePath {
605611
}
606612

607613
// MARK - Renamed
614+
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
608615
extension FilePath {
609616
@available(*, unavailable, renamed: "removingLastComponent()")
610617
public var dirname: FilePath { removingLastComponent() }

0 commit comments

Comments
 (0)