Skip to content

Commit

Permalink
Adjust API Availability for Structured Concurrency Backport (#58)
Browse files Browse the repository at this point in the history
* Change API availability for concurrency backport

* Adjust all relevant availibiltiy checks
  • Loading branch information
moritzsternemann authored Jan 19, 2022
1 parent 7ee6ac3 commit 243c601
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Sources/Tracing/Tracer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
20 changes: 10 additions & 10 deletions Tests/TracingTests/TracerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}

Expand Down Expand Up @@ -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.")
}

Expand Down Expand Up @@ -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.")
}

Expand Down Expand Up @@ -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.")
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 243c601

Please sign in to comment.