You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
motivation: in some cases like two URLs with casing differences, package.resolved could be non-deterministic
changes:
* make the maanged dependencies location lookup case insensitive
* refactor how package.resolved is saved to test for non material differences
* adjust call sites that manipulate the pin store to be more efficient about when to save the resolved file
* add warning when expected dependency that should be stored in the resolved file is not found
* adjust call sites
TODO: add tests
observabilityScope.emit(warning:"required dependency \(dependency.identity) (\(dependency.locationString)) was not found in managed dependencies and will not be recorded in resolved file")
1343
+
}
1344
+
}
1345
+
1346
+
// FIXME
1347
+
// load the pin store from disk so we can compare for any changes
1348
+
// this is needed as we want to avoid re-writing the resolved files
1349
+
// unless absolutely required
1350
+
letstoredPinStore=try!self.pinsStore.load()
1351
+
1352
+
// compare for any differences between the existing state and the stored one
1353
+
// subtle changes between versions of SwiftPM could treat URLs differently
1354
+
// in which case we dont want to cause unnecessary churn
1355
+
varneedsUpdate=false
1356
+
if dependenciesToPin.count != storedPinStore.pinsMap.count {
1357
+
needsUpdate =true
1358
+
}else{
1359
+
fordependencyin dependenciesToPin {
1360
+
if !storedPinStore.pinsMap.contains(where:{ $0.value.packageRef.equalsIncludingLocation(dependency.packageRef)}){
1361
+
needsUpdate =true
1362
+
break
1363
+
}
1364
+
}
1365
+
}
1366
+
1367
+
// exist early is there is nothing to do
1368
+
guard needsUpdate else{
1369
+
return
1370
+
}
1371
+
1372
+
// reset the pinsStore and start pinning the required dependencies.
1373
+
pinsStore.unpinAll()
1374
+
fordependencyin dependenciesToPin {
1375
+
pinsStore.pin(dependency)
1376
+
}
1377
+
1378
+
/*
1337
1379
// Reset the pinsStore and start pinning the required dependencies.
1338
1380
pinsStore.unpinAll()
1339
1381
1382
+
let requiredDependencies = dependencyManifests.computePackages().required.filter({ $0.kind.isPinnable })
1383
+
for dependency in requiredDependencies {
1384
+
if let managedDependency = self.state.dependencies[comparingLocation: dependency] {
1385
+
pinsStore.pin(managedDependency)
1386
+
} else {
1387
+
observabilityScope.emit(warning: "required dependency \(dependency.identity) (\(dependency.locationString)) was not found in managed dependencies and will not be recorded in resolved file")
1388
+
}
1389
+
}
1390
+
*/
1391
+
1392
+
1393
+
/*
1340
1394
let requiredDependencies = dependencyManifests.computePackages().required
1341
1395
for dependency in self.state.dependencies {
1342
1396
if requiredDependencies.contains(where: { $0.equalsIncludingLocation(dependency.packageRef) }) {
letfirstLevelManifests=trytemp_await{self.loadManagedManifests(for: firstLevelDependencies, observabilityScope: observabilityScope, completion: $0)} // FIXME: this should not block
1654
1708
1655
1709
// Continue to load the rest of the manifest for this graph
@@ -1677,7 +1731,7 @@ extension Workspace {
1677
1731
// dependencies that have the same identity but from a different location
1678
1732
// which is an error case we diagnose an report about in the GraphLoading part which
1679
1733
// is prepared to handle the case where not all manifest are available
0 commit comments