Skip to content

Commit 05ca1e7

Browse files
committed
cleanup
1 parent ad5a33c commit 05ca1e7

File tree

2 files changed

+16
-29
lines changed

2 files changed

+16
-29
lines changed

Bar-1.2.3.zip

476 Bytes
Binary file not shown.

Sources/Workspace/Workspace.swift

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,14 +1333,7 @@ extension Workspace {
13331333
}
13341334

13351335
// optimization: preload in parallel
1336-
let rootDependencyManifestsURLs = root.dependencies.map{ dependency -> String in
1337-
switch dependency {
1338-
case .local(let data):
1339-
return data.path.pathString
1340-
case .git(let data):
1341-
return data.location
1342-
}
1343-
}
1336+
let rootDependencyManifestsURLs = root.dependencies.map{ $0.location }
13441337
let rootDependencyManifests = try temp_await { self.loadManifests(forURLs: rootDependencyManifestsURLs, diagnostics: diagnostics, completion: $0) }
13451338

13461339
let inputManifests = root.manifests + rootDependencyManifests
@@ -1353,34 +1346,15 @@ extension Workspace {
13531346
let productFilter: ProductFilter
13541347
}
13551348

1356-
13571349
// optimization: preload manifest we know about in parallel
1358-
let inputDependenciesURLs = inputManifests.map { manifest in
1359-
//$0.dependencies.map{ config.mirrors.effectiveURL(forURL: $0.location) }
1360-
manifest.dependencies.map{ dependency -> String in
1361-
switch dependency {
1362-
case .local(let data):
1363-
return data.path.pathString
1364-
case .git(let data):
1365-
return data.location
1366-
}
1367-
}
1368-
1369-
}.flatMap { $0 }
1350+
let inputDependenciesURLs = inputManifests.map { $0.dependencies.map{ $0.location } }.flatMap { $0 }
13701351
// FIXME: this should not block
13711352
var loadedManifests = try temp_await { self.loadManifests(forURLs: inputDependenciesURLs, diagnostics: diagnostics, completion: $0) }.spm_createDictionary{ ($0.packageLocation, $0) }
13721353

13731354
// continue to load the rest of the manifest for this graph
13741355
let allManifestsWithPossibleDuplicates = try topologicalSort(inputManifests.map{ KeyedPair($0, key: URLAndFilter(url: $0.packageLocation, productFilter: .everything)) }) { node in
13751356
return node.item.dependenciesRequired(for: node.key.productFilter).compactMap{ dependency in
1376-
//let url = config.mirrors.effectiveURL(forURL: dependency.location)
1377-
let location: String
1378-
switch dependency {
1379-
case .local(let data):
1380-
location = data.path.pathString
1381-
case .git(let data):
1382-
location = data.location
1383-
}
1357+
let location = dependency.location
13841358
// FIXME: this should not block
13851359
// note: loadManifest emits diagnostics in case it fails
13861360
let manifest = loadedManifests[location] ?? temp_await { self.loadManifest(forURL: location, diagnostics: diagnostics, completion: $0) }
@@ -2635,3 +2609,16 @@ public final class LoadableResult<Value> {
26352609
return try loadResult().get()
26362610
}
26372611
}
2612+
2613+
// FIXME: the manifest loading logic should be changed to use identity instead of location once identity is unique
2614+
// at that time we should remove this
2615+
extension PackageDependencyDescription {
2616+
var location: String {
2617+
switch self {
2618+
case .local(let data):
2619+
return data.path.pathString
2620+
case .git(let data):
2621+
return data.location
2622+
}
2623+
}
2624+
}

0 commit comments

Comments
 (0)