Skip to content

Commit 9f9d1ea

Browse files
Simplify model
1 parent 1f52a01 commit 9f9d1ea

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

src/Paths.fs

+1-8
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ type Location =
99
| Rel of RelPath
1010
| Abs of AbsPath
1111

12-
type FileLocation = FileLocation of Location
13-
type DirLocation = DirLocation of Location
14-
1512
let toAbs (AbsPath anchorPath) (RelPath relativeSegment) =
1613
let anchorDir = Path.GetDirectoryName(anchorPath)
1714
Path.Combine(anchorDir, relativeSegment) |> Path.GetFullPath |> AbsPath
@@ -25,8 +22,4 @@ let normalize anchor location =
2522
let toLocation(str : string) =
2623
match Path.IsPathRooted(str) with
2724
| true -> str |> AbsPath |> Location.Abs
28-
| false -> str |> RelPath |> Location.Rel
29-
30-
let toFileLocation = toLocation >> FileLocation
31-
32-
let toDirLocation = toLocation >> FileLocation
25+
| false -> str |> RelPath |> Location.Rel

src/Program.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let main argv =
5555

5656
let builder = { GetEdges = Projects.GetProjectDependencies }
5757

58-
let originProject = argData.ProjectFile |> Paths.toFileLocation |> Projects.ProjectRef
58+
let originProject = argData.ProjectFile |> Paths.toLocation |> Projects.ProjectRef
5959

6060
let originNode = Graph.Build(builder, originProject)
6161

src/Projects.fs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ open System.Xml.Linq
44
open BulkAdd.Paths
55
open System.IO
66

7-
type ProjectRef = ProjectRef of FileLocation
8-
let private getXml(FileLocation location) =
7+
type ProjectRef = ProjectRef of Location
8+
let private getXml(location) =
99
match location with
1010
| Abs (AbsPath path) -> XElement.Load path
1111
| Rel (RelPath path) -> XElement.Load path
@@ -17,14 +17,14 @@ let private getProjectDependencies(projectPath : AbsPath) =
1717
let (AbsPath projectFilePath) = projectPath
1818
let projectXml = XElement.Load(projectFilePath)
1919

20-
let makeReference = Paths.normalize projectPath >> FileLocation >> ProjectRef
20+
let makeReference = Paths.normalize projectPath >> ProjectRef
2121

2222
projectXml.Descendants !!"ProjectReference"
2323
|> Seq.choose (getAttribute !!"Include")
2424
|> Seq.map (fun attr -> attr.Value |> Paths.toLocation |> makeReference)
2525
|> Seq.toList
2626

27-
let GetProjectDependencies(ProjectRef (FileLocation location)) =
27+
let GetProjectDependencies(ProjectRef location) =
2828
let pwd = System.Environment.CurrentDirectory |> AbsPath
2929
match location with
3030
| Rel relPath -> relPath |> Paths.toAbs pwd |> getProjectDependencies

0 commit comments

Comments
 (0)