From 35683cbb33fcf56be24ed585d6933ee0aadcb6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?furby=E2=84=A2?= Date: Tue, 19 Mar 2024 21:14:05 -0500 Subject: [PATCH] Discover a crazy swift toolchain bug. * It would appear that attempting to use moduleAliases on macOS with the vanilla non-xcode swift toolchain, specific to the module aliasing of the SwiftUI module; even for a product that is conditionally removed for this platform, it causes the compiler to suddenly throw: error: failed to build module 'SwiftUI'; this SDK is not supported by the compiler --- on top of that, it ballooned the build time from what typically takes 29m 11s all the way up to 1h 44m 58s before finally erroring!!!!?!!!?! --- Package.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 1b9cab58..59e45e9e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,6 +1,12 @@ // swift-tools-version: 5.9 import PackageDescription +#if os(macOS) + let crazyToolChainBug: [String: String]? = nil +#else /* os(macOS) */ + let crazyToolChainBug: [String: String]? = ["SwiftCrossUI": "SwiftUI"] +#endif /* !os(macOS) */ + let package = Package( name: "Kraken", platforms: [ @@ -66,7 +72,7 @@ let package = Package( .product( name: "SwiftCrossUI", package: "swift-cross-ui", - moduleAliases: ["SwiftCrossUI": "SwiftUI"], + moduleAliases: crazyToolChainBug, condition: .when(platforms: [.linux, .windows]) ), .product(