swiftlang / swiftly

A Swift toolchain installer and manager, written in Swift.
https://swiftlang.github.io/swiftly/
Apache License 2.0
451 stars 19 forks source link

macOS `swiftly-install.sh` does not create `config.json` #136

Open BrianHenryIE opened 1 month ago

BrianHenryIE commented 1 month ago
% swiftly                                                               

Error: Could not load swiftly's configuration file at /Users/brianhenry/Library/Application Support/swiftly/config.json due to
error: "Error Domain=NSCocoaErrorDomain Code=260 "The file “config.json” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/brianhenry/Library/Application Support/swiftly/config.json, NSUnderlyingError=0x600000cc4ab0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}".
To use swiftly, modify the configuration file to fix the issue or perform a clean installation.

https://github.com/swiftlang/swiftly/blob/bcfd8439a078893c11d3331c193e2b6a7b431887/install/swiftly-install.sh#L489-L503

https://github.com/swiftlang/swiftly/blob/bcfd8439a078893c11d3331c193e2b6a7b431887/install/swiftly-install.sh#L657-L659

Removing the conditionals allows swiftly to run, but the config is mostly empty:

% cat "/Users/brianhenry/Library/Application Support/swiftly/config.json"

{
  "platform": {
    "name": "",
    "nameFull": "",
    "namePretty": "",
    "architecture": "aarch64"
  },
  "installedToolchains": [],
  "inUse": null
}

And installing doesn't work:

% swiftly install 5.9

Fetching the latest stable Swift 5.9 release...
Installing Swift 5.9.2
Swift 5.9.2 does not exist, exiting
adam-fowler commented 1 month ago

We haven't released a macOS version of swiftly yet.

BrianHenryIE commented 1 month ago

Yeah, I'm testing the changes that have been merged to main

https://github.com/swiftlang/swiftly/pull/121#issuecomment-2225762591

Please raise issues for anything that remains. Thanks everyone!

adam-fowler commented 1 month ago

The plan is for a lot of the swiftly-install script to be moved inside of swiftly. The current state of the script is not Mac friendly.

BrianHenryIE commented 1 month ago

Brief thread on Slack, FYI: https://swift-open-source.slack.com/archives/C078M3HTMEU/p1720899355984949, basically just saying I want to test this.

I still have more use-testing to do to be 100% sure, but I think if my two PRs are merged, then macOS support is ready for a release.

I agree 100% that it's preferable to eliminate swiftly-install.sh. My reading of the discussion is that that is a different task, and it has a PR proposal but looks like it's not imminent. If it is imminent, hopefully the comments I've made here will be helpful.

Let me know if there's an expectation of automated tests – I said elsewhere that hopefully it's a matter of adding a macOS target for testing rather than writing new tests. The two "suggestion" issues I've opened probably would want tests when I write PRs.