swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.65k stars 1.31k forks source link

Implement `--checksum` option on `swift sdk install` #7722

Open MaxDesiatov opened 3 days ago

MaxDesiatov commented 3 days ago

Motivation:

This option was specified in the corresponding proposal for Swift SDKs:

For Swift SDKs installed from remote URLs an additional --checksum option is required, through which users of a Swift SDK can specify a checksum provided by a publisher of the SDK. The latter can produce a checksum by running swift package compute-checksum command (introduced in SE-0272) with the Swift SDK bundle archive as an argument.

Modifications:

Added isFileSupported method on Archiver to unify archive extensions matching logic between swift package compute-checksum and swift sdk install.

Refactored checksum computation logic into static func checksum on Workspace.BinaryArtifactsManager to also unify it between the two commands.

Added error and output handling for checksums in func SwiftSDKBundleStore.installIfValid, updated corresponding unit tests.

Result:

Resolves rdar://130590711

MaxDesiatov commented 3 days ago

@swift-ci test

MaxDesiatov commented 3 days ago

@swift-ci test windows

kateinoigakukun commented 3 days ago

@swift-ci test windows

MaxDesiatov commented 3 days ago

@swift-ci test

MaxDesiatov commented 3 days ago

@swift-ci test windows