Skip to content

Commit 88e94ab

Browse files
committed
[PackageModel] UserToolchain: Add -F when building with CommandLineTools
Properly handle swift-testing installations in CommandLineTools. Resolves rdar://136424541.
1 parent 064dec3 commit 88e94ab

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/PackageModel/UserToolchain.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,18 @@ public final class UserToolchain: Toolchain {
411411
derivedSwiftCompiler: AbsolutePath,
412412
fileSystem: any FileSystem
413413
) -> (swiftCFlags: [String], linkerFlags: [String]) {
414+
// If this is CommandLineTools all we need to add is a frameworks path.
415+
if let frameworksPath = try? AbsolutePath(
416+
validating: "../../Library/Developer/Frameworks",
417+
relativeTo: resolveSymlinks(derivedSwiftCompiler).parentDirectory
418+
), fileSystem.exists(frameworksPath.appending("Testing.framework")) {
419+
return (swiftCFlags: [
420+
"-F", frameworksPath.pathString
421+
], linkerFlags: [
422+
"-rpath", frameworksPath.pathString
423+
])
424+
}
425+
414426
guard let toolchainLibDir = try? toolchainLibDir(
415427
swiftCompilerPath: derivedSwiftCompiler
416428
) else {

0 commit comments

Comments
 (0)