Skip to content

Commit aab8d73

Browse files
authored
adjust to TSC SHA256 API changes (#3963)
motivation: simplify logic around which SHA256 implementation to use changes: always call SHA256 which abstracts over platform differences
1 parent 9631dac commit aab8d73

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

Sources/Basics/ByteString+Extensions.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ extension ByteString {
1616
/// Secure Hashing Algorithm 2 (SHA-2) hashing with a 256-bit digest, when available,
1717
/// falling back on a native implementation in Swift provided by TSCBasic.
1818
public var sha256Checksum: String {
19-
#if canImport(CryptoKit)
20-
if #available(macOS 10.15, *) {
21-
return CryptoKitSHA256().hash(self).hexadecimalRepresentation
22-
}
23-
#endif
24-
2519
return SHA256().hash(self).hexadecimalRepresentation
2620
}
2721
}

Sources/Workspace/Workspace.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,7 @@ public class Workspace {
336336
let httpClient = customHTTPClient ?? HTTPClient()
337337
let archiver = customArchiver ?? ZipArchiver()
338338

339-
var checksumAlgorithm = customChecksumAlgorithm ?? SHA256()
340-
#if canImport(CryptoKit)
341-
if checksumAlgorithm is SHA256, #available(macOS 10.15, *) {
342-
checksumAlgorithm = CryptoKitSHA256()
343-
}
344-
#endif
345-
339+
let checksumAlgorithm = customChecksumAlgorithm ?? SHA256()
346340
let additionalFileRules = additionalFileRules ?? []
347341
let resolverUpdateEnabled = resolverUpdateEnabled ?? true
348342
let resolverPrefetchingEnabled = resolverPrefetchingEnabled ?? false

0 commit comments

Comments
 (0)