fix: select architecture-appropriate Xcode build (fixes #456)#470
Open
wmehanna wants to merge 1 commit intoXcodesOrg:mainfrom
Open
fix: select architecture-appropriate Xcode build (fixes #456)#470wmehanna wants to merge 1 commit intoXcodesOrg:mainfrom
wmehanna wants to merge 1 commit intoXcodesOrg:mainfrom
Conversation
xcodereleases.com/data.json contains multiple builds per version: - Universal (arm64 + x86_64) - Apple Silicon (arm64 only) Previously first(withVersion:) returned first match regardless of architecture, causing Intel Macs to download arm64-only builds. Now firstCompatible(withVersion:hostArchitecture:) prefers: 1. Universal build (both architectures) 2. Architecture-specific build matching host 3. First match (fallback) Fixes XcodesOrg#456
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
architecturesfield toXcodemodel to capture build architecture from xcodereleases.com/data.jsoncurrentHostArchitectureto detect host CPU viauname -mfirstCompatible(withVersion:hostArchitecture:)selection that prefers Universal > matching arch > first matchProblem
xcodereleases.com/data.json contains multiple entries per version:
Xcode (Apple Silicon)witharchitectures: ["arm64"]Xcode(Universal) witharchitectures: ["arm64", "x86_64"]Previously
first(withVersion:)returned the first match regardless of architecture, causing Intel Macs to download arm64-only builds (issue #456).Solution
firstCompatible(withVersion:hostArchitecture:)uses selection priority:Changes
Models.swiftarchitectures: [String]?fieldXcodeList.swiftXcodeReleaseEntrytypeEnvironment.swiftcurrentHostArchitectureviauname -mModels+FirstWithVersion.swiftfirstCompatible(withVersion:hostArchitecture:)XcodeInstaller.swiftfirstCompatibleinstead offirstModels+FirstWithVersionTests.swiftTesting
New tests verify:
Closes #456