Skip to content

Commit 1fc90e2

Browse files
dschaefer2bkhourijakepetroules
authored
Cherry pick swbuild support to 6.1 (#8322)
Update path to support swbuild if available (#8306) 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`. Co-authored-by: Bassam (Sam) Khouri <bkhouri@users.noreply.github.com> Co-authored-by: Jake Petroules <jake.petroules@apple.com>
1 parent c07726b commit 1fc90e2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Sources/XCBuildSupport/XcodeBuildSystem.swift

+13-4
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)