Skip to content

Commit 249fceb

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 57b0814 commit 249fceb

File tree

57 files changed

+145
-14
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
-14
lines changed

Package.swift

-6
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
],

[email protected]

-6
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

+3
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

+2
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

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
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>(
2223
_ s1: Base1,
2324
_ s2: Base2
@@ -27,6 +28,7 @@ public func chain<Base1: AsyncSequence, Base2: AsyncSequence>(
2728

2829
/// A concatenation of two asynchronous sequences with the same element type.
2930
@frozen
31+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
3032
public struct AsyncChain2Sequence<Base1: AsyncSequence, Base2: AsyncSequence> where Base1.Element == Base2.Element {
3133
@usableFromInline
3234
let base1: Base1
@@ -41,6 +43,7 @@ public struct AsyncChain2Sequence<Base1: AsyncSequence, Base2: AsyncSequence> wh
4143
}
4244
}
4345

46+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
4447
extension AsyncChain2Sequence: AsyncSequence {
4548
public typealias Element = Base1.Element
4649

@@ -82,6 +85,7 @@ extension AsyncChain2Sequence: AsyncSequence {
8285
}
8386
}
8487

88+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8589
extension AsyncChain2Sequence: Sendable where Base1: Sendable, Base2: Sendable {}
8690

8791
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChain3Sequence.swift

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
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>(
2324
_ s1: Base1,
2425
_ s2: Base2,
@@ -29,6 +30,7 @@ public func chain<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequen
2930

3031
/// A concatenation of three asynchronous sequences with the same element type.
3132
@frozen
33+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
3234
public struct AsyncChain3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>
3335
where Base1.Element == Base2.Element, Base1.Element == Base3.Element {
3436
@usableFromInline
@@ -48,6 +50,7 @@ where Base1.Element == Base2.Element, Base1.Element == Base3.Element {
4850
}
4951
}
5052

53+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
5154
extension AsyncChain3Sequence: AsyncSequence {
5255
public typealias Element = Base1.Element
5356

@@ -99,6 +102,7 @@ extension AsyncChain3Sequence: AsyncSequence {
99102
}
100103
}
101104

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

104108
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChunkedByGroupSequence.swift

+3
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.
@@ -51,6 +52,7 @@ extension AsyncSequence {
5152
/// // [10, 20, 30]
5253
/// // [10, 40, 40]
5354
/// // [10, 20]
55+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
5456
public struct AsyncChunkedByGroupSequence<Base: AsyncSequence, Collected: RangeReplaceableCollection>: AsyncSequence
5557
where Collected.Element == Base.Element {
5658
public typealias Element = Collected
@@ -121,6 +123,7 @@ where Collected.Element == Base.Element {
121123
}
122124
}
123125

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

126129
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChunkedOnProjectionSequence.swift

+3
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
@@ -29,6 +30,7 @@ extension AsyncSequence {
2930
}
3031

3132
/// An `AsyncSequence` that chunks on a subject when it differs from the last element.
33+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
3234
public struct AsyncChunkedOnProjectionSequence<
3335
Base: AsyncSequence,
3436
Subject: Equatable,
@@ -104,6 +106,7 @@ public struct AsyncChunkedOnProjectionSequence<
104106
}
105107
}
106108

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

109112
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift

+2
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>(
@@ -78,6 +79,7 @@ extension AsyncSequence {
7879
}
7980

8081
/// An `AsyncSequence` that chunks elements into collected `RangeReplaceableCollection` instances by either count or a signal from another `AsyncSequence`.
82+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8183
public struct AsyncChunksOfCountOrSignalSequence<
8284
Base: AsyncSequence,
8385
Collected: RangeReplaceableCollection,

Sources/AsyncAlgorithms/AsyncChunksOfCountSequence.swift

+10-2
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
@@ -27,6 +28,7 @@ extension AsyncSequence {
2728
}
2829

2930
/// An `AsyncSequence` that chunks elements into `RangeReplaceableCollection` instances of at least a given count.
31+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
3032
public struct AsyncChunksOfCountSequence<Base: AsyncSequence, Collected: RangeReplaceableCollection>: AsyncSequence
3133
where Collected.Element == Base.Element {
3234
public typealias Element = Collected
@@ -89,8 +91,14 @@ where Collected.Element == Base.Element {
8991
}
9092
}
9193

94+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
9295
extension AsyncChunksOfCountSequence: Sendable where Base: Sendable, Base.Element: Sendable {}
96+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
9397
extension AsyncChunksOfCountSequence.Iterator: Sendable where Base.AsyncIterator: Sendable, Base.Element: Sendable {}
9498

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

Sources/AsyncAlgorithms/AsyncCompactedSequence.swift

+3
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
/// Returns a new `AsyncSequence` that iterates over every non-nil element from the
1415
/// original `AsyncSequence`.
@@ -28,6 +29,7 @@ extension AsyncSequence {
2829
/// An `AsyncSequence` that iterates over every non-nil element from the original
2930
/// `AsyncSequence`.
3031
@frozen
32+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
3133
public struct AsyncCompactedSequence<Base: AsyncSequence, Element>: AsyncSequence
3234
where Base.Element == Element? {
3335

@@ -66,6 +68,7 @@ where Base.Element == Element? {
6668
}
6769
}
6870

71+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
6972
extension AsyncCompactedSequence: Sendable where Base: Sendable, Base.Element: Sendable {}
7073

7174
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncExclusiveReductionsSequence.swift

+4
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
/// Returns an asynchronous sequence containing the accumulated results of combining the
1415
/// elements of the asynchronous sequence using the given closure.
@@ -57,6 +58,7 @@ extension AsyncSequence {
5758
/// An asynchronous sequence of applying a transform to the element of an asynchronous sequence and the
5859
/// previously transformed result.
5960
@frozen
61+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
6062
public struct AsyncExclusiveReductionsSequence<Base: AsyncSequence, Element> {
6163
@usableFromInline
6264
let base: Base
@@ -75,6 +77,7 @@ public struct AsyncExclusiveReductionsSequence<Base: AsyncSequence, Element> {
7577
}
7678
}
7779

80+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
7881
extension AsyncExclusiveReductionsSequence: AsyncSequence {
7982
/// The iterator for an `AsyncExclusiveReductionsSequence` instance.
8083
@frozen
@@ -119,6 +122,7 @@ extension AsyncExclusiveReductionsSequence: AsyncSequence {
119122
}
120123
}
121124

125+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
122126
extension AsyncExclusiveReductionsSequence: Sendable where Base: Sendable, Element: Sendable {}
123127

124128
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncInclusiveReductionsSequence.swift

+4
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
/// Returns an asynchronous sequence containing the accumulated results of combining the
1415
/// elements of the asynchronous sequence using the given closure.
@@ -39,6 +40,7 @@ extension AsyncSequence {
3940
/// An asynchronous sequence containing the accumulated results of combining the
4041
/// elements of the asynchronous sequence using a given closure.
4142
@frozen
43+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
4244
public struct AsyncInclusiveReductionsSequence<Base: AsyncSequence> {
4345
@usableFromInline
4446
let base: Base
@@ -53,6 +55,7 @@ public struct AsyncInclusiveReductionsSequence<Base: AsyncSequence> {
5355
}
5456
}
5557

58+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
5659
extension AsyncInclusiveReductionsSequence: AsyncSequence {
5760
public typealias Element = Base.Element
5861

@@ -95,6 +98,7 @@ extension AsyncInclusiveReductionsSequence: AsyncSequence {
9598
}
9699
}
97100

101+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
98102
extension AsyncInclusiveReductionsSequence: Sendable where Base: Sendable {}
99103

100104
@available(*, unavailable)

Sources/AsyncAlgorithms/AsyncJoinedBySeparatorSequence.swift

+3
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 where Element: AsyncSequence {
1314
/// Concatenate an `AsyncSequence` of `AsyncSequence` elements with a separator.
1415
@inlinable
@@ -20,6 +21,7 @@ extension AsyncSequence where Element: AsyncSequence {
2021
}
2122

2223
/// An `AsyncSequence` that concatenates `AsyncSequence` elements with a separator.
24+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2325
public struct AsyncJoinedBySeparatorSequence<Base: AsyncSequence, Separator: AsyncSequence>: AsyncSequence
2426
where Base.Element: AsyncSequence, Separator.Element == Base.Element.Element {
2527
public typealias Element = Base.Element.Element
@@ -143,6 +145,7 @@ where Base.Element: AsyncSequence, Separator.Element == Base.Element.Element {
143145
}
144146
}
145147

148+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
146149
extension AsyncJoinedBySeparatorSequence: Sendable
147150
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Separator: Sendable {}
148151

Sources/AsyncAlgorithms/AsyncJoinedSequence.swift

+3
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 where Element: AsyncSequence {
1314
/// Concatenate an `AsyncSequence` of `AsyncSequence` elements
1415
@inlinable
@@ -19,6 +20,7 @@ extension AsyncSequence where Element: AsyncSequence {
1920

2021
/// An `AsyncSequence` that concatenates`AsyncSequence` elements
2122
@frozen
23+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
2224
public struct AsyncJoinedSequence<Base: AsyncSequence>: AsyncSequence where Base.Element: AsyncSequence {
2325
public typealias Element = Base.Element.Element
2426
public typealias AsyncIterator = Iterator
@@ -90,6 +92,7 @@ public struct AsyncJoinedSequence<Base: AsyncSequence>: AsyncSequence where Base
9092
}
9193
}
9294

95+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
9396
extension AsyncJoinedSequence: Sendable
9497
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable {}
9598

0 commit comments

Comments
 (0)