Skip to content

Commit 44485e5

Browse files
committed
Unblock SwiftPM's build
This fixes two issues: - First one is the same as #2875 - Second one is a crash related to build conditionals which looks like a longer standing bug that was triggered by swiftlang/swift-llbuild#681 Unforunately, llbuild CI doesn't test the package, so it slipped through and now causes SwiftPM to crash when building itself
1 parent cebb305 commit 44485e5

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Sources/PackageLoading/PackageBuilder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,12 @@ public final class PackageBuilder {
840840
func buildConditions(from condition: PackageConditionDescription?) -> [PackageConditionProtocol] {
841841
var conditions: [PackageConditionProtocol] = []
842842

843-
if let config = condition?.config.map({ BuildConfiguration(rawValue: $0)! }) {
843+
if let config = condition?.config.flatMap({ BuildConfiguration(rawValue: $0) }) {
844844
let condition = ConfigurationCondition(configuration: config)
845845
conditions.append(condition)
846846
}
847847

848-
if let platforms = condition?.platformNames.map({ platformRegistry.platformByName[$0]! }), !platforms.isEmpty {
848+
if let platforms = condition?.platformNames.flatMap({ platformRegistry.platformByName[$0] }), !platforms.isEmpty {
849849
let condition = PlatformsCondition(platforms: platforms)
850850
conditions.append(condition)
851851
}

Sources/SPMTestSupport/MockDownloader.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class MockDownloader: Downloader {
4949
public func downloadFile(
5050
at url: Foundation.URL,
5151
to destinationPath: AbsolutePath,
52+
withAuthorizationProvider: AuthorizationProviding? = nil,
5253
progress: @escaping Downloader.Progress,
5354
completion: @escaping Downloader.Completion
5455
) {

Sources/Workspace/Workspace.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,7 @@ extension Workspace {
14211421
downloader.downloadFile(
14221422
at: parsedURL,
14231423
to: archivePath,
1424+
withAuthorizationProvider: nil,
14241425
progress: { bytesDownloaded, totalBytesToDownload in
14251426
self.delegate?.downloadingBinaryArtifact(
14261427
from: url,

0 commit comments

Comments
 (0)