Пример #1
0
        /// <summary>
        /// Retrieves the NuGet packages according to the set parameters.
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        internal async Task <UpdaterPackage[]> GetPackages(CancellationToken ct)
        {
            var packages   = new List <UpdaterPackage>();
            var references = await SolutionHelper.GetPackageReferences(ct, _parameters.SolutionRoot, _parameters.UpdateTarget, _log);

            _log.Write($"Found {references.Length} references");

            if (_parameters.Feeds.Any())
            {
                _log.Write($"Retrieving packages from {_parameters.Feeds.Count} feeds");
            }

            foreach (var reference in references.OrderBy(r => r.Identity))
            {
                if (_parameters.PackagesToIgnore.Contains(reference.Identity.Id) ||
                    (_parameters.PackagesToUpdate.Any() && !_parameters.PackagesToUpdate.Contains(reference.Identity.Id))
                    )
                {
                    _log.Write(new UpdateOperation(reference.Identity, isIgnored: true));
                    continue;
                }

                packages.Add(new UpdaterPackage(reference, await reference.GetLatestVersion(ct, packages, _parameters)));
            }

            return(packages.ToArray());
        }
Пример #2
0
        private async Task <IEnumerable <PackageIdentity> > GetPackagesToDownload(CancellationToken ct, string solutionPath, IPackageFeed source)
        {
            var references = await SolutionHelper.GetPackageReferences(ct, solutionPath, FileType.All, _log);

            var identities = new HashSet <PackageIdentity>(references.Select(r => r.Identity));

            return(await GetPackagesWithDependencies(ct, identities, source));
        }