Skip to content

Commit a2f1abe

Browse files
authored
Drop Swift 5.9 and 5.10 support (apple#193)
1 parent 71b0066 commit a2f1abe

File tree

8 files changed

+8
-68
lines changed

8 files changed

+8
-68
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ jobs:
1414
name: Unit tests
1515
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
1616
with:
17-
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
18-
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
1917
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2018
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2119
linux_6_2_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
22-
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
20+
linux_nightly_next_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2321
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2422
windows_6_0_enabled: true
2523
windows_6_1_enabled: true
24+
windows_6_2_enabled: true
2625
windows_nightly_next_enabled: true
2726
windows_nightly_main_enabled: true
2827
windows_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2928
windows_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
29+
windows_6_2_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
3030
windows_nightly_next_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
3131
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
3232

.github/workflows/pull_request.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,19 @@ jobs:
2020
name: Unit tests
2121
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
2222
with:
23-
24-
# NOTE: Aug 5, 2025. We've determined SPM has bugs for `condition: .when(platforms: [.somePlatform])`
25-
# that incorrectly ignore the condition and import anyways for unintended platforms.
26-
#
27-
# See https://github.com/apple/swift-distributed-tracing/actions/runs/16578688393/job/46920025183?pr=174
28-
# for an example of the resulting build failure.
29-
#
30-
# This is documented as a bug in Swift 5.10, resolved in Swift 6.
31-
# See FB14859516.
32-
# See also https://forums.swift.org/t/do-swiftpm-conditional-target-dependencies-work/74047
33-
#
34-
# Given this, the explicit target dependency check is disabled for Swift versions before Swift 6.
35-
36-
# Intentionally disabled:
37-
#
38-
# linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
39-
# linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
40-
4123
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
4224
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
4325
linux_6_2_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
44-
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
26+
linux_nightly_next_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
4527
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
4628
windows_6_0_enabled: true
4729
windows_6_1_enabled: true
30+
windows_6_2_enabled: true
4831
windows_nightly_next_enabled: true
4932
windows_nightly_main_enabled: true
5033
windows_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
5134
windows_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
35+
windows_6_2_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
5236
windows_nightly_next_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
5337
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
5438

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version:6.0
22
import PackageDescription
33

44
let package = Package(

Sources/Tracing/Tracer.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ public func withSpan<T>(
321321
/// - operation: The operation that this span measures.
322322
/// - Returns: the value returned by `operation`.
323323
/// - Throws: the error the `operation` throws (if any).
324-
#if compiler(>=6.0)
325324
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
326325
public func withSpan<T, Instant: TracerInstant>(
327326
_ operationName: String,
@@ -346,11 +345,8 @@ public func withSpan<T, Instant: TracerInstant>(
346345
try await operation(anySpan)
347346
}
348347
}
349-
#endif
350348

351-
#if compiler(>=6.0)
352349
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
353-
#endif
354350
/// Start a new span and automatically end when the operation completes,
355351
/// including recording the error in case the operation throws.
356352
///
@@ -413,7 +409,6 @@ public func withSpan<T, Instant: TracerInstant>(
413409
/// - operation: The operation that this span measures.
414410
/// - Returns: the value returned by `operation`.
415411
/// - Throws: the error the `operation` throws (if any).
416-
#if compiler(>=6.0)
417412
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
418413
public func withSpan<T>(
419414
_ operationName: String,
@@ -437,11 +432,8 @@ public func withSpan<T>(
437432
try await operation(anySpan)
438433
}
439434
}
440-
#endif
441435

442-
#if compiler(>=6.0)
443436
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
444-
#endif
445437
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
446438
/// Start a new span and automatically end when the operation completes,
447439
/// including recording the error in case the operation throws.
@@ -502,7 +494,6 @@ public func withSpan<T>(
502494
/// - operation: The operation that this span should be measuring
503495
/// - Returns: the value returned by `operation`
504496
/// - Throws: the error the `operation` has thrown (if any)
505-
#if compiler(>=6.0)
506497
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
507498
public func withSpan<T>(
508499
_ operationName: String,
@@ -527,11 +518,8 @@ public func withSpan<T>(
527518
try await operation(anySpan)
528519
}
529520
}
530-
#endif
531521

532-
#if compiler(>=6.0)
533522
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
534-
#endif
535523
/// Start a new span and automatically end when the operation completes,
536524
/// including recording the error in case the operation throws.
537525
///

Sources/Tracing/TracerProtocol+Legacy.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ extension LegacyTracer {
296296
///
297297
/// - Parameters:
298298
/// - operationName: The name of the operation being traced. This may be a handler function, a database call, and so on.
299+
/// - instant: the time instant at which the span started.
299300
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
300301
/// - kind: The ``SpanKind`` of the new ``Span``.
301302
/// - isolation: Defaulted parameter for inheriting isolation of calling actor.
@@ -305,7 +306,6 @@ extension LegacyTracer {
305306
/// - operation: The operation that this span measures.
306307
/// - Returns: the value returned by `operation`.
307308
/// - Throws: the error the `operation` throws (if any).
308-
#if compiler(>=6.0)
309309
public func withAnySpan<T, Instant: TracerInstant>(
310310
_ operationName: String,
311311
at instant: @autoclosure () -> Instant,
@@ -336,12 +336,9 @@ extension LegacyTracer {
336336
throw error // rethrow
337337
}
338338
}
339-
#endif
340339

341-
#if compiler(>=6.0)
342340
// swift-format-ignore: Spacing // fights with formatter
343341
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
344-
#endif
345342
/// Start a new span and automatically end when the operation completes,
346343
/// including recording the error in case the operation throws.
347344
///
@@ -411,7 +408,6 @@ extension LegacyTracer {
411408
/// - operation: The operation that this span measures.
412409
/// - Returns: the value returned by `operation`.
413410
/// - Throws: the error the `operation` throws (if any).
414-
#if compiler(>=6.0)
415411
public func withAnySpan<T>(
416412
_ operationName: String,
417413
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
@@ -441,12 +437,9 @@ extension LegacyTracer {
441437
throw error // rethrow
442438
}
443439
}
444-
#endif
445440

446-
#if compiler(>=6.0)
447441
// swift-format-ignore: Spacing // fights with formatter
448442
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
449-
#endif
450443
/// Start a new span and automatically end when the operation completes,
451444
/// including recording the error in case the operation throws.
452445
///
@@ -629,7 +622,6 @@ extension Tracer {
629622
/// - operation: The operation that this span measures.
630623
/// - Returns: the value returned by `operation`.
631624
/// - Throws: the error the `operation` throws (if any).
632-
#if compiler(>=6.0)
633625
public func withAnySpan<T>(
634626
_ operationName: String,
635627
at instant: @autoclosure () -> some TracerInstant = DefaultTracerClock.now,
@@ -653,12 +645,9 @@ extension Tracer {
653645
try await operation(span)
654646
}
655647
}
656-
#endif
657648

658-
#if compiler(>=6.0)
659649
// swift-format-ignore: Spacing // fights with formatter
660650
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
661-
#endif
662651
/// Start a new span and automatically end when the operation completes,
663652
/// including recording the error in case the operation throws.
664653
///

Sources/Tracing/TracerProtocol.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,13 @@ extension Tracer {
251251
/// - operationName: The name of the operation being traced. This may be a handler function, a database call, and so on.
252252
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
253253
/// - kind: The ``SpanKind`` of the new ``Span``.
254-
/// - instant: the time instant at which the span started.
255254
/// - isolation: Defaulted parameter for inheriting isolation of calling actor.
256255
/// - function: The function name in which the span started.
257256
/// - fileID: The `fileID` where the span started.
258257
/// - line: The file line where the span started.
259258
/// - operation: The operation that this span measures.
260259
/// - Returns: the value returned by `operation`.
261260
/// - Throws: the error the `operation` throws (if any).
262-
#if compiler(>=6.0)
263261
public func withSpan<T>(
264262
_ operationName: String,
265263
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
@@ -289,12 +287,9 @@ extension Tracer {
289287
throw error // rethrow
290288
}
291289
}
292-
#endif
293290

294-
#if compiler(>=6.0)
295291
// swift-format-ignore: Spacing // fights with formatter
296292
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
297-
#endif
298293
public func withSpan<T>(
299294
_ operationName: String,
300295
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
@@ -347,7 +342,6 @@ extension Tracer {
347342
/// - operation: The operation that this span measures.
348343
/// - Returns: the value returned by `operation`.
349344
/// - Throws: the error the `operation` throws (if any).
350-
#if compiler(>=6.0)
351345
public func withSpan<T>(
352346
_ operationName: String,
353347
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
@@ -378,12 +372,9 @@ extension Tracer {
378372
throw error // rethrow
379373
}
380374
}
381-
#endif
382375

383-
#if compiler(>=6.0)
384376
// swift-format-ignore: Spacing // fights with formatter
385377
@_disfavoredOverload @available(*, deprecated, message: "Prefer #isolation version of this API")
386-
#endif
387378
/// Start a new span and automatically end it when the operation completes,
388379
/// including recording the error in case the operation throws.
389380
///

Tests/TracingTests/DynamicTracepointTracerTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ final class DynamicTracepointTestTracer: LegacyTracer {
174174
}
175175

176176
private func shouldRecord(tracepoint: TracepointID) -> Bool {
177-
#if canImport(_Concurrency)
178177
if self.isActive(tracepoint: tracepoint) {
179178
// this tracepoint was specifically activated!
180179
return true
@@ -193,9 +192,6 @@ final class DynamicTracepointTestTracer: LegacyTracer {
193192
// there is some active trace already, so we should record as well
194193
// TODO: this logic may need to become smarter
195194
return true
196-
#else
197-
return false
198-
#endif
199195
}
200196

201197
func isActive(tracepoint: TracepointID) -> Bool {

Tests/TracingTests/TracerTests.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ final class TracerTests: XCTestCase {
108108
}
109109

110110
func testWithSpan_automaticBaggagePropagation_sync() throws {
111-
#if canImport(_Concurrency)
112111
guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else {
113112
throw XCTSkip("Task locals are not supported on this platform.")
114113
}
@@ -133,11 +132,9 @@ final class TracerTests: XCTestCase {
133132

134133
XCTAssertEqual(value, "world")
135134
XCTAssertTrue(spanEnded)
136-
#endif
137135
}
138136

139137
func testWithSpan_automaticBaggagePropagation_sync_throws() throws {
140-
#if canImport(_Concurrency)
141138
guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else {
142139
throw XCTSkip("Task locals are not supported on this platform.")
143140
}
@@ -163,11 +160,9 @@ final class TracerTests: XCTestCase {
163160
return
164161
}
165162
XCTFail("Should have thrown")
166-
#endif
167163
}
168164

169165
func testWithSpan_automaticBaggagePropagation_async() throws {
170-
#if canImport(_Concurrency)
171166
guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else {
172167
throw XCTSkip("Task locals are not supported on this platform.")
173168
}
@@ -194,7 +189,6 @@ final class TracerTests: XCTestCase {
194189
XCTAssertEqual(value, "world")
195190
XCTAssertTrue(spanEnded.withValue { $0 })
196191
}
197-
#endif
198192
}
199193

200194
func testWithSpan_enterFromNonAsyncCode_passBaggage_asyncOperation() throws {
@@ -321,7 +315,6 @@ final class TracerTests: XCTestCase {
321315
}
322316

323317
func testWithSpan_recordErrorWithAttributes() throws {
324-
#if canImport(_Concurrency)
325318
guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else {
326319
throw XCTSkip("Task locals are not supported on this platform.")
327320
}
@@ -348,7 +341,6 @@ final class TracerTests: XCTestCase {
348341
XCTAssertEqual(error as! ExampleSpanError, errorToThrow)
349342
let attrs = endedSpan!.recordedErrors.first!.1
350343
XCTAssertEqual(attrs, attrsForError)
351-
#endif
352344
}
353345

354346
func testWithSpanSignatures() {

0 commit comments

Comments
 (0)