From b9eae04d3c760e3c6ccfa34bafea36e6a4079bd0 Mon Sep 17 00:00:00 2001 From: Moritz Sternemann Date: Sun, 16 Jan 2022 19:39:08 +0100 Subject: [PATCH 1/2] Change API availability for concurrency backport --- Sources/Tracing/Tracer.swift | 2 +- Tests/TracingTests/TracerTests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Tracing/Tracer.swift b/Sources/Tracing/Tracer.swift index 4717ad6c..df674dec 100644 --- a/Sources/Tracing/Tracer.swift +++ b/Sources/Tracing/Tracer.swift @@ -98,7 +98,7 @@ extension Tracer { // MARK: Starting spans: Task-local Baggage propagation #if swift(>=5.5) -@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension Tracer { /// Execute the given operation within a newly created `Span`, /// started as a child of the currently stored task local `Baggage.current` or as a root span if `nil`. diff --git a/Tests/TracingTests/TracerTests.swift b/Tests/TracingTests/TracerTests.swift index 23ef0f8d..7c42e141 100644 --- a/Tests/TracingTests/TracerTests.swift +++ b/Tests/TracingTests/TracerTests.swift @@ -220,7 +220,7 @@ final class TracerTests: XCTestCase { } #if swift(>=5.5) - @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) /// Helper method to execute async operations until we can use async tests (currently incompatible with the generated LinuxMain file). /// - Parameter operation: The operation to test. func testAsync(_ operation: @escaping () async throws -> Void) rethrows { From 7cf05a2b35119eebf017695b4fcf20f9fc2b5262 Mon Sep 17 00:00:00 2001 From: Moritz Sternemann Date: Tue, 18 Jan 2022 23:33:08 +0100 Subject: [PATCH 2/2] Adjust all relevant availibiltiy checks --- Sources/Tracing/Tracer.swift | 2 +- Tests/TracingTests/TracerTests.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/Tracing/Tracer.swift b/Sources/Tracing/Tracer.swift index df674dec..a4bfbe05 100644 --- a/Sources/Tracing/Tracer.swift +++ b/Sources/Tracing/Tracer.swift @@ -97,7 +97,7 @@ extension Tracer { // ==== ---------------------------------------------------------------------------------------------------------------- // MARK: Starting spans: Task-local Baggage propagation -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension Tracer { /// Execute the given operation within a newly created `Span`, diff --git a/Tests/TracingTests/TracerTests.swift b/Tests/TracingTests/TracerTests.swift index 7c42e141..02141cde 100644 --- a/Tests/TracingTests/TracerTests.swift +++ b/Tests/TracingTests/TracerTests.swift @@ -98,8 +98,8 @@ final class TracerTests: XCTestCase { } func testWithSpan_automaticBaggagePropagation_sync() throws { - #if swift(>=5.5) - guard #available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) else { + #if swift(>=5.5) && canImport(_Concurrency) + guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else { throw XCTSkip("Task locals are not supported on this platform.") } @@ -127,8 +127,8 @@ final class TracerTests: XCTestCase { } func testWithSpan_automaticBaggagePropagation_sync_throws() throws { - #if swift(>=5.5) - guard #available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) else { + #if swift(>=5.5) && canImport(_Concurrency) + guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else { throw XCTSkip("Task locals are not supported on this platform.") } @@ -157,8 +157,8 @@ final class TracerTests: XCTestCase { } func testWithSpan_automaticBaggagePropagation_async() throws { - #if swift(>=5.5) - guard #available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) else { + #if swift(>=5.5) && canImport(_Concurrency) + guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else { throw XCTSkip("Task locals are not supported on this platform.") } @@ -188,8 +188,8 @@ final class TracerTests: XCTestCase { } func testWithSpan_automaticBaggagePropagation_async_throws() throws { - #if swift(>=5.5) - guard #available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) else { + #if swift(>=5.5) && canImport(_Concurrency) + guard #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) else { throw XCTSkip("Task locals are not supported on this platform.") } @@ -219,7 +219,7 @@ final class TracerTests: XCTestCase { #endif } - #if swift(>=5.5) + #if swift(>=5.5) && canImport(_Concurrency) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) /// Helper method to execute async operations until we can use async tests (currently incompatible with the generated LinuxMain file). /// - Parameter operation: The operation to test.