67 references to LibraryDependencyIndex
NuGet.Commands (67)
RestoreCommand\DependencyGraphResolver.cs (39)
184
Dictionary<
LibraryDependencyIndex
, VersionRange>? pinnedPackageVersions = IndexPinnedPackageVersions(isCentralPackageTransitivePinningEnabled, projectTargetFramework);
190
LibraryDependencyIndex =
LibraryDependencyIndex
.Project,
192
Suppressions = new HashSet<
LibraryDependencyIndex
>(),
204
Dictionary<
LibraryDependencyIndex
, ResolvedDependencyGraphItem> resolvedDependencyGraphItems = await ResolveDependencyGraphItemsAsync(
319
Dictionary<
LibraryDependencyIndex
, ResolvedDependencyGraphItem> resolvedDependencyGraphItems,
337
HashSet<
LibraryDependencyIndex
> visitedItems = new();
340
Queue<(
LibraryDependencyIndex
, LibraryRangeIndex, GraphNode<RemoteResolveResult>)> itemsToFlatten = new();
345
Dictionary<LibraryRangeIndex, (LibraryRangeIndex FromParentLibraryRangeIndex, LibraryDependency FromLibraryDependency, LibraryRangeIndex ToParentLibraryRangeIndex,
LibraryDependencyIndex
ToLibraryDependencyIndex, bool IsCentralTransitive)> downgrades = new();
348
ResolvedDependencyGraphItem projectResolvedDependencyGraphItem = resolvedDependencyGraphItems[
LibraryDependencyIndex
.Project];
359
itemsToFlatten.Enqueue((
LibraryDependencyIndex
.Project, projectResolvedDependencyGraphItem.LibraryRangeIndex, rootGraphNode));
365
(
LibraryDependencyIndex
currentLibraryDependencyIndex, LibraryRangeIndex currentLibraryRangeIndex, GraphNode<RemoteResolveResult> currentGraphNode) = itemsToFlatten.Dequeue();
398
LibraryDependencyIndex
childLibraryDependencyIndex = resolvedDependencyGraphItem.GetDependencyIndexForDependencyAt(i);
433
if ((childLibraryDependencyIndex !=
LibraryDependencyIndex
.Project && childLibraryDependency.SuppressParent == LibraryIncludeFlags.All)
668
foreach ((LibraryRangeIndex FromParentLibraryRangeIndex, LibraryDependency FromLibraryDependency, LibraryRangeIndex ToParentLibraryRangeIndex,
LibraryDependencyIndex
ToLibraryDependencyIndex, bool IsCentralTransitive) downgrade in downgrades.Values)
706
foreach (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>
889
private Dictionary<
LibraryDependencyIndex
, VersionRange>? IndexPinnedPackageVersions(bool isCentralPackageTransitivePinningEnabled, TargetFrameworkInformation? projectTargetFramework)
896
Dictionary<
LibraryDependencyIndex
, VersionRange>? pinnedPackageVersions = new(capacity: projectTargetFramework.CentralPackageVersions.Count);
900
LibraryDependencyIndex
libraryDependencyIndex = _indexingTable.Index(item.Value);
908
private async Task<Dictionary<
LibraryDependencyIndex
, ResolvedDependencyGraphItem>> ResolveDependencyGraphItemsAsync(
913
Dictionary<
LibraryDependencyIndex
, VersionRange>? pinnedPackageVersions,
924
Dictionary<
LibraryDependencyIndex
, ResolvedDependencyGraphItem> resolvedDependencyGraphItems = new(ResolvedDependencyGraphItemDictionarySize);
927
HashSet<
LibraryDependencyIndex
>? directPackageReferences = default;
933
Dictionary<LibraryRangeIndex, (LibraryRangeIndex[],
LibraryDependencyIndex
, LibraryDependencyTarget)> evictions = new Dictionary<LibraryRangeIndex, (LibraryRangeIndex[],
LibraryDependencyIndex
, LibraryDependencyTarget)>(EvictionsDictionarySize);
976
bool isRootProject = currentDependencyGraphItem.LibraryDependencyIndex ==
LibraryDependencyIndex
.Project;
981
if (evictions.TryGetValue(currentDependencyGraphItem.LibraryRangeIndex, out (LibraryRangeIndex[],
LibraryDependencyIndex
, LibraryDependencyTarget) eviction))
983
(LibraryRangeIndex[] evictedPath,
LibraryDependencyIndex
evictedDepIndex, LibraryDependencyTarget evictedTypeConstraint) = eviction;
1093
foreach (KeyValuePair<LibraryRangeIndex, (LibraryRangeIndex[],
LibraryDependencyIndex
, LibraryDependencyTarget)> evictee in evictions)
1095
(LibraryRangeIndex[] evicteePath,
LibraryDependencyIndex
evicteeDepIndex, LibraryDependencyTarget evicteeTypeConstraint) = evictee.Value;
1123
foreach (KeyValuePair<
LibraryDependencyIndex
, ResolvedDependencyGraphItem> chosenItem in resolvedDependencyGraphItems)
1211
foreach (HashSet<
LibraryDependencyIndex
> chosenDependencyGraphItemSuppression in chosenResolvedItem.Suppressions)
1251
directPackageReferences = new HashSet<
LibraryDependencyIndex
>(capacity: chosenResolvedItem.Item.Data.Dependencies.Count);
1264
HashSet<
LibraryDependencyIndex
>? suppressions = default;
1280
LibraryDependencyIndex
chosenResolvedItemChildLibraryDependencyIndex = chosenResolvedItem.GetDependencyIndexForDependencyAt(i);
1285
suppressions ??= new HashSet<
LibraryDependencyIndex
>(capacity: chosenResolvedItem.Item.Data.Dependencies.Count - i);
1309
LibraryDependencyIndex
childLibraryDependencyIndex = chosenResolvedItem.GetDependencyIndexForDependencyAt(i);
1311
if (childLibraryDependencyIndex ==
LibraryDependencyIndex
.Project)
1319
bool isRootPackageReference = (currentDependencyGraphItem.LibraryDependencyIndex ==
LibraryDependencyIndex
.Project) && isPackage;
RestoreCommand\DependencyGraphResolver.DependencyGraphItem.cs (2)
47
public
LibraryDependencyIndex
LibraryDependencyIndex { get; init; }
72
public 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.
60
private readonly ConcurrentDictionary<string,
LibraryDependencyIndex
> _libraryDependencyTable = new ConcurrentDictionary<string,
LibraryDependencyIndex
>(StringComparer.OrdinalIgnoreCase);
70
private
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>
92
public
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>
99
public
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>
106
private
LibraryDependencyIndex
Index(string name)
111
if (_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.
23
private
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.
125
public 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>
132
public
LibraryDependencyIndex
GetDependencyIndexForDependencyAt(int position)