XcodesOrg / xcodes

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

Update unxip code to v2.1 #301

Closed Kyle-Ye closed 4 months ago

Kyle-Ye commented 1 year ago

Motivation

See https://github.com/saagarjha/unxip/compare/v1.1.3...v2.1

Context: https://github.com/XcodesOrg/XcodesApp/pull/371

Test

Test it locally with

swift build -c release && cd .build/release & ./xcodes install 15.0 Beta --experimental-unxip

Result ❌:

Downloading with aria2 (/opt/homebrew/bin/aria2c)
(1/6) Downloading Xcode 15.0.0-Beta+15A5160n: 99%
(2/6) Unarchiving Xcode (This can take a while)
Using experimental unxip. If you encounter any issues, remove the flag and try again
The file “Xcode-15.0.0-Beta+15A5160n.xip” doesn’t exist.
Kyle-Ye commented 1 year ago

Revert the UnxipOption from String back to URL. (Upstream implementation of 2.1 change Option's type to be String. However this will cause a issue here. So we still use the URL type here)

Add https://github.com/XcodesOrg/xcodes/pull/301/commits/55bed3e882d6c4f058cf8cfd9ac51bd87ea5efe3

Result ✅:

Downloading with aria2 (/opt/homebrew/bin/aria2c)
(1/6) Downloading Xcode 15.0.0-Beta+15A5160n: 99%
(2/6) Unarchiving Xcode (This can take a while)
Using experimental unxip. If you encounter any issues, remove the flag and try again
(3/6) Moving Xcode to /Applications/Xcode-15.0.0-Beta.app
(4/6) Moving Xcode archive Xcode-15.0.0-Beta+15A5160n.xip to the Trash
(5/6) Checking security assessment and code signing
(6/6) Finishing installation
xcodes requires superuser privileges in order to finish installation.
macOS User Password: 
Xcode 15.0.0-Beta has been installed to /Applications/Xcode-15.0.0-Beta.app
MattKiazyk commented 4 months ago

@Kyle-Ye thanks for taking time to do this a long time ago. I always felt it was weird how we used it, so therefore I would like to make xcodes support unxip 3 which has it's own library now we can use without having to create our own binary or our own code.

I'm going to close this PR because of that - Thanks!