Skip to content

Commit 3af4dd7

Browse files
jakepetroulesbkhouri
authored andcommitted
Update path to support swbuild if available
Some Xcode installation no longer have xcbuild binary, and instead contain a swbuild. Update the path to look for swbuild first, and then fall back to xcbuild.
1 parent 71ab073 commit 3af4dd7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Sources/XCBuildSupport/XcodeBuildSystem.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,19 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
100100
} else {
101101
let xcodeSelectOutput = try AsyncProcess.popen(args: "xcode-select", "-p").utf8Output().spm_chomp()
102102
let xcodeDirectory = try AbsolutePath(validating: xcodeSelectOutput)
103-
xcbuildPath = try AbsolutePath(
104-
validating: "../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild",
105-
relativeTo: xcodeDirectory
106-
)
103+
xcbuildPath = try {
104+
let newPath = try AbsolutePath(
105+
validating: "../SharedFrameworks/SwiftBuild.framework/Versions/A/Support/swbuild",
106+
relativeTo: xcodeDirectory
107+
)
108+
if fileSystem.exists(newPath) {
109+
return newPath
110+
}
111+
return try AbsolutePath(
112+
validating: "../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild",
113+
relativeTo: xcodeDirectory
114+
)
115+
}()
107116
}
108117

109118
guard fileSystem.exists(xcbuildPath) else {

0 commit comments

Comments
 (0)