From fe170a06673cf1f2ff110ace2de448cb775b744a Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 16 Jul 2026 00:15:59 +0800 Subject: [PATCH] Fix compatibility test import flag parsing --- Package.resolved | 2 +- Package.swift | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Package.resolved b/Package.resolved index dc2fb8b77..8c2de6b74 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "536952dcd1e42c1f24dcd5e8e77be318da6236302a603374019cc568ef4d3c57", + "originHash" : "13c69621d8a7bc34851161e1b06d0ef0e1304c504885cc1f439a9d38564c5f97", "pins" : [ { "identity" : "darwinprivateframeworks", diff --git a/Package.swift b/Package.swift index 1421cea8a..ba4813716 100644 --- a/Package.swift +++ b/Package.swift @@ -471,6 +471,12 @@ extension [Platform] { } extension [SwiftSetting] { + fileprivate func compatibilityTestSettings() -> Self { + self + (compatibilityTestCondition ? [ + .unsafeFlags(["-I\(Context.packageDirectory)/Example/Modules/Platform/cocoa"]), + ] : []) + } + /// Settings which define commonly-used OS availability macros. /// /// These leverage a pseudo-experimental feature in the Swift compiler for @@ -655,9 +661,7 @@ let openSwiftUITestsSupportTarget = Target.target( dependencies: (compatibilityTestCondition ? [] : ["OpenSwiftUI"]), cSettings: sharedCSettings, cxxSettings: sharedCxxSettings, - swiftSettings: sharedSwiftSettings + (compatibilityTestCondition ? [ - .unsafeFlags(["-I", "\(Context.packageDirectory)/Example/Modules/Platform/cocoa"]), - ] : []) + swiftSettings: sharedSwiftSettings.compatibilityTestSettings() ) let openSwiftUIExtensionTarget = Target.target( @@ -691,9 +695,7 @@ let openSwiftUICompatibilityTestTarget = Target.testTarget( exclude: ["README.md"], cSettings: sharedCSettings, cxxSettings: sharedCxxSettings, - swiftSettings: sharedSwiftSettings + (compatibilityTestCondition ? [ - .unsafeFlags(["-I", "\(Context.packageDirectory)/Example/Modules/Platform/cocoa"]), - ] : []) + swiftSettings: sharedSwiftSettings.compatibilityTestSettings() ) // MARK: - OpenSwiftUIBridge Target