Skip to content

Conversation

cmcgee1024
Copy link
Member

This can be useful for testing the self-update to pre-releases that may not
yet be published as the current in the swift.org API because they are undergoing
testing.


```
swiftly self-update [--assume-yes] [--verbose] [--version] [--help]
swiftly self-update [--assume-yes] [--verbose] [--version] [--help]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space added here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the documentation generator is homegrown, and naive. This seems minor enough that I wanted to keep the change to another PR, or possibly adopt the revision of it that's now available in the swift argument parser project.

downloadURL = URL(string: "https://download.swift.org/swiftly/linux/swiftly-\(version)-x86_64.tar.gz")
#elseif arch(arm64)
downloadURL = URL(string: "https://download.swift.org/swiftly/linux/swiftly-\(version)-aarch64.tar.gz")
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this throw an error if we somehow get here and don't know what we're downloading?
As it stands, I think this will end up running the update based on getCurrentSwiftlyRelease() since downloadURL won't get set, even though a version was specified.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added fatal errors in the unsupported cases.

@cmcgee1024 cmcgee1024 requested a review from etcwilde June 4, 2025 13:08
Copy link
Contributor

@justice-adams-apple justice-adams-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small test coverage related question but otherwise LGTM

try await SwiftlyTests.withTestHome {
try await SwiftlyTests.withMockedSwiftlyVersion(latestSwiftlyVersion: latestVersion) {
let updatedVersion = try await SelfUpdate.execute(SwiftlyTests.ctx, verbose: true)
let updatedVersion = try await SelfUpdate.execute(SwiftlyTests.ctx, verbose: true, version: nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmcgee1024 do we want a test specifying the version to cover the new code path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've added more test coverage for this

@cmcgee1024 cmcgee1024 merged commit ab2dc50 into swiftlang:main Jul 9, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants