Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Improve macOS SDK handling

Kabir Oberaie5eb0d3c4f00
diff --git a/Sources/PackLib/BuildSettings.swift b/Sources/PackLib/BuildSettings.swift
index e17c07b..5a1b5d1 100644
--- a/Sources/PackLib/BuildSettings.swift
+++ b/Sources/PackLib/BuildSettings.swift
@@ -25,17 +25,12 @@ public struct BuildSettings: Sendable {
// TODO: allow customizing?
self.triple = "arm64-apple-ios"
- #if os(macOS)
- let sdkPath = try await Self.xcrun(["-show-sdk-path", "--sdk", "iphoneos"])
- self.sdkOptions = [
- "--triple", triple,
- "--sdk", sdkPath,
- ]
- #else
- self.sdkOptions = [
- "--swift-sdk", triple
- ]
- #endif
+ // on macOS we don't explicitly install a Swift SDK but
+ // SwiftPM vends "implicit" Darwin SDKs as of Swift 6.1,
+ // i.e. we can pass `--swift-sdk arm64-apple-ios` and it
+ // just works. See:
+ // https://github.com/swiftlang/swift-package-manager/pull/6828
+ self.sdkOptions = ["--swift-sdk", triple]
}
#if os(macOS)
diff --git a/Sources/XToolSupport/SetupCommand.swift b/Sources/XToolSupport/SetupCommand.swift
index d4514ee..22bd99e 100644
--- a/Sources/XToolSupport/SetupCommand.swift
+++ b/Sources/XToolSupport/SetupCommand.swift
@@ -24,6 +24,9 @@ struct SetupOperation {
func run() async throws {
try await AuthOperation(logoutFromExisting: false, quiet: quiet).run()
+ #if os(macOS)
+ print("Skipping Darwin SDK setup since we're on macOS.")
+ #else
switch try DarwinSDK.current()?.isUpToDate() {
case true?:
if !quiet {
@@ -48,5 +51,6 @@ struct SetupOperation {
try await InstallSDKOperation(path: expanded).run()
}
+ #endif
}
}