Skip to content

Commit 1699e24

Browse files
committed
Move platform requirements to availability annotations
Adding or raising the deployment platforms in the package manifest is a SemVer major breaking change as consumers must also add or raise their deployment platforms. This is a known limitation of SwiftPM. Unforunately this means that it's very difficult for non-leaf packages to adopt packages which declare their platforms in the manifest. Doing so puts the brakes on adoption and ecosystem growth. For 'core' packages like this one availability constraints should be expressed on declarations rather than in the manifest. This patch adds equivalent availability annotations to declarations across the package and removes platforms from the package manifest.
1 parent 4c3ea81 commit 1699e24

File tree

57 files changed

+145
-16
lines changed

Some content is hidden

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

57 files changed

+145
-16
lines changed

Package.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ import PackageDescription
44

55
let package = Package(
66
name: "swift-async-algorithms",
7-
platforms: [
8-
.macOS("10.15"),
9-
.iOS("13.0"),
10-
.tvOS("13.0"),
11-
.watchOS("6.0")
12-
],
137
products: [
148
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
159
],

Package@swift-5.7.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ import PackageDescription
44

55
let package = Package(
66
name: "swift-async-algorithms",
7-
platforms: [
8-
.macOS("10.15"),
9-
.iOS("13.0"),
10-
.tvOS("13.0"),
11-
.watchOS("6.0")
12-
],
137
products: [
148
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
159
.library(name: "AsyncSequenceValidation", targets: ["AsyncSequenceValidation"]),

Sources/AsyncAlgorithms/AsyncAdjacentPairsSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1213
extension AsyncSequence {
1314
/// An `AsyncSequence` that iterates over the adjacent pairs of the original
1415
/// original `AsyncSequence`.
@@ -35,6 +36,7 @@ extension AsyncSequence {
3536
/// An `AsyncSequence` that iterates over the adjacent pairs of the original
3637
/// `AsyncSequence`.
3738
@frozen
39+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
3840
public struct AsyncAdjacentPairsSequence<Base: AsyncSequence>: AsyncSequence {
3941
public typealias Element = (Base.Element, Base.Element)
4042

@@ -83,6 +85,7 @@ public struct AsyncAdjacentPairsSequence<Base: AsyncSequence>: AsyncSequence {
8385
}
8486
}
8587

88+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8689
extension AsyncAdjacentPairsSequence: Sendable where Base: Sendable, Base.Element: Sendable { }
8790

8891
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncBufferedByteIterator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
/// }
4040
///
4141
///
42+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
4243
public struct AsyncBufferedByteIterator: AsyncIteratorProtocol {
4344
public typealias Element = UInt8
4445
@usableFromInline var buffer: _AsyncBytesBuffer
@@ -68,6 +69,7 @@ public struct AsyncBufferedByteIterator: AsyncIteratorProtocol {
6869
extension AsyncBufferedByteIterator: Sendable { }
6970

7071
@frozen @usableFromInline
72+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
7173
internal struct _AsyncBytesBuffer {
7274
@usableFromInline
7375
final class Storage {

Sources/AsyncAlgorithms/AsyncChain2Sequence.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
/// - Returns: An asynchronous sequence that iterates first over the elements of `s1`, and
1919
/// then over the elements of `s2`.
2020
@inlinable
21+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2122
public func chain<Base1: AsyncSequence, Base2: AsyncSequence>(_ s1: Base1, _ s2: Base2) -> AsyncChain2Sequence<Base1, Base2> where Base1.Element == Base2.Element {
2223
AsyncChain2Sequence(s1, s2)
2324
}
2425

2526
/// A concatenation of two asynchronous sequences with the same element type.
2627
@frozen
28+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2729
public struct AsyncChain2Sequence<Base1: AsyncSequence, Base2: AsyncSequence> where Base1.Element == Base2.Element {
2830
@usableFromInline
2931
let base1: Base1
@@ -38,6 +40,7 @@ public struct AsyncChain2Sequence<Base1: AsyncSequence, Base2: AsyncSequence> wh
3840
}
3941
}
4042

43+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
4144
extension AsyncChain2Sequence: AsyncSequence {
4245
public typealias Element = Base1.Element
4346

@@ -79,6 +82,7 @@ extension AsyncChain2Sequence: AsyncSequence {
7982
}
8083
}
8184

85+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8286
extension AsyncChain2Sequence: Sendable where Base1: Sendable, Base2: Sendable { }
8387

8488
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChain3Sequence.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
/// - Returns: An asynchronous sequence that iterates first over the elements of `s1`, and
2020
/// then over the elements of `s2`, and then over the elements of `s3`
2121
@inlinable
22+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2223
public func chain<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>(_ s1: Base1, _ s2: Base2, _ s3: Base3) -> AsyncChain3Sequence<Base1, Base2, Base3> {
2324
AsyncChain3Sequence(s1, s2, s3)
2425
}
2526

2627
/// A concatenation of three asynchronous sequences with the same element type.
2728
@frozen
29+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2830
public struct AsyncChain3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence> where Base1.Element == Base2.Element, Base1.Element == Base3.Element {
2931
@usableFromInline
3032
let base1: Base1
@@ -43,6 +45,7 @@ public struct AsyncChain3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Ba
4345
}
4446
}
4547

48+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
4649
extension AsyncChain3Sequence: AsyncSequence {
4750
public typealias Element = Base1.Element
4851

@@ -94,6 +97,7 @@ extension AsyncChain3Sequence: AsyncSequence {
9497
}
9598
}
9699

100+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
97101
extension AsyncChain3Sequence: Sendable where Base1: Sendable, Base2: Sendable, Base3: Sendable { }
98102

99103
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChunkedByGroupSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1213
extension AsyncSequence {
1314
/// Creates an asynchronous sequence that creates chunks of a given `RangeReplaceableCollection`
1415
/// type by testing if elements belong in the same group.
@@ -46,6 +47,7 @@ extension AsyncSequence {
4647
/// // [10, 20, 30]
4748
/// // [10, 40, 40]
4849
/// // [10, 20]
50+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
4951
public struct AsyncChunkedByGroupSequence<Base: AsyncSequence, Collected: RangeReplaceableCollection>: AsyncSequence where Collected.Element == Base.Element {
5052
public typealias Element = Collected
5153

@@ -116,6 +118,7 @@ public struct AsyncChunkedByGroupSequence<Base: AsyncSequence, Collected: RangeR
116118
}
117119
}
118120

121+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
119122
extension AsyncChunkedByGroupSequence : Sendable where Base : Sendable, Base.Element : Sendable { }
120123

121124
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChunkedOnProjectionSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1213
extension AsyncSequence {
1314
/// Creates an asynchronous sequence that creates chunks of a given `RangeReplaceableCollection` type on the uniqueness of a given subject.
1415
@inlinable
@@ -24,6 +25,7 @@ extension AsyncSequence {
2425
}
2526

2627
/// An `AsyncSequence` that chunks on a subject when it differs from the last element.
28+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2729
public struct AsyncChunkedOnProjectionSequence<Base: AsyncSequence, Subject: Equatable, Collected: RangeReplaceableCollection>: AsyncSequence where Collected.Element == Base.Element {
2830
public typealias Element = (Subject, Collected)
2931

@@ -96,6 +98,7 @@ public struct AsyncChunkedOnProjectionSequence<Base: AsyncSequence, Subject: Equ
9698
}
9799
}
98100

101+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
99102
extension AsyncChunkedOnProjectionSequence : Sendable where Base : Sendable, Base.Element : Sendable { }
100103

101104
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift

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

12+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1213
extension AsyncSequence {
1314
/// Creates an asynchronous sequence that creates chunks of a given `RangeReplaceableCollection` type of a given count or when a signal `AsyncSequence` produces an element.
1415
public func chunks<Signal, Collected: RangeReplaceableCollection>(ofCount count: Int, or signal: Signal, into: Collected.Type) -> AsyncChunksOfCountOrSignalSequence<Self, Collected, Signal> where Collected.Element == Element {
@@ -56,6 +57,7 @@ extension AsyncSequence {
5657
}
5758

5859
/// An `AsyncSequence` that chunks elements into collected `RangeReplaceableCollection` instances by either count or a signal from another `AsyncSequence`.
60+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
5961
public struct AsyncChunksOfCountOrSignalSequence<Base: AsyncSequence, Collected: RangeReplaceableCollection, Signal: AsyncSequence>: AsyncSequence, Sendable where Collected.Element == Base.Element, Base: Sendable, Signal: Sendable, Base.Element: Sendable, Signal.Element: Sendable {
6062

6163
public typealias Element = Collected

Sources/AsyncAlgorithms/AsyncChunksOfCountSequence.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1213
extension AsyncSequence {
1314
/// Creates an asynchronous sequence that creates chunks of a given `RangeReplaceableCollection` of a given count.
1415
@inlinable
@@ -24,6 +25,7 @@ extension AsyncSequence {
2425
}
2526

2627
/// An `AsyncSequence` that chunks elements into `RangeReplaceableCollection` instances of at least a given count.
28+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2729
public struct AsyncChunksOfCountSequence<Base: AsyncSequence, Collected: RangeReplaceableCollection>: AsyncSequence where Collected.Element == Base.Element {
2830
public typealias Element = Collected
2931

@@ -85,8 +87,14 @@ public struct AsyncChunksOfCountSequence<Base: AsyncSequence, Collected: RangeRe
8587
}
8688
}
8789

90+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8891
extension AsyncChunksOfCountSequence : Sendable where Base : Sendable, Base.Element : Sendable { }
92+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8993
extension AsyncChunksOfCountSequence.Iterator : Sendable where Base.AsyncIterator : Sendable, Base.Element : Sendable { }
9094

91-
@available(*, unavailable)
92-
extension AsyncChunksOfCountSequence.Iterator: Sendable { }
95+
// The following conflicts with the above conformance. The compiler is okay with this
96+
// when 'platforms' are specified in the package manifest but not when the @available
97+
// attribute is used instead.
98+
//
99+
// @available(*, unavailable)
100+
// extension AsyncChunksOfCountSequence.Iterator: Sendable { }

0 commit comments

Comments
 (0)