Hello, 3 days ago I made post on apple forum about my problem with building SPM package which contains macros (link Xcodebuild command compiles macro … | Apple Developer Forums). Unfortunately I didn't get any response, so I decided to try my luck here. Has anyone encountered something similar?
Yes, it's been an issue since macro release. Literally doubles the swift-syntax build time. Maybe we'll get a fix when the precompiled swift-syntax
solution ships, but that seems only likely for summer at the earliest.
Edit: Reported this back in January, probably just one among many reports: FB13561794
Is there any way to bypass this behavior? For now, this package has to remain as a local package in the application repo, but since it breaks compilation on the CICD machine, this is quite problematic. In the past, I got around this by adding -arch arm64 parameter to the swift build command for Cocoapods libraries with marcos, but I haven't found a solution for this case.
Not that I've found, none of the arch controls seem to affect what Xcode does to macros. However, I'm not sure how that would break your CI, as superfluous archs should just be a performance issue. Sounds like you may have other arch issues.
It seems so, I just checked the log again. Xcodebuild tried to build only the “LibMacros” target with the wrong arch, all other libraries from swift dependencies (since Wrapper lib only wraps them) have arm64 as the selected arch. The compilation of “LibMacors” ends with the following error: "Wrapper/Sources/LibMacros/DummyMacro.swift:9:8: error: module 'SwiftCompilerPlugin' was created for incompatible target arm64-apple-macos10.15: /Users/REDACTED/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/SwiftCompilerPlugin-1PTTVFAZVZCW9.swiftmodule
import SwiftCompilerPlugin".
Thanks for sharing info. It helps me a lot.