Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Download all packages even the ones that don't end up in the lock file
Browse files Browse the repository at this point in the history
- This makes it so that we avoid hitting remote sources in the most
common cases.

#2061
  • Loading branch information
davidfowl committed Jun 28, 2015
1 parent 7ce27f7 commit 00bda88
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Microsoft.Framework.PackageManager/Restore/RestoreCommand.cs
Expand Up @@ -463,9 +463,7 @@ private async Task<bool> RestoreForProject(string projectJsonPath, string rootDi
{
ForEach(context.Root, node =>
{
if (node == null ||
node.LibraryRange == null ||
node.Disposition == GraphNode.DispositionType.Rejected)
if (node == null || node.LibraryRange == null)
{
return;
}
Expand Down Expand Up @@ -503,16 +501,24 @@ private async Task<bool> RestoreForProject(string projectJsonPath, string rootDi
if (!isInstallItem && isRemote)
{
// It's ok to download rejected nodes so we avoid downloading them in the future
// The trade off is that subsequent restores avoid going to any remotes
installItems.Add(node.Item);
}
var isGraphItem = graphItems.Any(item => item.Match.Library == node.Item.Match.Library);
if (!isGraphItem)
// Don't add rejected nodes since we only want to write reduced nodes
// to the lock file
if (node.Disposition != GraphNode.DispositionType.Rejected)
{
graphItems.Add(node.Item);
}
var isGraphItem = graphItems.Any(item => item.Match.Library == node.Item.Match.Library);
context.Libraries.Add(node.Item.Match.Library);
if (!isGraphItem)
{
graphItems.Add(node.Item);
}
context.Libraries.Add(node.Item.Match.Library);
}
});
}

Expand Down Expand Up @@ -1027,4 +1033,4 @@ private class TargetContext
public GraphNode Root { get; set; }
}
}
}
}

0 comments on commit 00bda88

Please sign in to comment.