Skip to content

Commit

Permalink
Using RestoreArgs sources to consume explicit sources
Browse files Browse the repository at this point in the history
  • Loading branch information
jainaashish authored and nkolev92 committed Feb 13, 2019
1 parent ae27a18 commit e87dd77
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,6 @@ private List<SourceRepository> GetEffectiveSourcesCore(ISettings settings, IList
// Create a shared caching provider if one does not exist already
CachingSourceProvider = new CachingSourceProvider(packageSourceProvider);
}
else
{
foreach(var source in CachingSourceProvider.GetRepositories())
{
if (!sourceObjects.ContainsKey(source.PackageSource.Source))
{
sourceObjects.Add(source.PackageSource.Source, source.PackageSource);
}
}
}

return sourceObjects.Select(entry => CachingSourceProvider.CreateRepository(entry.Value)).ToList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ private static RestoreArgs GetRestoreContext(
bool restoreForceEvaluate)
{
var caching = new CachingSourceProvider(new PackageSourceProvider(context.Settings));
foreach( var source in sources)
{
caching.AddSourceRepository(source);
}

var dgProvider = new DependencyGraphSpecRequestProvider(providerCache, dgFile);

Expand All @@ -301,7 +297,8 @@ private static RestoreArgs GetRestoreContext(
CachingSourceProvider = caching,
ParentId = parentId,
IsRestoreOriginalAction = isRestoreOriginalAction,
RestoreForceEvaluate = restoreForceEvaluate
RestoreForceEvaluate = restoreForceEvaluate,
Sources = sources.Select(source => source.PackageSource.Source).ToList()
};

return restoreContext;
Expand Down
8 changes: 0 additions & 8 deletions src/NuGet.Core/NuGet.Protocol/CachingSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ public SourceRepository CreateRepository(PackageSource source, FeedType type)
return _cachedSources.GetOrAdd(source.Source, new SourceRepository(source, _resourceProviders, type));
}

public void AddSourceRepository(SourceRepository source)
{
if(_cachedSources.TryAdd(source.PackageSource.Source, source))
{
_repositories.Add(source);
}
}

public IPackageSourceProvider PackageSourceProvider
{
get { return _packageSourceProvider; }
Expand Down

0 comments on commit e87dd77

Please sign in to comment.