Modern Apps git

← xtool.git

Improve macOS SDK handling

Commit
e5eb0d3c4f008dc0057f4c01a72d607029892098
Author
Kabir Oberai <[email protected]>
When
2025-05-07 12:33 UTC (1 year ago)
Parents
2bcd20b

Diff

Sources/PackLib/BuildSettings.swift
diff --git a/Sources/PackLib/BuildSettings.swift b/Sources/PackLib/BuildSettings.swiftindex 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)
Sources/XToolSupport/SetupCommand.swift
diff --git a/Sources/XToolSupport/SetupCommand.swift b/Sources/XToolSupport/SetupCommand.swiftindex 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     } }