From 49cedd463c2909c477e3f84db7b721b64f60cf5a Mon Sep 17 00:00:00 2001 From: Tony Allevato Date: Wed, 8 May 2024 12:24:09 -0700 Subject: [PATCH] Annotate the test observer with `@MainActor` where needed to be concurrency-safe. PiperOrigin-RevId: 631886302 (cherry picked from commit 36992305ad9a4f01aeea907c14838031cb80d38a) --- tools/test_observer/BazelXMLTestObserver.swift | 1 + tools/test_observer/BazelXMLTestObserverRegistration.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/test_observer/BazelXMLTestObserver.swift b/tools/test_observer/BazelXMLTestObserver.swift index 7995382e1..9941b7a7e 100644 --- a/tools/test_observer/BazelXMLTestObserver.swift +++ b/tools/test_observer/BazelXMLTestObserver.swift @@ -29,6 +29,7 @@ public final class BazelXMLTestObserver: NSObject { /// /// If the `XML_OUTPUT_FILE` environment variable is not set or the file at that path could not be /// created and opened for writing, the value of this property will be nil. + @MainActor public static let `default`: BazelXMLTestObserver? = { guard let outputPath = ProcessInfo.processInfo.environment["XML_OUTPUT_FILE"], diff --git a/tools/test_observer/BazelXMLTestObserverRegistration.swift b/tools/test_observer/BazelXMLTestObserverRegistration.swift index 851b8806d..ddecba817 100644 --- a/tools/test_observer/BazelXMLTestObserverRegistration.swift +++ b/tools/test_observer/BazelXMLTestObserverRegistration.swift @@ -19,6 +19,7 @@ /// The principal class in an XCTest bundle on Darwin-based platforms, which registers the /// XML-generating observer with the XCTest observation center when the bundle is loaded. @objc(BazelXMLTestObserverRegistration) + @MainActor public final class BazelXMLTestObserverRegistration: NSObject { @objc public override init() { super.init()