public IPackage ResolveDependency(PackageDependency dependency, IPackageConstraintProvider constraintProvider, bool allowPrereleaseVersions, bool preferListedPackages, DependencyVersion dependencyVersion) { if (ResolveDependenciesVertically) { Func <IPackageRepository, IPackage> resolveDependency = Wrap( r => DependencyResolveUtility.ResolveDependency(r, dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion)); return(Repositories.Select(r => Task.Factory.StartNew(() => resolveDependency(r))) .ToArray() .WhenAny(package => package != null)); } return(DependencyResolveUtility.ResolveDependencyCore(this, dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion)); }
protected override IPackage ResolveDependency(PackageDependency dependency) { object[] args = new object[] { dependency }; this.Logger.Log(MessageLevel.Info, NuGetResources.Log_AttemptingToRetrievePackageFromSource, args); if (!this._isDowngrade) { IPackage package = DependencyResolveUtility.ResolveDependency(this.Repository, dependency, this.ConstraintProvider, true, false, base.DependencyVersion); if (package != null) { return(package); } } return(this.DependencyResolver.ResolveDependency(dependency, this.ConstraintProvider, this.AllowPrereleaseVersions, true, base.DependencyVersion)); }
protected override IPackage ResolveDependency(PackageDependency dependency) { Logger.Log(MessageLevel.Info, NuGetResources.Log_AttemptingToRetrievePackageFromSource, dependency); // First try to get a local copy of the package // Bug1638: Include prereleases when resolving locally installed dependencies. //Prerelease is included when we try to look at the local repository. //In case of downgrade, we are going to look only at source repo and not local. //That way we will downgrade dependencies when parent package is downgraded. if (!_isDowngrade) { IPackage package = DependencyResolveUtility.ResolveDependency(Repository, dependency, ConstraintProvider, allowPrereleaseVersions: true, preferListedPackages: false, dependencyVersion: DependencyVersion); if (package != null) { return(package); } } // Next, query the source repo for the same dependency IPackage sourcePackage = DependencyResolver.ResolveDependency(dependency, ConstraintProvider, AllowPrereleaseVersions, preferListedPackages: true, dependencyVersion: DependencyVersion); return(sourcePackage); }
protected override IPackage ResolveDependency(PackageDependency dependency) { return(DependencyResolveUtility.ResolveDependency(_repository, dependency, allowPrereleaseVersions: true, preferListedPackages: false)); }
public void Walk(IPackage package) { CheckPackageMinClientVersion(package); // Do nothing if we saw this package already if (Marker.IsVisited(package)) { ProcessPackageTarget(package); return; } OnBeforePackageWalk(package); // Mark the package as processing Marker.MarkProcessing(package); if (!IgnoreDependencies) { foreach (var dependency in package.GetCompatiblePackageDependencies(TargetFramework)) { // Try to resolve the dependency from the visited packages first IPackage resolvedDependency = DependencyResolveUtility.ResolveDependency( Marker, dependency, constraintProvider: null, allowPrereleaseVersions: AllowPrereleaseVersions, preferListedPackages: false, dependencyVersion: DependencyVersion); if (resolvedDependency == null) { resolvedDependency = ResolveDependency(dependency); } if (resolvedDependency == null) { OnDependencyResolveError(dependency); // If we're skipping dependency resolve errors then move on to the next // dependency if (SkipDependencyResolveError) { continue; } return; } if (!IgnoreWalkInfo) { // Set the parent PackageWalkInfo dependencyInfo = GetPackageInfo(resolvedDependency); dependencyInfo.Parent = package; } Marker.AddDependent(package, resolvedDependency); if (!OnAfterResolveDependency(package, resolvedDependency)) { continue; } if (Marker.IsCycle(resolvedDependency) || Marker.IsVersionCycle(resolvedDependency.Id)) { if (RaiseErrorOnCycle) { List <IPackage> packages = Marker.Packages.ToList(); packages.Add(resolvedDependency); throw new InvalidOperationException( String.Format(CultureInfo.CurrentCulture, NuGetResources.CircularDependencyDetected, String.Join(" => ", packages.Select(p => p.GetFullName())))); } continue; } Walk(resolvedDependency); } } // Mark the package as visited Marker.MarkVisited(package); ProcessPackageTarget(package); OnAfterPackageWalk(package); }
protected override IPackage ResolveDependency(PackageDependency dependency) => DependencyResolveUtility.ResolveDependency(this._repository, dependency, true, false);
public IPackage ResolveDependency(PackageDependency dependency, IPackageConstraintProvider constraintProvider, bool allowPrereleaseVersions, bool preferListedPackages, DependencyVersion dependencyVersion) { if (!this.ResolveDependenciesVertically) { return(DependencyResolveUtility.ResolveDependencyCore(this, dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion)); } Func <IPackageRepository, IPackage> resolveDependency = this.Wrap <IPackage>(r => DependencyResolveUtility.ResolveDependency(r, dependency, constraintProvider, allowPrereleaseVersions, preferListedPackages, dependencyVersion), null); return((from r in this.Repositories select Task.Factory.StartNew <IPackage>(() => resolveDependency(r))).ToArray <Task <IPackage> >().WhenAny <IPackage>(package => (package != null))); }