Skip to content

Commit a6fc1e2

Browse files
Don't use CoreFoundation when building with corelibs-foundation
The use of CoreFoundation while building with corelibs-foundation causes an unintentional dependency to the CoreFoundation framework due to the lack of way to distinguish corelibs-foundation's CoreFoundation from CoreFoundation.framework. From macOS 13, CoreFoundation started to depend on CoreServicesInternal, and it causes a transitive dependency from CoreFoundation.framework to Foundation.framework. ┌-> CoreFoundation --[NEW]--> CoreServicesInternal -┐ └-- Foundation <------------- CFNetwork ------------┘ Thus corelibs-xctest started to depend on Foundation.framework unintentionally from macOS 13. This unintentional dependency is problematic because it causes a duplicate loading of the Objective-C classes of Foundation from the corelibs-foundation and Foundation.framework even though we explicitly imports corelibs-foundation by `import SwiftFoundation`. This patch removes the use of CoreFoundation when building with corelibs-foundation based on the `USE_FOUNDATION_FRAMEWORK` definition.
1 parent d9da540 commit a6fc1e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/XCTest/Public/Asynchronous/XCTWaiter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// XCTWaiter.swift
1111
//
1212

13-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
13+
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && USE_FOUNDATION_FRAMEWORK
1414
import CoreFoundation
1515
#endif
1616

@@ -429,7 +429,7 @@ private extension XCTWaiter {
429429

430430
func cancelPrimitiveWait() {
431431
guard let runLoop = runLoop else { return }
432-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
432+
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && USE_FOUNDATION_FRAMEWORK
433433
CFRunLoopStop(runLoop.getCFRunLoop())
434434
#else
435435
runLoop._stop()

0 commit comments

Comments
 (0)