public RepushPackageCommand( IPackageCache packageCache, IPackageUrlParser packageUrlParser) { _packageCache = packageCache; _packageUrlParser = packageUrlParser; }
public Get(IPackageRepositoryFactory packageRepositoryFactory, IPackageSourceProvider sourceProvider, IPackageRepository cacheRepository, IFileSystem fileSystem, IPackageCache packageCache) : this(packageRepositoryFactory, sourceProvider) { _cacheRepository = cacheRepository; OutputFileSystem = fileSystem; _packageCache = packageCache; }
/// <summary> /// Executes the command. /// </summary> public override void ExecuteCommand() { //Probably need some better return code logic here... if (Arguments[0] == null) { return; } try { if (Source.Count == 1 && !NoFeedSpecificCache && !NoCache) { _cacheManager = new NuGetCacheManager(Console); _cacheManager.SetFeedSpecificCacheDirectory(_sources[0]); } if (!NoCache) { if (_cacheRepository == null) { _cacheRepository = MachineCache.Default; } } //TODO This needs injecting.... if (_packageCache == null) { _packageCache = new MemoryBasedPackageCache(Console); } _repository = GetRepository(); _packageResolutionManager = new PackageResolutionManager(Console, Latest, _packageCache); //HACK need to inject somehow... _packageResolutionManager = _packageResolutionManager ?? new PackageResolutionManager(Console, Latest, new MemoryBasedPackageCache(Console)); //Working on a package.config if (string.IsNullOrEmpty(_baseDirectory)) { _baseDirectory = Environment.CurrentDirectory; } var target = Arguments[0] == Path.GetFullPath(Arguments[0]) ? Arguments[0] : Path.GetFullPath(Path.Combine(_baseDirectory, Arguments[0])); if (Path.GetFileName(target).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { OutputFileSystem = CreateFileSystem(Path.GetPathRoot(target)); GetByPackagesConfig(OutputFileSystem, target); } else { OutputFileSystem = CreateFileSystem(Directory.GetParent(target).FullName); GetByDirectoryPath(OutputFileSystem, target); } } catch (Exception e) { //HACK big catch here, but if anything goes wrong we want to log it and ensure a non-zero exit code... throw new CommandLineException(String.Format("GET Failed: {0}", e.Message), e); } }
public PackageManager( IPackageCache packageCache, IPackageLookup packageLookup, IPackageLocator packageLocator) { this.m_PackageCache = packageCache; _packageLookup = packageLookup; this.m_PackageLocator = packageLocator; }
public NuGetPackageExtractor(System.IO.Abstractions.IFileSystem fs, ILog log, IPackageCache packageCache, TextWriter output, IInstanceConfiguration instanceConfiguration, IApplicationMap applicationMap) { _fs = fs; _log = log; _packageCache = packageCache; _output = output; _instanceConfiguration = instanceConfiguration; _applicationMap = applicationMap; }
public static IEnumerable <string> Scan(IPackageCache packageCache) { foreach (var package in packageCache.Packages) { if (package.PackageVersions.Count(v => v.IsReferenced) > 1) { yield return ($"{package.Name}: multiple versions in use: {string.Join(", ", package.PackageVersions.Where(v => v.IsReferenced).Select(v => v.Version.ToString()))}"); } } }
public SolutionFileProcessor(ISolution solution, IPackageCache packageCache, Func <string, IProject> projectFactoryFunc, Func <string, IPackage> packageFactoryFunc, PackageCacheProcessor packageCacheProcessor, ILogger logger) { _solution = solution ?? throw new ArgumentNullException(nameof(solution)); _packageCache = packageCache ?? throw new ArgumentNullException(nameof(packageCache)); _projectFactoryFunc = projectFactoryFunc ?? throw new ArgumentNullException(nameof(projectFactoryFunc)); _packageFactoryFunc = packageFactoryFunc ?? throw new ArgumentNullException(nameof(packageFactoryFunc)); _packageCacheProcessor = packageCacheProcessor ?? throw new ArgumentNullException(nameof(packageCacheProcessor)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (_solution.Projects == null) { throw new ArgumentException("Projects collection must be initialized", nameof(solution)); } }
public PackageManager( IPackageCache packageCache, IPackageLookup packageLookup, IPackageLocator packageLocator, IPackageGlobalTool packageGlobalTool, IPackageRedirector packageRedirector) { this.packageRedirector = packageRedirector; this.m_PackageCache = packageCache; _packageLookup = packageLookup; this.m_PackageLocator = packageLocator; this.m_PackageGlobalTool = packageGlobalTool; }
private readonly Regex _rangeVersionRegex = new Regex(@"(\[|\()(([0-9\.,]+))(\]|\))"); // see https://docs.microsoft.com/en-us/nuget/concepts/package-versioning public PackageCacheProcessor(Func <string, IPackage> packageFactoryFunc, Func <string, IPackageVersion> packageVersionFactoryFunc, IPackageCache packageCache, ILogger logger) { _packageFactoryFunc = packageFactoryFunc ?? throw new ArgumentNullException(nameof(packageFactoryFunc)); _packageVersionFactoryFunc = packageVersionFactoryFunc ?? throw new ArgumentNullException(nameof(packageVersionFactoryFunc)); _packageCache = packageCache ?? throw new ArgumentNullException(nameof(packageCache)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (_packageCache.Packages == null) { throw new ArgumentException($"{nameof(_packageCache.Packages)} was not initialized", nameof(packageCache)); } if (_packageCache.PackagesDictionary == null) { throw new ArgumentException($"{nameof(_packageCache.PackagesDictionary)} was not initialized", nameof(packageCache)); } }
public ProjectFileProcessor(Func <string, IProject> projectFactoryFunc, Func <string, IPackage> packageFactoryFunc, ISolution solution, PackageCacheProcessor packageCacheProcessor, AppConfigFileProcessor appConfigFileProcessor, PackagesConfigFileProcessor packagesConfigFileProcessor, IPackageCache packageCache, ILogger logger) { _projectFactoryFunc = projectFactoryFunc ?? throw new ArgumentNullException(nameof(projectFactoryFunc)); _packageFactoryFunc = packageFactoryFunc ?? throw new ArgumentNullException(nameof(packageFactoryFunc)); _solution = solution ?? throw new ArgumentNullException(nameof(solution)); _packageCacheProcessor = packageCacheProcessor ?? throw new ArgumentNullException(nameof(packageCacheProcessor)); _appConfigFileProcessor = appConfigFileProcessor ?? throw new ArgumentNullException(nameof(appConfigFileProcessor)); _packagesConfigFileProcessor = packagesConfigFileProcessor; _packageCache = packageCache ?? throw new ArgumentNullException(nameof(packageCache)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (_packageCache.Packages == null) { throw new ArgumentException($"{nameof(_packageCache.Packages)} was not initialized", nameof(packageCache)); } if (_packageCache.PackagesDictionary == null) { throw new ArgumentException($"{nameof(_packageCache.PackagesDictionary)} was not initialized", nameof(packageCache)); } }
public static ICollection <IPackage> GetReferencedPackages(IPackageCache packageCache) { foreach (var package in packageCache.Packages) { package.IsReferenced = false; foreach (var packageVersion in package.PackageVersions) { packageVersion.IsReferenced = false; } } foreach (var package in packageCache.Packages.Where(p => p.ReferencingProjects.Any())) { package.IsReferenced = package.HasVersions; MarkReferences(package); } return(packageCache.Packages.Where(p => p.IsReferenced).ToList()); }
public Get(IPackageRepository cacheRepository, IFileSystem fileSystem, IPackageCache packageCache) { _cacheRepository = cacheRepository; OutputFileSystem = fileSystem; _packageCache = packageCache; }
public ProjectBuilder(ISolution solution, IPackageCache packageCache, Action <IProject, string> logErrorAction) { _solution = solution; _packageCache = packageCache; _logErrorAction = logErrorAction; }
/// <summary> /// Creates a new PackageResolutionManager. /// </summary> /// <param name="console"></param> /// <param name="latest"></param> /// <param name="cache"> </param> public PackageResolutionManager(ILogger console, Boolean latest, IPackageCache cache) { Console = console; Latest = latest; _cache = cache; }
public SourcePackageContent(IPackageCache packageCache) { this.m_PackageCache = packageCache; }
/// <summary> /// Executes the command. /// </summary> public override void ExecuteCommand() { //Probably need some better return code logic here... if (Arguments[0] == null) return; try { if (Source.Count == 1 && !NoFeedSpecificCache && !NoCache) { _cacheManager = new NuGetCacheManager(Console); _cacheManager.SetFeedSpecificCacheDirectory(_sources[0]); } if (!NoCache) if (_cacheRepository == null) _cacheRepository = MachineCache.Default; //TODO This needs injecting.... if (_packageCache == null) _packageCache = new MemoryBasedPackageCache(Console); _repository = GetRepository(); _packageResolutionManager = new PackageResolutionManager(Console, Latest, _packageCache); //HACK need to inject somehow... _packageResolutionManager = _packageResolutionManager ?? new PackageResolutionManager(Console, Latest, new MemoryBasedPackageCache(Console)); //Working on a package.config if (string.IsNullOrEmpty(_baseDirectory)) _baseDirectory = Environment.CurrentDirectory; var target = Arguments[0] == Path.GetFullPath(Arguments[0]) ? Arguments[0] : Path.GetFullPath(Path.Combine(_baseDirectory, Arguments[0])); if (Path.GetFileName(target).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { OutputFileSystem = CreateFileSystem(Path.GetPathRoot(target)); GetByPackagesConfig(OutputFileSystem, target); } else { OutputFileSystem = CreateFileSystem(Directory.GetParent(target).FullName); GetByDirectoryPath(OutputFileSystem, target); } } catch (Exception e) { //HACK big catch here, but if anything goes wrong we want to log it and ensure a non-zero exit code... throw new CommandLineException(String.Format("GET Failed: {0}",e.Message),e); } }
public Get(IPackageRepositoryFactory packageRepositoryFactory, IPackageSourceProvider sourceProvider, IPackageRepository cacheRepository, IFileSystem fileSystem, IPackageCache packageCache) :this(packageRepositoryFactory, sourceProvider) { _cacheRepository = cacheRepository; OutputFileSystem = fileSystem; _packageCache = packageCache; }
public ReferenceResolver(ISolution solution, IPackageCache packageCache, Action <IContext, string> logWarning) { _solution = solution; _packageCache = packageCache; _logWarning = logWarning; }