diff --git a/Sources/Tracing/Tracer.swift b/Sources/Tracing/Tracer.swift index 4717ad6c..a4bfbe05 100644 --- a/Sources/Tracing/Tracer.swift +++ b/Sources/Tracing/Tracer.swift @@ -97,8 +97,8 @@ extension Tracer { // ==== ---------------------------------------------------------------------------------------------------------------- // MARK: Starting spans: Task-local Baggage propagation -#if swift(>=5.5) -@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) +#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`, /// 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..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,8 +219,8 @@ final class TracerTests: XCTestCase { #endif } - #if swift(>=5.5) - @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) + #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. func testAsync(_ operation: @escaping () async throws -> Void) rethrows {