Skip to content

Commit 11b79c4

Browse files
committed
remove resolution retry and removing package.resolved in resolution failure
motivation: resolution retry + removing of package resolved in failure is difficult to justify changes: remove the retry code from package resolution and "give up" after one attemtp without mutating the package resolved file
1 parent f97cba5 commit 11b79c4

File tree

1 file changed

+5
-46
lines changed

1 file changed

+5
-46
lines changed

Sources/Workspace/Workspace.swift

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,8 +2364,6 @@ extension Workspace {
23642364
explicitProduct: String? = nil,
23652365
forceResolution: Bool,
23662366
constraints: [PackageContainerConstraint],
2367-
retryOnPackagePathMismatch: Bool = true,
2368-
resetPinsStoreOnFailure: Bool = true,
23692367
observabilityScope: ObservabilityScope
23702368
) throws -> DependencyManifests {
23712369
// Ensure the cache path exists and validate that edited dependencies.
@@ -2452,51 +2450,12 @@ extension Workspace {
24522450

24532451
// Update the pinsStore.
24542452
let updatedDependencyManifests = try self.loadDependencyManifests(root: graphRoot, observabilityScope: observabilityScope)
2455-
2456-
// If we still have required URLs, we probably cloned a wrong URL for
2457-
// some package dependency.
2458-
//
2459-
// This would usually happen when we're resolving from scratch and the
2460-
// resolved file has an outdated entry for a transitive dependency whose
2461-
// URL was changed. For e.g., the resolved file could refer to a dependency
2462-
// through a ssh url but its new reference is now changed to http.
2453+
// If we still have missing packages, something is fundamentally wrong with the resolution of the graph
24632454
let stillMissingPackages = updatedDependencyManifests.computePackages().missing
2464-
if !stillMissingPackages.isEmpty {
2465-
if retryOnPackagePathMismatch {
2466-
// Retry resolution which will most likely resolve correctly now since
2467-
// we have the manifest files of all the dependencies.
2468-
return try self.resolve(
2469-
root: root,
2470-
explicitProduct: explicitProduct,
2471-
forceResolution: forceResolution,
2472-
constraints: constraints,
2473-
retryOnPackagePathMismatch: false,
2474-
resetPinsStoreOnFailure: resetPinsStoreOnFailure,
2475-
observabilityScope: observabilityScope
2476-
)
2477-
} else if resetPinsStoreOnFailure, !pinsStore.pinsMap.isEmpty {
2478-
// If we weren't able to resolve properly even after a retry, it
2479-
// could mean that the dependency at fault has a different
2480-
// version of the manifest file which contains dependencies that
2481-
// have also changed their package references.
2482-
pinsStore.unpinAll()
2483-
try pinsStore.saveState(toolsVersion: rootManifestsMinimumToolsVersion)
2484-
// try again with pins reset
2485-
return try self.resolve(
2486-
root: root,
2487-
explicitProduct: explicitProduct,
2488-
forceResolution: forceResolution,
2489-
constraints: constraints,
2490-
retryOnPackagePathMismatch: false,
2491-
resetPinsStoreOnFailure: false,
2492-
observabilityScope: observabilityScope
2493-
)
2494-
} else {
2495-
// give up
2496-
let missing = stillMissingPackages.map{ $0.description }
2497-
observabilityScope.emit(error: "exhausted attempts to resolve the dependencies graph, with '\(missing.joined(separator: "', '"))' unresolved.")
2498-
return updatedDependencyManifests
2499-
}
2455+
guard stillMissingPackages.isEmpty else {
2456+
let missing = stillMissingPackages.map{ $0.description }
2457+
observabilityScope.emit(error: "exhausted attempts to resolve the dependencies graph, with '\(missing.joined(separator: "', '"))' unresolved.")
2458+
return updatedDependencyManifests
25002459
}
25012460

25022461
self.pinAll(

0 commit comments

Comments
 (0)