Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process dependencytree from top to bottom #4249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/Paket.Core/PaketConfigFiles/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ type LockFile (fileName:string, groups: Map<GroupName,LockFileGroup>) =

member this.GetOrderedPackageHull(groupName,referencesFile:ReferencesFile,targetProfileOpt) =
let usedPackageKeys = HashSet<_>()
let toVisit = ref Set.empty
let toVisit = ref []
let cliTools = ref Set.empty
let resolution =
match this.Groups |> Map.tryFind groupName with
Expand Down Expand Up @@ -920,15 +920,14 @@ type LockFile (fileName:string, groups: Map<GroupName,LockFileGroup>) =
usedPackageKeys.Add k |> ignore

let deps = this.GetDirectDependenciesOfSafe(groupName,p.Name,referencesFile.FileName)

toVisit := Set.add (k,p,deps) !toVisit
toVisit := List.append toVisit.contents [(k,p,deps)]
| None -> ()

let visited = Dictionary<_,_>()

while !toVisit <> Set.empty do
let current = Set.minElement !toVisit
toVisit := Set.remove current !toVisit
while !toVisit <> List.empty do
let current = toVisit.Value[0]
toVisit := toVisit.Value.Tail

let visitKey,p,deps = current
if visited.ContainsKey(visitKey) then ()
Expand All @@ -937,9 +936,9 @@ type LockFile (fileName:string, groups: Map<GroupName,LockFileGroup>) =

let groupName,_packageName = visitKey
for dep in deps do
let deps = this.GetDirectDependenciesOfSafe(groupName,dep,referencesFile.FileName)
let deps2 = this.GetDirectDependenciesOfSafe(groupName,dep,referencesFile.FileName)
let packagageSettings = { p with Settings = { p.Settings with Aliases = Map.empty }}
toVisit := Set.add ((groupName,dep),packagageSettings,deps) !toVisit
toVisit := List.append toVisit.contents [((groupName,dep),packagageSettings,deps2)]

let emitted = HashSet<_>()
[while visited.Count > 0 do
Expand Down