-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hashtable to resolve circular rust dependencies (#975)
- Loading branch information
1 parent
d38bde5
commit b65fa8a
Showing
1 changed file
with
8 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ public class RustCliDetector : FileComponentDetector, IExperimentalDetector | |
{ | ||
private readonly ICommandLineInvocationService cliService; | ||
|
||
private readonly HashSet<string> visitedDependencies = new(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
FernandoRojo
Author
Contributor
|
||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="RustCliDetector"/> class. | ||
/// </summary> | ||
|
@@ -153,7 +155,12 @@ private void TraverseAndRecordComponents( | |
|
||
foreach (var dep in node.Deps) | ||
{ | ||
this.TraverseAndRecordComponents(recorder, location, graph, dep.Pkg, detectedComponent, dep, packagesMetadata, parent == null); | ||
var componentKey = $"{detectedComponent.Component.Id}{dep.Pkg}"; | ||
if (!this.visitedDependencies.Contains(componentKey)) | ||
{ | ||
this.visitedDependencies.Add(componentKey); | ||
this.TraverseAndRecordComponents(recorder, location, graph, dep.Pkg, detectedComponent, dep, packagesMetadata, parent == null); | ||
} | ||
} | ||
} | ||
catch (IndexOutOfRangeException e) | ||
|
This is global to the Detector, which is instantianted as a singleton. If we're scanning multiple
Cargo.toml
s, this might ignore crates previously scanned that may have different features enabled (and thus different transitive dependencies)