XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.58k stars 119 forks source link

Quick fix to ignore new iOS 18 runtime downloadables #370

Closed alvar-bolt closed 6 days ago

alvar-bolt commented 3 weeks ago

With introduction if Xcode 16 and iOS 18 simulators, a breaking change for xcodes was introduced through the simulators API. ("https://devimages-cdn.apple.com/downloads/xcode/simulators/index2.dvtdownloadableindex")

In order to keep current functionality working, I made 2 modifications:

  1. Make runtime source optional. This is needed as iOS 18 downloadable does not have that value.
  2. Add support for new cryptexDiskImage content type. As iOS 18 downloadable comes with new type of contentType, we should parse it in order to be able to process rest of the response.

In RuntimeInstaller, I've added logic to handle new optional and new content type be throwing error if those downloadable were to be used.

Test cases and fixtures were also updated to handle these new cases.

Mr-Alirezaa commented 3 weeks ago

+1

Currently both app and command-line are not able to list runtimes due to the mentioned breaking change.

Ernest0-Production commented 3 weeks ago

@MattKiazyk Could you please review this fix so that you can merge this PR as soon as possible??

nicerloop commented 2 weeks ago

see https://github.com/XcodesOrg/xcodes/issues/368

ashtl commented 2 weeks ago

@MattKiazyk Is there anything blocking this fix being merged?

dunester commented 2 weeks ago

Thank you for working on this! Great fix, looking forward to the merge!

testableapple commented 1 week ago

Hey @alvar-bolt, thanks for the fix. Trying to test it, but still facing this issue:

$ git clone -b alvar/ios-18-quickfix https://github.com/alvar-bolt/xcodes
$ cd xcodes
$ make install
$ xcodes runtimes

...
100%: Build succeeded
Error: keyNotFound(CodingKeys(stringValue: "source", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "downloadables", intValue: nil), _PlistKey(stringValue: "Index 114", intValue: 114)], debugDescription: "No value associated with key CodingKeys(stringValue: \"source\", intValue: nil) (\"source\").", underlyingError: nil))

Am I doing something wrong here?

ashtl commented 1 week ago

@testableapple

git clone -b alvar/ios-18-quickfix https://github.com/alvar-bolt/xcodes

I followed these same steps and it worked fine for me. Did you uninstall the existing version of xcodes before you did this?

testableapple commented 1 week ago

@ashtl, fair enough. I was doing this on GitHub Actions and seems like it had the old version of xcodes.

Replacing xcodes with /usr/local/bin/xcodes worked for me:

$ git clone -b alvar/ios-18-quickfix https://github.com/alvar-bolt/xcodes
$ cd xcodes
$ make install
$ /usr/local/bin/xcodes runtimes

Moving forward, now I'm struggling to install the runtime itself, have you tried this?

$ sudo /usr/local/bin/xcodes runtimes install 'iOS 16.4'
Downloading Runtime iOS 16.4
Installing Runtime
Error: Failed executing: `/usr/bin/xcrun simctl runtime add /Users/runner/Downloads/iOS_16.4_Simulator_Runtime.dmg` (2).
Error: Process completed with exit code 1.

Weird that there is no stacktrace.

ashtl commented 1 week ago

@testableapple

If you try to add the downloaded runtime yourself outside of xcodes with xcrun simctl runtime add /Users/runner/Downloads/iOS_16.4_Simulator_Runtime.dmg it will probably give you better feedback.

I expect you already have the runtime installed - you can run xcrun simctl runtime list | grep 16.4 to verify this.

testableapple commented 1 week ago

@ashtl, it's not installed, and the reason for the failure is still unclear. It happens only with iOS 16.*, other runtime versions work fine.

Anyways, thanks for your help, for now I'll stick with a different tool to download the runtimes, at least until this fix is released.