Reducing clang and Swift module variants?

With Xcode 26.4b2, the module report option in the Scheme editor works, so we can debug why there are so many module variants built. @Xi_Ge

In my small project (about 4k lines of Swift, TCA and other dependencies) produces a huge number of clang modules, up to 16 variants per module.

AppAuth: 1 variant
AppAuthCore: 2 variants
AppCheckCore: 1 variant
AuthenticationServices: 1 variant
CFNetwork: 9 variants
CommonCrypto: 3 variants
CoreAudio: 1 variant
CoreAudioTypes: 1 variant
CoreFoundation: 11 variants
CoreGraphics: 7 variants
CoreImage: 7 variants
CoreMedia: 1 variant
CoreTelephony: 3 variants
CoreText: 7 variants
CoreVideo: 7 variants
Darwin: 13 variants
DeviceCheck: 1 variant
Dispatch: 11 variants
FBLPromises: 4 variants
FileProvider: 7 variants
FirebaseCore: 3 variants
FirebaseCoreExtension: 2 variants
FirebaseCoreInternal: 1 variant
FirebaseCrashlyticsSwift: 1 variant
FirebaseInstallations: 1 variant
FirebaseRemoteConfigInterop: 1 variant
FirebaseSessions: 1 variant
Foundation: 9 variants
GTMAppAuth: 1 variant
GTMSessionFetcherCore: 1 variant
GoogleDataTransport: 1 variant
GoogleUtilities_Environment: 6 variants
GoogleUtilities_Logger: 2 variants
GoogleUtilities_NSData: 1 variant
GoogleUtilities_Network: 1 variant
GoogleUtilities_Reachability: 1 variant
GoogleUtilities_UserDefaults: 2 variants
IOSurface: 7 variants
ImageIO: 7 variants
LocalAuthentication: 1 variant
MachO: 3 variants
Metal: 7 variants
MetricKit: 1 variant
ObjectiveC: 10 variants
OpenGLES: 7 variants
QuartzCore: 7 variants
SafariServices: 1 variant
Security: 9 variants
Symbols: 7 variants
SystemConfiguration: 2 variants
UIKit: 7 variants
UIUtilities: 7 variants
UserNotifications: 7 variants
XPC: 9 variants
_AvailabilityInternal: 16 variants
_Builtin_float: 11 variants
_Builtin_inttypes: 13 variants
_Builtin_limits: 13 variants
_Builtin_stdarg: 16 variants
_Builtin_stdatomic: 3 variants
_Builtin_stdbool: 16 variants
_Builtin_stddef: 16 variants
_Builtin_stdint: 16 variants
_DarwinFoundation1: 16 variants
_DarwinFoundation2: 16 variants
_DarwinFoundation3: 16 variants
nanopb: 6 variants
os: 2 variants
os_object: 11 variants
os_workgroup: 11 variants
ptrauth: 11 variants
ptrcheck: 16 variants
third_party_IsAppEncrypted: 1 variant
tzdb: 1 variant
zlib: 2 variants

There are fewer Swift modules, but still a surprising number of variants, given I'm only compiling for the sim.

AppAuthCore (Clang): 1 variant
FBLPromises (Clang): 2 variants
FirebaseAppCheckInterop (Clang): 2 variants
FirebaseAuthInternal (Clang): 2 variants
FirebaseAuthInterop (Clang): 2 variants
FirebaseCore (Clang): 3 variants
FirebaseCoreExtension (Clang): 3 variants
FirebaseInstallations (Clang): 1 variant
FirebaseSessionsObjC (Clang): 1 variant
GTMSessionFetcherCore (Clang): 2 variants
GoogleDataTransport (Clang): 1 variant
GoogleSignIn (Clang): 1 variant
GoogleUtilities_AppDelegateSwizzler (Clang): 2 variants
GoogleUtilities_Environment (Clang): 3 variants
GoogleUtilities_NSData (Clang): 4 variants
GoogleUtilities_UserDefaults (Clang): 1 variant
JJLInternal (Clang): 2 variants
RecaptchaInterop (Clang): 2 variants
UIKitNavigationShim (Clang): 1 variant
ZippyJSONCFamily (Clang): 2 variants
_SwiftSyntaxCShims (Clang): 3 variants
nanopb (Clang): 1 variant
tzdb (Clang): 2 variants

It seems like all of these variants are from our SPM dependencies, so I don't know of any way to actually influence their build.

At a high level the only issue I can see with the build is that, since no prebuilt is available yet (or it wasn't used), swift-syntax is building for arm64 and x86_64, but that's what usually happens until the prebuilt is available.

For my large project, I can see up to 42 variants of the same high variant libraries from the small app. I'm guessing this number is the number of implicit and explicit dependencies in the project. Is there any way to improve this?

Task Backtraces are also available, though they still don't provide actionable information. Why do things get copied every build?

Build Backtrace:
an input of 'Copy GoogleUtilities_GoogleUtilities-AppDelegateSwizzler.bundle' changed
an input of file 'Build/Products/Debug-iphonesimulator/GoogleUtilities_GoogleUtilities-AppDelegateSwizzler.bundle/' changed
an input of signature of directory tree at 'Build/Products/Debug-iphonesimulator/GoogleUtilities_GoogleUtilities-AppDelegateSwizzler.bundle' changed
contents of 'Build/Products/Debug-iphonesimulator/GoogleUtilities_GoogleUtilities-AppDelegateSwizzler.bundle' changed

Uh, no it didn't?

Lots of them are things like:

Build Backtrace:
'Write ZippyJSON.modulemap' had never run

Well, yes it had, in the previous build, but why don't you think the file exists right now?