swift-bundler icon indicating copy to clipboard operation
swift-bundler copied to clipboard

Fix `--no-xcodebuild` universal builds (waiting on upstream fix)

Open stackotter opened this issue 2 months ago • 0 comments

At the moment, use of .swiftLanguageMode(_:) swift setting in package manifests results in build failures when targeting multiple architectures at once (i.e. performing a universal build). The upstream issue was first reported in https://github.com/swiftlang/swift-package-manager/issues/7958.

SwiftPM PR 9001 along with the adoption of the new swift-build based build system should fix the upstream issue.

I'm not sure if there's anything that we can do before then, other than work around the issue.

Workaround

To work around the issue, use the --xcodebuild command line flag. This uses xcodebuild instead of SwiftPM under the hood. Notice that despite my best efforts, there won't necessarily be 100% parity between the resource bundling behaviour for SwiftPM-based and xcodebuild-based builds.

swift bundler bundle --universal --xcodebuild

Versions

$ xcodebuild -version
Xcode 16.4
Build version 16F6

$ swift --version
swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0

I have not had the chance to test out this issue under newer Xcode versions. If someone with a newer Xcode version could try to reproduce this issue I would be interested to know the results.

stackotter avatar Oct 20 '25 06:10 stackotter