Skip to content

Commit 67e2f7d

Browse files
authored
Merge pull request #66 from jakepetroules/remove-availability
Remove availability annotations for Span APIs
2 parents 43f99d9 + 2683ad6 commit 67e2f7d

16 files changed

+2
-279
lines changed

Package.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
import PackageDescription
55

6-
let availabilityMacro: SwiftSetting = .enableExperimentalFeature(
7-
"AvailabilityMacro=SubprocessSpan: macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999",
8-
)
9-
106
var dep: [Package.Dependency] = [
117
.package(
128
url: "https://github.com/apple/swift-system",
@@ -59,7 +55,6 @@ let package = Package(
5955
.enableExperimentalFeature("NonescapableTypes"),
6056
.enableExperimentalFeature("LifetimeDependence"),
6157
.enableExperimentalFeature("Span"),
62-
availabilityMacro,
6358
]
6459
),
6560
.testTarget(
@@ -72,7 +67,6 @@ let package = Package(
7267
],
7368
swiftSettings: [
7469
.enableExperimentalFeature("Span"),
75-
availabilityMacro,
7670
]
7771
),
7872

Sources/Subprocess/API.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
/// - output: The method to use for redirecting the standard output.
3131
/// - error: The method to use for redirecting the standard error.
3232
/// - Returns a CollectedResult containing the result of the run.
33-
#if SubprocessSpan
34-
@available(SubprocessSpan, *)
35-
#endif
3633
public func run<
3734
Input: InputProtocol,
3835
Output: OutputProtocol,
@@ -76,7 +73,6 @@ public func run<
7673
/// - error: The method to use for redirecting the standard error.
7774
/// - Returns a CollectedResult containing the result of the run.
7875
#if SubprocessSpan
79-
@available(SubprocessSpan, *)
8076
public func run<
8177
InputElement: BitwiseCopyable,
8278
Output: OutputProtocol,
@@ -480,9 +476,6 @@ public func run<Result>(
480476
/// - output: The method to use for redirecting the standard output.
481477
/// - error: The method to use for redirecting the standard error.
482478
/// - Returns a CollectedResult containing the result of the run.
483-
#if SubprocessSpan
484-
@available(SubprocessSpan, *)
485-
#endif
486479
public func run<
487480
Input: InputProtocol,
488481
Output: OutputProtocol,

Sources/Subprocess/Buffer.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ extension AsyncBufferSequence.Buffer {
7979

8080
#if SubprocessSpan
8181
// Access the storage backing this Buffer
82-
#if SubprocessSpan
83-
@available(SubprocessSpan, *)
84-
#endif
8582
public var bytes: RawSpan {
8683
@lifetime(borrow self)
8784
borrowing get {

Sources/Subprocess/IO/Input.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ public final actor StandardInputWriter: Sendable {
231231
/// - Parameter span: The span to write
232232
/// - Returns number of bytes written
233233
#if SubprocessSpan
234-
@available(SubprocessSpan, *)
235234
public func write(_ span: borrowing RawSpan) async throws -> Int {
236235
return try await self.diskIO.write(span)
237236
}

Sources/Subprocess/IO/Output.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public protocol OutputProtocol: Sendable, ~Copyable {
2828

2929
#if SubprocessSpan
3030
/// Convert the output from span to expected output type
31-
@available(SubprocessSpan, *)
3231
func output(from span: RawSpan) throws -> OutputType
3332
#endif
3433

@@ -113,7 +112,6 @@ public struct StringOutput<Encoding: Unicode.Encoding>: OutputProtocol {
113112
public let maxSize: Int
114113

115114
#if SubprocessSpan
116-
@available(SubprocessSpan, *)
117115
public func output(from span: RawSpan) throws -> String? {
118116
// FIXME: Span to String
119117
var array: [UInt8] = []
@@ -153,7 +151,6 @@ public struct BytesOutput: OutputProtocol {
153151
}
154152

155153
#if SubprocessSpan
156-
@available(SubprocessSpan, *)
157154
public func output(from span: RawSpan) throws -> [UInt8] {
158155
fatalError("Not implemented")
159156
}
@@ -227,7 +224,6 @@ extension OutputProtocol where Self == BytesOutput {
227224

228225
// MARK: - Span Default Implementations
229226
#if SubprocessSpan
230-
@available(SubprocessSpan, *)
231227
extension OutputProtocol {
232228
public func output(from buffer: some Sequence<UInt8>) throws -> OutputType {
233229
guard let rawBytes: UnsafeRawBufferPointer = buffer as? UnsafeRawBufferPointer else {
@@ -281,7 +277,6 @@ extension OutputProtocol where OutputType == Void {
281277

282278
#if SubprocessSpan
283279
/// Convert the output from Data to expected output type
284-
@available(SubprocessSpan, *)
285280
public func output(from span: RawSpan) throws {
286281
// noop
287282
}
@@ -293,7 +288,6 @@ extension OutputProtocol where OutputType == Void {
293288
}
294289

295290
#if SubprocessSpan
296-
@available(SubprocessSpan, *)
297291
extension OutputProtocol {
298292
#if os(Windows)
299293
internal func output(from data: [UInt8]) throws -> OutputType {

Sources/Subprocess/Platforms/Subprocess+Linux.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ import _SubprocessCShims
3232

3333
// Linux specific implementations
3434
extension Configuration {
35-
#if SubprocessSpan
36-
@available(SubprocessSpan, *)
37-
#endif
3835
internal func spawn(
3936
withInput inputPipe: consuming CreatedPipe,
4037
outputPipe: consuming CreatedPipe,

Sources/Subprocess/Platforms/Subprocess+Unix.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ extension DispatchIO {
446446

447447
extension TrackedDispatchIO {
448448
#if SubprocessSpan
449-
@available(SubprocessSpan, *)
450449
internal func write(
451450
_ span: borrowing RawSpan
452451
) async throws -> Int {

Sources/Subprocess/Platforms/Subprocess+Windows.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ internal import Dispatch
2121

2222
// Windows specific implementation
2323
extension Configuration {
24-
#if SubprocessSpan
25-
@available(SubprocessSpan, *)
26-
#endif
2724
internal func spawn(
2825
withInput inputPipe: consuming CreatedPipe,
2926
outputPipe: consuming CreatedPipe,
@@ -534,9 +531,7 @@ internal func monitorProcessTermination(
534531
}
535532

536533
// MARK: - Subprocess Control
537-
#if SubprocessSpan
538-
@available(SubprocessSpan, *)
539-
#endif
534+
540535
extension Execution {
541536
/// Terminate the current subprocess with the given exit code
542537
/// - Parameter exitCode: The exit code to use for the subprocess.
@@ -1165,7 +1160,6 @@ extension TrackedFileDescriptor {
11651160
}
11661161

11671162
#if SubprocessSpan
1168-
@available(SubprocessSpan, *)
11691163
internal func write(
11701164
_ span: borrowing RawSpan
11711165
) async throws -> Int {

Sources/Subprocess/Result.swift

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ public struct ExecutionResult<Result> {
3434

3535
/// The result of a subprocess execution with its collected
3636
/// standard output and standard error.
37-
#if SubprocessSpan
38-
@available(SubprocessSpan, *)
39-
#endif
4037
public struct CollectedResult<
4138
Output: OutputProtocol,
4239
Error: OutputProtocol
@@ -62,24 +59,13 @@ public struct CollectedResult<
6259
}
6360

6461
// MARK: - CollectedResult Conformances
65-
#if SubprocessSpan
66-
@available(SubprocessSpan, *)
67-
#endif
62+
6863
extension CollectedResult: Equatable where Output.OutputType: Equatable, Error.OutputType: Equatable {}
6964

70-
#if SubprocessSpan
71-
@available(SubprocessSpan, *)
72-
#endif
7365
extension CollectedResult: Hashable where Output.OutputType: Hashable, Error.OutputType: Hashable {}
7466

75-
#if SubprocessSpan
76-
@available(SubprocessSpan, *)
77-
#endif
7867
extension CollectedResult: Codable where Output.OutputType: Codable, Error.OutputType: Codable {}
7968

80-
#if SubprocessSpan
81-
@available(SubprocessSpan, *)
82-
#endif
8369
extension CollectedResult: CustomStringConvertible
8470
where Output.OutputType: CustomStringConvertible, Error.OutputType: CustomStringConvertible {
8571
public var description: String {
@@ -94,9 +80,6 @@ where Output.OutputType: CustomStringConvertible, Error.OutputType: CustomString
9480
}
9581
}
9682

97-
#if SubprocessSpan
98-
@available(SubprocessSpan, *)
99-
#endif
10083
extension CollectedResult: CustomDebugStringConvertible
10184
where Output.OutputType: CustomDebugStringConvertible, Error.OutputType: CustomDebugStringConvertible {
10285
public var debugDescription: String {

Sources/Subprocess/Span+Subprocess.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public func _overrideLifetime<
3939
dependent
4040
}
4141

42-
@available(SubprocessSpan, *)
4342
extension Span where Element: BitwiseCopyable {
4443

4544
internal var _bytes: RawSpan {
@@ -55,7 +54,6 @@ extension Span where Element: BitwiseCopyable {
5554
#if canImport(Glibc) || canImport(Bionic) || canImport(Musl)
5655
internal import Dispatch
5756

58-
@available(SubprocessSpan, *)
5957
extension DispatchData {
6058
var bytes: RawSpan {
6159
_read {

0 commit comments

Comments
 (0)