[6.2] Cherry Pick - Build fat packages when shouldPackagesBuildForARM64e is set #9185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
I extended arm64e support for macOS & visionOS apps in my previous PR #8837. When enabled, that patch only produced the arm64e slice but...
The App Store will now accept arm64e for macOS, iOS, and visionOS — arm64e is optional and off by default. But when you turn on arm64e support for packages (ie, using
shouldPackagesBuildForARM64e
PIF builder delegate method) we expect both slices in the binary now.Modifications:
Changes the PIF builder to update the ARCHS settings without overriding it completely, ensuring we get all required slices (ie, a so called fat binary).
Result:
PIF builder nows has the capability of building packages for arm64 and arm64e. (Note, for now, that this is currently disabled in SwiftPM.)
I validated this by building a simple macOS executable for arm64e (and force enabling it in SwifPM):
...and then I inspected the generated binary:
Debug builds. With ONLY_ACTIVE_ARCH = "YES" in debug builds, even though you specify multiple architectures in ARCHS, it will still only build for the active architecture during development. This is set to "NO" for release builds.