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

Simplify getting the build projects from the GraphBuildResult. #144

Merged
merged 1 commit into from
Apr 16, 2022
Merged
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
27 changes: 10 additions & 17 deletions src/Ionide.ProjInfo/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -777,19 +777,12 @@ type WorkspaceLoaderViaProjectGraph private (toolsPath, ?globalProperties: (stri

bm.EndBuild()

let rec walkResults (known: String Set) (results: ProjectGraphNode seq) =
seq {
for nodeKey in results do
if known |> Set.contains nodeKey.ProjectInstance.FullPath |> not then
yield nodeKey
let cache = Set.add nodeKey.ProjectInstance.FullPath known
yield! walkResults cache nodeKey.ProjectReferences
else
yield! walkResults known nodeKey.ProjectReferences
}

let resultsByNode = walkResults Set.empty (result.ResultsByNode |> Seq.map (fun kvp -> kvp.Key)) |> Seq.cache
let buildProjs = resultsByNode |> Seq.map (fun p -> p.ProjectInstance.FullPath) |> Seq.toList
let buildProjs =
result.ResultsByNode.Keys
|> Seq.collect (fun (pgn: ProjectGraphNode) ->
seq { yield pgn.ProjectInstance
yield! Seq.map (fun (pr:ProjectGraphNode) -> pr.ProjectInstance) pgn.ProjectReferences })
|> Seq.toList

logger.info (
Log.setMessage "{overallCode}, projects built {count} {projects} "
Expand All @@ -800,11 +793,11 @@ type WorkspaceLoaderViaProjectGraph private (toolsPath, ?globalProperties: (stri
)

let projects =
resultsByNode
|> Seq.distinctBy (fun p -> p.ProjectInstance.FullPath)
|> Seq.map (fun p ->
buildProjs
|> List.distinctBy (fun (p:ProjectInstance) -> p.FullPath)
|> Seq.map (fun (p:ProjectInstance) ->

p.ProjectInstance.FullPath, ProjectLoader.getLoadedProjectInfo p.ProjectInstance.FullPath customProperties (ProjectLoader.LoadedProject p.ProjectInstance))
p.FullPath, ProjectLoader.getLoadedProjectInfo p.FullPath customProperties (ProjectLoader.LoadedProject p))

|> Seq.choose (fun (projectPath, projectOptionResult) ->
match projectOptionResult with
Expand Down