Skip to content

Commit aeaab78

Browse files
authored
[6.0.0][PackageModel] Inject swift-testing flags only if toolchain is target… (#7922)
- Explanation: Fixes a bug where swift and linker flags for swift-testing were injected into `extraFlags` of a toolchain that was targeting WASM but used macOS to build. - Main Branch PR: #7920 - 6.0 Branch PR: #7921 - Resolves: #7919 - Resolves: rdar://134714404 - Risk: Low (only affects cross-compilation to WASM). - Reviewed By: @bnbarham - Testing: Manual testing since this is not currently possible to test automatically.
1 parent db1e31e commit aeaab78

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Sources/PackageModel/UserToolchain.swift

+9-8
Original file line numberDiff line numberDiff line change
@@ -660,14 +660,15 @@ public final class UserToolchain: Toolchain {
660660
var swiftCompilerFlags: [String] = []
661661
var extraLinkerFlags: [String] = []
662662

663-
#if os(macOS)
664-
let (swiftCFlags, linkerFlags) = Self.deriveMacOSSpecificSwiftTestingFlags(
665-
derivedSwiftCompiler: swiftCompilers.compile,
666-
fileSystem: fileSystem
667-
)
668-
swiftCompilerFlags += swiftCFlags
669-
extraLinkerFlags += linkerFlags
670-
#endif
663+
if triple.isMacOSX {
664+
let (swiftCFlags, linkerFlags) = Self.deriveMacOSSpecificSwiftTestingFlags(
665+
derivedSwiftCompiler: swiftCompilers.compile,
666+
fileSystem: fileSystem
667+
)
668+
669+
swiftCompilerFlags += swiftCFlags
670+
extraLinkerFlags += linkerFlags
671+
}
671672

672673
swiftCompilerFlags += try Self.deriveSwiftCFlags(
673674
triple: triple,

0 commit comments

Comments
 (0)