@@ -778,7 +778,7 @@ extension Workspace {
778
778
observabilityScope: ObservabilityScope
779
779
) throws -> [ ( PackageReference , Workspace . PackageStateChange ) ] ? {
780
780
// Create cache directories.
781
- createCacheDirectories ( observabilityScope: observabilityScope)
781
+ self . createCacheDirectories ( observabilityScope: observabilityScope)
782
782
783
783
// FIXME: this should not block
784
784
// Load the root manifests and currently checked out manifests.
@@ -793,7 +793,9 @@ extension Workspace {
793
793
guard let pinsStore = observabilityScope. trap ( { try self . pinsStore. load ( ) } ) else { return nil }
794
794
795
795
// Ensure we don't have any error at this point.
796
- guard !observabilityScope. errorsReported else { return nil }
796
+ guard !observabilityScope. errorsReported else {
797
+ return nil
798
+ }
797
799
798
800
// Add unversioned constraints for edited packages.
799
801
var updateConstraints = currentManifests. editedPackagesConstraints ( )
@@ -824,17 +826,28 @@ extension Workspace {
824
826
// Reset the active resolver.
825
827
self . activeResolver = nil
826
828
827
- guard !observabilityScope. errorsReported else { return nil }
829
+ guard !observabilityScope. errorsReported else {
830
+ return nil
831
+ }
828
832
829
833
if dryRun {
830
- return observabilityScope. trap { return try computePackageStateChanges ( root: graphRoot, resolvedDependencies: updateResults, updateBranches: true , observabilityScope: observabilityScope) }
834
+ return observabilityScope. trap {
835
+ return try self . computePackageStateChanges ( root: graphRoot, resolvedDependencies: updateResults, updateBranches: true , observabilityScope: observabilityScope)
836
+ }
831
837
}
832
838
833
839
// Update the checkouts based on new dependency resolution.
834
840
let packageStateChanges = self . updateDependenciesCheckouts ( root: graphRoot, updateResults: updateResults, updateBranches: true , observabilityScope: observabilityScope)
835
841
836
842
// Load the updated manifests.
837
843
let updatedDependencyManifests = try self . loadDependencyManifests ( root: graphRoot, observabilityScope: observabilityScope)
844
+ // If we have missing packages, something is fundamentally wrong with the resolution of the graph
845
+ let stillMissingPackages = updatedDependencyManifests. computePackages ( ) . missing
846
+ guard stillMissingPackages. isEmpty else {
847
+ let missing = stillMissingPackages. map { $0. description }
848
+ observabilityScope. emit ( error: " exhausted attempts to resolve the dependencies graph, with ' \( missing. joined ( separator: " ', ' " ) ) ' unresolved. " )
849
+ return nil
850
+ }
838
851
839
852
// Update the resolved file.
840
853
self . saveResolvedFile (
@@ -1715,7 +1728,7 @@ extension Workspace {
1715
1728
let dependenciesToLoad = dependenciesRequired. map { $0. createPackageRef ( ) } . filter { !loadedManifests. keys. contains ( $0. identity) }
1716
1729
let dependenciesManifests = try temp_await { self . loadManagedManifests ( for: dependenciesToLoad, observabilityScope: observabilityScope, completion: $0) }
1717
1730
dependenciesManifests. forEach { loadedManifests [ $0. key] = $0. value }
1718
- return pair . item . dependenciesRequired ( for : pair . key . productFilter ) . compactMap { dependency in
1731
+ return dependenciesRequired. compactMap { dependency in
1719
1732
loadedManifests [ dependency. identity] . flatMap {
1720
1733
// we also compare the location as this function may attempt to load
1721
1734
// dependencies that have the same identity but from a different location
@@ -2698,7 +2711,7 @@ extension Workspace {
2698
2711
) -> [ ( PackageReference , PackageStateChange ) ] {
2699
2712
// Get the update package states from resolved results.
2700
2713
guard let packageStateChanges = observabilityScope. trap ( {
2701
- try computePackageStateChanges ( root: root, resolvedDependencies: updateResults, updateBranches: updateBranches, observabilityScope: observabilityScope)
2714
+ try self . computePackageStateChanges ( root: root, resolvedDependencies: updateResults, updateBranches: updateBranches, observabilityScope: observabilityScope)
2702
2715
} ) else {
2703
2716
return [ ]
2704
2717
}
0 commit comments