@@ -784,7 +784,7 @@ extension Workspace {
784
784
observabilityScope: ObservabilityScope
785
785
) throws -> [ ( PackageReference , Workspace . PackageStateChange ) ] ? {
786
786
// Create cache directories.
787
- createCacheDirectories ( observabilityScope: observabilityScope)
787
+ self . createCacheDirectories ( observabilityScope: observabilityScope)
788
788
789
789
// FIXME: this should not block
790
790
// Load the root manifests and currently checked out manifests.
@@ -799,7 +799,9 @@ extension Workspace {
799
799
guard let pinsStore = observabilityScope. trap ( { try self . pinsStore. load ( ) } ) else { return nil }
800
800
801
801
// Ensure we don't have any error at this point.
802
- guard !observabilityScope. errorsReported else { return nil }
802
+ guard !observabilityScope. errorsReported else {
803
+ return nil
804
+ }
803
805
804
806
// Add unversioned constraints for edited packages.
805
807
var updateConstraints = currentManifests. editedPackagesConstraints ( )
@@ -830,17 +832,28 @@ extension Workspace {
830
832
// Reset the active resolver.
831
833
self . activeResolver = nil
832
834
833
- guard !observabilityScope. errorsReported else { return nil }
835
+ guard !observabilityScope. errorsReported else {
836
+ return nil
837
+ }
834
838
835
839
if dryRun {
836
- return observabilityScope. trap { return try computePackageStateChanges ( root: graphRoot, resolvedDependencies: updateResults, updateBranches: true , observabilityScope: observabilityScope) }
840
+ return observabilityScope. trap {
841
+ return try self . computePackageStateChanges ( root: graphRoot, resolvedDependencies: updateResults, updateBranches: true , observabilityScope: observabilityScope)
842
+ }
837
843
}
838
844
839
845
// Update the checkouts based on new dependency resolution.
840
846
let packageStateChanges = self . updateDependenciesCheckouts ( root: graphRoot, updateResults: updateResults, updateBranches: true , observabilityScope: observabilityScope)
841
847
842
848
// Load the updated manifests.
843
849
let updatedDependencyManifests = try self . loadDependencyManifests ( root: graphRoot, observabilityScope: observabilityScope)
850
+ // If we have missing packages, something is fundamentally wrong with the resolution of the graph
851
+ let stillMissingPackages = updatedDependencyManifests. computePackages ( ) . missing
852
+ guard stillMissingPackages. isEmpty else {
853
+ let missing = stillMissingPackages. map { $0. description }
854
+ observabilityScope. emit ( error: " exhausted attempts to resolve the dependencies graph, with ' \( missing. joined ( separator: " ', ' " ) ) ' unresolved. " )
855
+ return nil
856
+ }
844
857
845
858
// Update the resolved file.
846
859
self . saveResolvedFile (
@@ -1721,7 +1734,7 @@ extension Workspace {
1721
1734
let dependenciesToLoad = dependenciesRequired. map { $0. createPackageRef ( ) } . filter { !loadedManifests. keys. contains ( $0. identity) }
1722
1735
let dependenciesManifests = try temp_await { self . loadManagedManifests ( for: dependenciesToLoad, observabilityScope: observabilityScope, completion: $0) }
1723
1736
dependenciesManifests. forEach { loadedManifests [ $0. key] = $0. value }
1724
- return pair . item . dependenciesRequired ( for : pair . key . productFilter ) . compactMap { dependency in
1737
+ return dependenciesRequired. compactMap { dependency in
1725
1738
loadedManifests [ dependency. identity] . flatMap {
1726
1739
// we also compare the location as this function may attempt to load
1727
1740
// dependencies that have the same identity but from a different location
@@ -2704,7 +2717,7 @@ extension Workspace {
2704
2717
) -> [ ( PackageReference , PackageStateChange ) ] {
2705
2718
// Get the update package states from resolved results.
2706
2719
guard let packageStateChanges = observabilityScope. trap ( {
2707
- try computePackageStateChanges ( root: root, resolvedDependencies: updateResults, updateBranches: updateBranches, observabilityScope: observabilityScope)
2720
+ try self . computePackageStateChanges ( root: root, resolvedDependencies: updateResults, updateBranches: updateBranches, observabilityScope: observabilityScope)
2708
2721
} ) else {
2709
2722
return [ ]
2710
2723
}
0 commit comments