67 references to LibraryDependencyIndex
NuGet.Commands (67)
RestoreCommand\DependencyGraphResolver.cs (39)
184Dictionary<LibraryDependencyIndex, VersionRange>? pinnedPackageVersions = IndexPinnedPackageVersions(isCentralPackageTransitivePinningEnabled, projectTargetFramework); 190LibraryDependencyIndex = LibraryDependencyIndex.Project, 192Suppressions = new HashSet<LibraryDependencyIndex>(), 204Dictionary<LibraryDependencyIndex, ResolvedDependencyGraphItem> resolvedDependencyGraphItems = await ResolveDependencyGraphItemsAsync( 319Dictionary<LibraryDependencyIndex, ResolvedDependencyGraphItem> resolvedDependencyGraphItems, 337HashSet<LibraryDependencyIndex> visitedItems = new(); 340Queue<(LibraryDependencyIndex, LibraryRangeIndex, GraphNode<RemoteResolveResult>)> itemsToFlatten = new(); 345Dictionary<LibraryRangeIndex, (LibraryRangeIndex FromParentLibraryRangeIndex, LibraryDependency FromLibraryDependency, LibraryRangeIndex ToParentLibraryRangeIndex, LibraryDependencyIndex ToLibraryDependencyIndex, bool IsCentralTransitive)> downgrades = new(); 348ResolvedDependencyGraphItem projectResolvedDependencyGraphItem = resolvedDependencyGraphItems[LibraryDependencyIndex.Project]; 359itemsToFlatten.Enqueue((LibraryDependencyIndex.Project, projectResolvedDependencyGraphItem.LibraryRangeIndex, rootGraphNode)); 365(LibraryDependencyIndex currentLibraryDependencyIndex, LibraryRangeIndex currentLibraryRangeIndex, GraphNode<RemoteResolveResult> currentGraphNode) = itemsToFlatten.Dequeue(); 398LibraryDependencyIndex childLibraryDependencyIndex = resolvedDependencyGraphItem.GetDependencyIndexForDependencyAt(i); 433if ((childLibraryDependencyIndex != LibraryDependencyIndex.Project && childLibraryDependency.SuppressParent == LibraryIncludeFlags.All) 668foreach ((LibraryRangeIndex FromParentLibraryRangeIndex, LibraryDependency FromLibraryDependency, LibraryRangeIndex ToParentLibraryRangeIndex, LibraryDependencyIndex ToLibraryDependencyIndex, bool IsCentralTransitive) downgrade in downgrades.Values) 706foreach (KeyValuePair<LibraryDependencyIndex, ResolvedDependencyGraphItem> resolvedDependencyGraphItemEntry in resolvedDependencyGraphItems) 888/// <returns>A <see cref="Dictionary{TKey, TValue}" /> of indexed version ranges by their <see cref="LibraryDependencyIndex" /> if central transitive pinning is enabled, otherwise <see langword="null" />.</returns> 889private Dictionary<LibraryDependencyIndex, VersionRange>? IndexPinnedPackageVersions(bool isCentralPackageTransitivePinningEnabled, TargetFrameworkInformation? projectTargetFramework) 896Dictionary<LibraryDependencyIndex, VersionRange>? pinnedPackageVersions = new(capacity: projectTargetFramework.CentralPackageVersions.Count); 900LibraryDependencyIndex libraryDependencyIndex = _indexingTable.Index(item.Value); 908private async Task<Dictionary<LibraryDependencyIndex, ResolvedDependencyGraphItem>> ResolveDependencyGraphItemsAsync( 913Dictionary<LibraryDependencyIndex, VersionRange>? pinnedPackageVersions, 924Dictionary<LibraryDependencyIndex, ResolvedDependencyGraphItem> resolvedDependencyGraphItems = new(ResolvedDependencyGraphItemDictionarySize); 927HashSet<LibraryDependencyIndex>? directPackageReferences = default; 933Dictionary<LibraryRangeIndex, (LibraryRangeIndex[], LibraryDependencyIndex, LibraryDependencyTarget)> evictions = new Dictionary<LibraryRangeIndex, (LibraryRangeIndex[], LibraryDependencyIndex, LibraryDependencyTarget)>(EvictionsDictionarySize); 976bool isRootProject = currentDependencyGraphItem.LibraryDependencyIndex == LibraryDependencyIndex.Project; 981if (evictions.TryGetValue(currentDependencyGraphItem.LibraryRangeIndex, out (LibraryRangeIndex[], LibraryDependencyIndex, LibraryDependencyTarget) eviction)) 983(LibraryRangeIndex[] evictedPath, LibraryDependencyIndex evictedDepIndex, LibraryDependencyTarget evictedTypeConstraint) = eviction; 1093foreach (KeyValuePair<LibraryRangeIndex, (LibraryRangeIndex[], LibraryDependencyIndex, LibraryDependencyTarget)> evictee in evictions) 1095(LibraryRangeIndex[] evicteePath, LibraryDependencyIndex evicteeDepIndex, LibraryDependencyTarget evicteeTypeConstraint) = evictee.Value; 1123foreach (KeyValuePair<LibraryDependencyIndex, ResolvedDependencyGraphItem> chosenItem in resolvedDependencyGraphItems) 1211foreach (HashSet<LibraryDependencyIndex> chosenDependencyGraphItemSuppression in chosenResolvedItem.Suppressions) 1251directPackageReferences = new HashSet<LibraryDependencyIndex>(capacity: chosenResolvedItem.Item.Data.Dependencies.Count); 1264HashSet<LibraryDependencyIndex>? suppressions = default; 1280LibraryDependencyIndex chosenResolvedItemChildLibraryDependencyIndex = chosenResolvedItem.GetDependencyIndexForDependencyAt(i); 1285suppressions ??= new HashSet<LibraryDependencyIndex>(capacity: chosenResolvedItem.Item.Data.Dependencies.Count - i); 1309LibraryDependencyIndex childLibraryDependencyIndex = chosenResolvedItem.GetDependencyIndexForDependencyAt(i); 1311if (childLibraryDependencyIndex == LibraryDependencyIndex.Project) 1319bool isRootPackageReference = (currentDependencyGraphItem.LibraryDependencyIndex == LibraryDependencyIndex.Project) && isPackage;
RestoreCommand\DependencyGraphResolver.DependencyGraphItem.cs (2)
47public LibraryDependencyIndex LibraryDependencyIndex { get; init; } 72public HashSet<LibraryDependencyIndex>? Suppressions { get; init; }
RestoreCommand\DependencyGraphResolver.DependencyGraphItemIndexer.cs (16)
58/// A case-insensitive dictionary that stores a <see cref="LibraryDependencyIndex" /> by the name of a library. 60private readonly ConcurrentDictionary<string, LibraryDependencyIndex> _libraryDependencyTable = new ConcurrentDictionary<string, LibraryDependencyIndex>(StringComparer.OrdinalIgnoreCase); 70private LibraryDependencyIndex _nextLibraryDependencyIndex = LibraryDependencyIndex.Project + 1; 83_libraryDependencyTable.TryAdd(libraryDependency.Name, LibraryDependencyIndex.Project); 88/// Indexes a <see cref="LibraryDependency" /> and returns a <see cref="LibraryDependencyIndex" /> associated with the its name. 91/// <returns>A <see cref="LibraryDependencyIndex" /> representing the unique integer associated with the name of the library.</returns> 92public LibraryDependencyIndex Index(LibraryDependency libraryDependency) => Index(libraryDependency.Name); 95/// Indexes a <see cref="CentralPackageVersion" /> and returns a <see cref="LibraryDependencyIndex" /> associated with the its name."/> 98/// <returns>A <see cref="LibraryDependencyIndex" /> representing the unique integer associated with the name of the library.</returns> 99public LibraryDependencyIndex Index(CentralPackageVersion centralPackageVersion) => Index(centralPackageVersion.Name); 102/// Indexes a library by its name and returns a <see cref="LibraryDependencyIndex" /> associated with it. 105/// <returns>A <see cref="LibraryDependencyIndex" /> representing the unique integer associated with the name of the library.</returns> 106private LibraryDependencyIndex Index(string name) 111if (_libraryDependencyTable.TryGetValue(name, out LibraryDependencyIndex index))
RestoreCommand\DependencyGraphResolver.ResolvedDependencyGraphItem.cs (10)
21/// Stores an array containing all of the <see cref="LibraryDependencyIndex" /> of dependencies of this item. This allows fast lookup of their indices rather than having to convert the name to an index. 23private LibraryDependencyIndex[] _dependencyIndices; 63_dependencyIndices = Array.Empty<LibraryDependencyIndex>(); 69_dependencyIndices = new LibraryDependencyIndex[dependencyCount]; 123/// Gets or sets a <see cref="List{T}" /> of <see cref="HashSet{T}" /> containing <see cref="LibraryDependencyIndex" /> representing dependencies that should be suppressed under this item. 125public required List<HashSet<LibraryDependencyIndex>> Suppressions { get; init; } 128/// Gets the <see cref="LibraryDependencyIndex" /> of the dependency at the specified position. 130/// <param name="position">The position of the dependency to get the <see cref="LibraryDependencyIndex" /> of.</param> 131/// <returns>The <see cref="LibraryDependencyIndex" /> of the dependency at the specified position.</returns> 132public LibraryDependencyIndex GetDependencyIndexForDependencyAt(int position)