Наследование: PackageWalker, IPackageOperationResolver
		void WalkPackage (IPackage package)
		{
			var localRepository = new FakePackageRepository ();
			var sourceRepository = new FakePackageRepository ();
			var walker = new InstallWalker (localRepository, sourceRepository, null, NullLogger.Instance, true, false, DependencyVersion.Lowest);
			walker.Walk (package);
		}
Пример #2
0
        protected void InstallPackage(
            IPackage package,
            FrameworkName targetFramework,
            bool ignoreDependencies,
            bool allowPrereleaseVersions,
            bool ignoreWalkInfo = false)
        {
            if (WhatIf)
            {
                // This prevents InstallWalker from downloading the packages
                ignoreWalkInfo = true;
            }

            var installerWalker = new InstallWalker(
                LocalRepository, SourceRepository,
                targetFramework, Logger,
                ignoreDependencies, allowPrereleaseVersions,
                DependencyVersion)
            {
                DisableWalkInfo        = ignoreWalkInfo,
                CheckDowngrade         = CheckDowngrade,
                SkipPackageTargetCheck = SkipPackageTargetCheck
            };

            Execute(package, installerWalker);
        }
Пример #3
0
 private static IEnumerable<IPackage> GetPackageDependencies(IPackage package, IPackageRepository localRepository, IPackageRepository sourceRepository)
 {
     var walker = new InstallWalker(
         localRepository,
         sourceRepository,
         new FrameworkName(".NET Framework, Version=4.0"),
         NullLogger.Instance,
         ignoreDependencies: false,
         allowPrereleaseVersions: true);
     return (from operation in walker.ResolveOperations(package)
             where operation.Action == PackageAction.Install
             select operation.Package);
 }
Пример #4
0
        public IEnumerable<IPackage> FindDependenciesToBeInstalled(IPackage package)
        {
            // We don't currently sync the set of dependencies/packates to be installed
            // with the target framework of the user's site. We'd need to supply a framework
            // version here to add that feature.
            InstallWalker walker = new InstallWalker(
                _webProjectManager.LocalRepository, 
                _webProjectManager.SourceRepository,
                TargetFramework,
                NullLogger.Instance,
                ignoreDependencies: false, 
                allowPrereleaseVersions: IncludePrerelease);
            IEnumerable<PackageOperation> operations = walker.ResolveOperations(package);

            return from operation in operations
                   where operation.Package != package && operation.Action == PackageAction.Install
                   select operation.Package;
        }
        public void InstallPackage(IPackageDetails package, bool allowedPrerelease)
        {
            Argument.IsNotNull(() => package);
            Argument.IsOfType(() => package, typeof (PackageDetails));

            var repository = _packageOperationContextService.CurrentContext.Repository;
            var sourceRepository = _repositoryCacheService.GetNuGetRepository(repository);

            var walker = new InstallWalker(_localRepository, sourceRepository, null, _logger, false, allowedPrerelease, DependencyVersion);

            try
            {
                var nuGetPackage = ((PackageDetails) package).Package;
                var operations = walker.ResolveOperations(nuGetPackage);
                _packageManager.InstallPackage(nuGetPackage, false, allowedPrerelease, false);
            }
            catch (Exception exception)
            {
                _logger.Log(MessageLevel.Error, exception.Message);
                _packageOperationContextService.CurrentContext.CatchedExceptions.Add(exception);
            }
        }
Пример #6
0
        private static IEnumerable<IPackage> GetPackageDependencies(IPackage package, IPackageRepository localRepository, IPackageRepository sourceRepository, bool allowPrereleaseVersions)
        {
            InstallWalker walker = new InstallWalker(
                localRepository: localRepository, 
                sourceRepository: sourceRepository, 
                logger: NullLogger.Instance,
                targetFramework: TargetFramework,
                ignoreDependencies: false, 
                allowPrereleaseVersions: allowPrereleaseVersions);
            IEnumerable<PackageOperation> operations = walker.ResolveOperations(package);

            return from operation in operations
                   where operation.Action == PackageAction.Install
                   select operation.Package;
        }
		public ReinstallPackageOperations GetReinstallPackageOperations (IEnumerable<IPackage> packages)
		{
			var installWalker = new InstallWalker (
				LocalRepository,
				SourceRepository,
				ProjectManager.Project.TargetFramework,
				ProjectManager.Logger,
				ignoreDependencies: true,
				allowPrereleaseVersions: false,
				dependencyVersion: DependencyVersion.Lowest);

			IList<IPackage> packagesInDependencyOrder;
			IList<PackageOperation> operations = installWalker.ResolveOperations (
				packages,
				out packagesInDependencyOrder,
				allowPrereleaseVersionsBasedOnPackage: true);

			return new ReinstallPackageOperations (operations, packagesInDependencyOrder);
		}
 static IEnumerable<IPackage> GetPackageDependencies(IPackage package, IPackageRepository localRepository, IPackageRepository sourceRepository)
 {
     IPackageRepository repository = localRepository;
     IPackageRepository repository2 = sourceRepository;
     ILogger instance = NullLogger.Instance;
     bool ignoreDependencies = false;
     var walker = new InstallWalker(repository, repository2, instance, ignoreDependencies);
     return
         walker.ResolveOperations(package).Where(delegate(PackageOperation operation) { return (operation.Action == PackageAction.Install); }).Select(
             delegate(PackageOperation operation) { return operation.Package; });
 }
Пример #9
0
        protected void InstallPackage(
            IPackage package,
            FrameworkName targetFramework,
            bool ignoreDependencies,
            bool allowPrereleaseVersions,
            bool ignoreWalkInfo = false)
        {
            if (WhatIf)
            {
                // This prevents InstallWalker from downloading the packages
                ignoreWalkInfo = true;
            }

            var installerWalker = new InstallWalker(
                LocalRepository, SourceRepository,
                targetFramework, Logger,
                ignoreDependencies, allowPrereleaseVersions,
                DependencyVersion)
            {
                DisableWalkInfo = ignoreWalkInfo,
                CheckDowngrade = CheckDowngrade
            };
            Execute(package, installerWalker);
        }
Пример #10
0
        public IEnumerable<IPackage> GetPackagesToBeInstalledForUpdateAll()
        {
            InstallWalker walker = new InstallWalker(
                _webProjectManager.LocalRepository,
                _webProjectManager.SourceRepository,
                TargetFramework,
                NullLogger.Instance,
                ignoreDependencies: false,
                allowPrereleaseVersions: IncludePrerelease);
            
            var packagesToUpdate = GetPackagesWithUpdates();
            var allOperations = new List<PackageOperation>();

            foreach (IPackage package in packagesToUpdate)
            {
                if (!allOperations.Any(operation => operation.Action == PackageAction.Install &&
                    operation.Package.Id == package.Id &&
                    operation.Package.Version == package.Version))
                {
                    var operations = walker.ResolveOperations(package);
                    allOperations.AddRange(operations);
                }
            }

            return (from operation in allOperations
                   where operation.Action == PackageAction.Install
                   select operation.Package).Distinct();
        }
Пример #11
0
 private static IEnumerable<IPackage> GetPackageDependencies(IPackage package, IPackageRepository localRepository, IPackageRepository sourceRepository)
 {
     IPackageRepository repository = localRepository;
     IPackageRepository repository2 = sourceRepository;
     ILogger instance = NullLogger.Instance;
     bool ignoreDependencies = false;
     var  walker = new InstallWalker(repository, repository2, new FrameworkName(".NETFramework", new Version("4.0")),  instance, ignoreDependencies,true);
     return walker.ResolveOperations(package).Where<PackageOperation>(delegate(PackageOperation operation)
     {
         return (operation.Action == PackageAction.Install);
     }).Select<PackageOperation, IPackage>(delegate(PackageOperation operation)
     {
         return operation.Package;
     });
 }