diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index 5045db9c..c18b3656 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -32,12 +32,14 @@ jobs: - name: Run compatibility tests on OpenSwiftUI + macOS run: | swift test \ + --filter OpenSwiftUICompatibilityTests \ --build-path .build-compatibility-test-debug env: OPENSWIFTUI_COMPATIBILITY_TEST: 0 - name: Run compatibility tests on SwiftUI + macOS run: | swift test \ + --filter OpenSwiftUICompatibilityTests \ --build-path .build-compatibility-test-debug env: OPENSWIFTUI_COMPATIBILITY_TEST: 1 @@ -69,6 +71,7 @@ jobs: run: swift --version - name: Run compatibility tests on OpenSwiftUI + iOS run: | + # FIXME: xcodebuild will run all test targets. xcodebuild test \ -scheme OpenSwiftUI \ -configuration Debug \ diff --git a/Sources/OpenSwiftUICore/Log/Signpost.swift b/Sources/OpenSwiftUICore/Log/Signpost.swift index 213bf933..d9b749ee 100644 --- a/Sources/OpenSwiftUICore/Log/Signpost.swift +++ b/Sources/OpenSwiftUICore/Log/Signpost.swift @@ -123,6 +123,7 @@ package struct Signpost { guard isEnabled else { return closure() } + #if canImport(Darwin) let id = OSSignpostID.makeExclusiveID(object) switch style { case let .kdebug(code): @@ -138,6 +139,9 @@ package struct Signpost { defer { os_signpost(.end, log: _signpostLog, name: name, signpostID: id) } return closure() } + #else + return closure() + #endif } @_transparent @@ -150,6 +154,7 @@ package struct Signpost { guard isEnabled else { return closure() } + #if canImport(Darwin) let id = OSSignpostID.makeExclusiveID(object) switch style { case let .kdebug(code): @@ -161,6 +166,9 @@ package struct Signpost { defer { os_signpost(.end, log: _signpostLog, name: name, signpostID: id) } return closure() } + #else + return closure() + #endif } @_transparent diff --git a/Sources/OpenSwiftUICore/Util/ThreadUtils.swift b/Sources/OpenSwiftUICore/Util/ThreadUtils.swift index 7a0987da..4301fed9 100644 --- a/Sources/OpenSwiftUICore/Util/ThreadUtils.swift +++ b/Sources/OpenSwiftUICore/Util/ThreadUtils.swift @@ -5,7 +5,7 @@ // Audited for RELEASE_2024 // Status: Complete -@preconcurrency import Foundation +import Foundation final package class ThreadSpecific { var key: pthread_key_t @@ -68,7 +68,9 @@ package func onMainThread(do body: @escaping () -> Void) { } package func mainThreadPrecondition() { + #if !os(WASI) guard Thread.isMainThread else { fatalError("calling into OpenSwiftUI on a non-main thread is not supported") } + #endif }