Skip to content
Permalink
Browse files

[Assets] Store pendingPackageUpgrades in PackageSession

  • Loading branch information
xen2 committed Sep 25, 2018
1 parent f933c14 commit 335b65354de2fdb1a331cc61c4e995c142ceaae1
@@ -93,6 +93,8 @@ private async Task PreLoadPackageDependencies(ILogger log, SolutionProject proje

// Check if there is any package upgrade to do
var pendingPackageUpgrades = new List<PendingPackageUpgrade>();
pendingPackageUpgradesPerPackage.Add(package, pendingPackageUpgrades);

foreach (var item in restoreGraph.Flattened)
{
if (item.Key.Type == LibraryType.Package)
@@ -400,6 +400,7 @@ public sealed partial class PackageSession : IDisposable, IAssetFinder
/// </summary>
public static readonly Version DefaultVisualStudioVersion = new Version("14.0.23107.0");

private Dictionary<Package, List<PendingPackageUpgrade>> pendingPackageUpgradesPerPackage = new Dictionary<Package, List<PendingPackageUpgrade>>();
private readonly ConstraintProvider constraintProvider = new ConstraintProvider();
private readonly PackageCollection packages;
private readonly Dictionary<Package, Package> packagesCopy;
@@ -1280,6 +1281,8 @@ private void UnRegisterPackage(Package package)

packagesCopy.Remove(package);

pendingPackageUpgradesPerPackage.Remove(package);

IsDirty = true;
}

@@ -1363,8 +1366,10 @@ private bool TryLoadAssets(PackageSession session, ILogger log, Package package,
if (dependencyError)
return false;

// TODO CSPROJ=XKPKG: get package upgraders from PreLoadPackageDependencies
var pendingPackageUpgrades = new List<PendingPackageUpgrade>();
// Get pending package upgrades
if (!pendingPackageUpgradesPerPackage.TryGetValue(package, out var pendingPackageUpgrades))
pendingPackageUpgrades = new List<PendingPackageUpgrade>();
pendingPackageUpgradesPerPackage.Remove(package);

// Note: Default state is upgrade failed (for early exit on error/exceptions)
// We will update to success as soon as loading is finished.

0 comments on commit 335b653

Please sign in to comment.
You can’t perform that action at this time.