Skip to content

Commit

Permalink
[PackageModel] UserToolchain: Add -F when building with CommandLineTools
Browse files Browse the repository at this point in the history
Properly handle swift-testing installations in CommandLineTools.

Resolves rdar://136424541.
  • Loading branch information
bnbarham committed Oct 11, 2024
1 parent 064dec3 commit 88e94ab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/PackageModel/UserToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,18 @@ public final class UserToolchain: Toolchain {
derivedSwiftCompiler: AbsolutePath,
fileSystem: any FileSystem
) -> (swiftCFlags: [String], linkerFlags: [String]) {
// If this is CommandLineTools all we need to add is a frameworks path.
if let frameworksPath = try? AbsolutePath(
validating: "../../Library/Developer/Frameworks",
relativeTo: resolveSymlinks(derivedSwiftCompiler).parentDirectory
), fileSystem.exists(frameworksPath.appending("Testing.framework")) {
return (swiftCFlags: [
"-F", frameworksPath.pathString
], linkerFlags: [
"-rpath", frameworksPath.pathString
])
}

guard let toolchainLibDir = try? toolchainLibDir(
swiftCompilerPath: derivedSwiftCompiler
) else {
Expand Down

0 comments on commit 88e94ab

Please sign in to comment.