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

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

[email protected]

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

Lines changed: 4 additions & 0 deletions
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

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.
@@ -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

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

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>(
@@ -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

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
@@ -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 { }

0 commit comments

Comments
 (0)