Hive
Archiving fails after bumping a project dependency that includes Marcos
GitHub issue · Open
What problem or need do you have?
Overview
Consider an iOS app that depends on Composable Architecture which, in turn, depends on swift-syntax as it has some Macros. The project uses Tuist caching for dependencies so most of the time all 3rd parties are linked as xcframeworks.
The problem occurs when I update the TCA but do not warm the cache. If I then install and generate the project, the 3rd party dependency is attached as source code, while swift-syntax and other transitive dependencies are still linked as xcframeworks. In other words, nothing unexpected here. However, If I then try to archive the project (archiving for Simulator for simplicity) I get the following errors:
.cache/tuist/Binaries/2d6b401f14e71e5cb84c4f994b39bd6c/SwiftSyntax510.xcframework:1:1: error: While building for iOS Simulator, no library for this platform was found in .cache/tuist/Binaries/2d6b401f14e71e5cb84c4f994b39bd6c/SwiftSyntax510.xcframework'. (in target 'ComposableArchitectureMacros' from project 'swift-composable-architecture')
.cache/tuist/Binaries/5ab1979fa3658a7670123e63643c6690/SwiftSyntaxBuilder.xcframework:1:1: error: While building for iOS Simulator, no library for this platform was found in .cache/tuist/Binaries/5ab1979fa3658a7670123e63643c6690/SwiftSyntaxBuilder.xcframework'. (in target 'ComposableArchitectureMacros' from project 'swift-composable-architecture')
.cache/tuist/Binaries/6f52521d103c0dcd8083247b5ab9e299/SwiftSyntax600.xcframework:1:1: error: While building for iOS Simulator, no library for this platform was found in '.cache/tuist/Binaries/6f52521d103c0dcd8083247b5ab9e299/SwiftSyntax600.xcframework'. (in target 'ComposableArchitectureMacros' from project 'swift-composable-architecture')
… and so on. Basically, the same error reported for all swift-syntax siblings.
The errors actually make sense, because macros can only be built for MacOS, and the binaries inside the xcframeworks are for MacOS only. Thus, I’m quite puzzled why the issue occurs, why it happens only after updating the parent dependency (TCA) and what the correct way to get around it is.
Below I’m attaching a sample project and the steps to follow to reproduce the issue.
Example
In the attached project there’s an empty iOS app with a single dependency - TCA. The idea is to use Tuist Caching to cache the dependencies, then bump TCA, generate the project and try to archive it.
Steps to reproduce
- Download and unzip the attached project.
- Run
tuist install - Run
tuist cache --external-only --configuration Debug
At this point all dependencies are cached and the project can be archived correctly
- Go to
Tuist/Package.swiftand bump TCA from1.14.0to1.15.0. - Run
tuist install - Run
tuist generate --configuration Debug - Run:
xcodebuild archive \
-workspace TuistCacheTest.xcworkspace \
-scheme TuistCacheTest \
-configuration Debug \
-sdk iphonesimulator \
-archivePath ./archives/sim.xcarchive
- Observe a bunch of errors.
Potential solution
First of all I’d like to understand what causes the problem - whether there’s some issue in the Tuist caching logic, Xcode build system or somewhere else. Then we could use this thread to brainstorm a potential fix/workaround.
macOS version
14.6
Tuist version
4.25.0
Xcode version
15.4
No GitHub comments yet.