Skip to content

Commit

Permalink
[6.0.0][PackageModel] Inject swift-testing flags only if toolchain is…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
xedin authored Aug 26, 2024
1 parent db1e31e commit aeaab78
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Sources/PackageModel/UserToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,15 @@ public final class UserToolchain: Toolchain {
var swiftCompilerFlags: [String] = []
var extraLinkerFlags: [String] = []

#if os(macOS)
let (swiftCFlags, linkerFlags) = Self.deriveMacOSSpecificSwiftTestingFlags(
derivedSwiftCompiler: swiftCompilers.compile,
fileSystem: fileSystem
)
swiftCompilerFlags += swiftCFlags
extraLinkerFlags += linkerFlags
#endif
if triple.isMacOSX {
let (swiftCFlags, linkerFlags) = Self.deriveMacOSSpecificSwiftTestingFlags(
derivedSwiftCompiler: swiftCompilers.compile,
fileSystem: fileSystem
)

swiftCompilerFlags += swiftCFlags
extraLinkerFlags += linkerFlags
}

swiftCompilerFlags += try Self.deriveSwiftCFlags(
triple: triple,
Expand Down

0 comments on commit aeaab78

Please sign in to comment.