Skip to content

Commit

Permalink
Fix CI issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Sep 23, 2024
1 parent d016cb6 commit 89c71e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
12 changes: 10 additions & 2 deletions Sources/OpenSwiftUICore/Log/Signpost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -138,6 +139,9 @@ package struct Signpost {
defer { os_signpost(.end, log: _signpostLog, name: name, signpostID: id) }
return closure()
}
#else
return closure()
#endif
}

@_transparent
Expand All @@ -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):
Expand All @@ -161,8 +166,12 @@ package struct Signpost {
defer { os_signpost(.end, log: _signpostLog, name: name, signpostID: id) }
return closure()
}
#else
return closure()
#endif
}

#if canImport(Darwin)
@_transparent
package func traceEvent(
type: OSSignpostType,
Expand All @@ -173,7 +182,6 @@ package struct Signpost {
guard isEnabled else {
return
}
#if canImport(Darwin)
let id = OSSignpostID.makeExclusiveID(object)
let args = args()

Expand All @@ -185,8 +193,8 @@ package struct Signpost {
case let .os_log(name):
os_signpost(type, log: _signpostLog, name: name, signpostID: id, message, args)
}
#endif
}
#endif

#if canImport(Darwin)
private func _primitive(
Expand Down
6 changes: 4 additions & 2 deletions Sources/OpenSwiftUICore/Util/ThreadUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Audited for RELEASE_2024
// Status: Complete

@preconcurrency import Foundation
import Foundation

final package class ThreadSpecific<T> {
var key: pthread_key_t
Expand Down Expand Up @@ -54,7 +54,7 @@ final package class ThreadSpecific<T> {
package func onMainThread(do body: @escaping () -> Void) {
#if os(WASI)
// See #76: Thread and RunLoopMode.common is not available on WASI currently
block()
body()
#else
if Thread.isMainThread {
body()
Expand All @@ -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
}

0 comments on commit 89c71e3

Please sign in to comment.