Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
purkhusid committed Nov 3, 2023
1 parent 62e15bb commit 9b54ec1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Ionide.ProjInfo.ProjectSystem/WorkspacePeek.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ module WorkspacePeek =

let rec logger = LogProvider.getLoggerByQuotation <@ logger @>

type FsprojData = { Path: string; CompileItems: string list }

[<RequireQualifiedAccess>]
type Interesting =
| Solution of string * InspectSln.SolutionData
| Directory of string * string list
| Directory of string * FsprojData list

open System.IO

Expand Down Expand Up @@ -160,7 +162,11 @@ module WorkspacePeek =

None
| UsefulFile.Fsx -> Some(Choice2Of3(f.FullName))
| UsefulFile.FsProj -> Some(Choice3Of3(f.FullName))
| UsefulFile.FsProj ->
// TODO: Read the fsproj file and get the compile items
let compileItems = Ionide.ProjInfo.ProjectLoader.getFsprojCompileItemPaths f.FullName

Some(Choice3Of3(f.FullName, compileItems))

let found =
dirs
Expand All @@ -175,13 +181,12 @@ module WorkspacePeek =
let dir =
rootDir,
(fsprojs
|> List.sort)
|> List.sortBy (fun (p, _) -> p))

[
yield!
slns
|> List.map Interesting.Solution
yield
dir
|> Interesting.Directory
Interesting.Directory (fst dir, (snd dir) |> List.map (fun (p, c) -> { Path = p; CompileItems = c |> List.ofSeq }))
]
8 changes: 8 additions & 0 deletions src/Ionide.ProjInfo/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ open System.Diagnostics
open System.Runtime.InteropServices
open Ionide.ProjInfo.Logging
open Patterns
open System.Xml

/// functions for .net sdk probing
module SdkDiscovery =
Expand Down Expand Up @@ -599,6 +600,13 @@ module ProjectLoader =
}
)

let getFsprojCompileItemPaths (fsprojPath: string) =
use pc = new ProjectCollection(null)
let pi = pc.LoadProject(fsprojPath)
let pi = pi.CreateProjectInstance()
let compileItems = getCompileItems (LoadedProject pi)
compileItems |> Seq.map(fun i -> i.FullPath)

let getNuGetReferences (LoadedProject project) =
project.Items
|> Seq.filter (fun p ->
Expand Down

0 comments on commit 9b54ec1

Please sign in to comment.