This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore the ASP.NET Core meta packages"
- Loading branch information
Showing
1 changed file
with
53 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,53 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using NuKeeper.Inspection.Files; | ||
using NuKeeper.Inspection.Logging; | ||
using NuKeeper.Inspection.NuGetApi; | ||
using NuKeeper.Inspection.RepositoryInspection; | ||
using NuKeeper.Inspection.Sources; | ||
|
||
namespace NuKeeper.Inspection | ||
{ | ||
public class UpdateFinder: IUpdateFinder | ||
{ | ||
private readonly IRepositoryScanner _repositoryScanner; | ||
private readonly IPackageUpdatesLookup _packageUpdatesLookup; | ||
private readonly INuKeeperLogger _logger; | ||
|
||
public UpdateFinder( | ||
IRepositoryScanner repositoryScanner, | ||
IPackageUpdatesLookup packageUpdatesLookup, | ||
INuKeeperLogger logger) | ||
{ | ||
_repositoryScanner = repositoryScanner; | ||
_packageUpdatesLookup = packageUpdatesLookup; | ||
_logger = logger; | ||
} | ||
|
||
public async Task<IReadOnlyCollection<PackageUpdateSet>> FindPackageUpdateSets( | ||
IFolder workingFolder, | ||
NuGetSources sources, | ||
VersionChange allowedChange) | ||
{ | ||
// scan for nuget packages | ||
var packages = _repositoryScanner.FindAllNuGetPackages(workingFolder) | ||
.ToList(); | ||
|
||
_logger.Log(PackagesFoundLogger.Log(packages)); | ||
|
||
// look for updates to these packages | ||
var updates = await _packageUpdatesLookup.FindUpdatesForPackages( | ||
packages, sources, allowedChange); | ||
|
||
_logger.Log(UpdatesLogger.Log(updates)); | ||
return updates; | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using NuKeeper.Inspection.Files; | ||
using NuKeeper.Inspection.Logging; | ||
using NuKeeper.Inspection.NuGetApi; | ||
using NuKeeper.Inspection.RepositoryInspection; | ||
using NuKeeper.Inspection.Sources; | ||
|
||
namespace NuKeeper.Inspection | ||
{ | ||
public class UpdateFinder: IUpdateFinder | ||
{ | ||
private readonly IRepositoryScanner _repositoryScanner; | ||
private readonly IPackageUpdatesLookup _packageUpdatesLookup; | ||
private readonly INuKeeperLogger _logger; | ||
|
||
// ASP.NET Core has well know packages that should either be implicitly versioned, or carefully selected based on installed runtime | ||
private static readonly List<string> _knownIgnoredPackages = new List<string> | ||
{"Microsoft.AspNetCore.App", " Microsoft.AspNetCore.All"}; | ||
|
||
public UpdateFinder( | ||
IRepositoryScanner repositoryScanner, | ||
IPackageUpdatesLookup packageUpdatesLookup, | ||
INuKeeperLogger logger) | ||
{ | ||
_repositoryScanner = repositoryScanner; | ||
_packageUpdatesLookup = packageUpdatesLookup; | ||
_logger = logger; | ||
} | ||
|
||
public async Task<IReadOnlyCollection<PackageUpdateSet>> FindPackageUpdateSets( | ||
IFolder workingFolder, | ||
NuGetSources sources, | ||
VersionChange allowedChange) | ||
{ | ||
// scan for nuget packages | ||
var packages = _repositoryScanner.FindAllNuGetPackages(workingFolder) | ||
.Where(x => !_knownIgnoredPackages.Contains(x.Id, StringComparer.OrdinalIgnoreCase)) | ||
.ToList(); | ||
|
||
_logger.Log(PackagesFoundLogger.Log(packages)); | ||
|
||
// look for updates to these packages | ||
var updates = await _packageUpdatesLookup.FindUpdatesForPackages( | ||
packages, sources, allowedChange); | ||
|
||
_logger.Log(UpdatesLogger.Log(updates)); | ||
return updates; | ||
} | ||
} | ||
} |