-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeFileGenerator.fs
43 lines (33 loc) · 1.55 KB
/
MakeFileGenerator.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module MakeFileGenerator
open System
open System.Collections.Generic
open Ast
open System.Text
let MakeProjectDependencyList projectDependencyList =
projectDependencyList
|> List.map (fun dependency -> match dependency with | Ast.ProjectDependency(guid) -> guid)
let MakeProjectLookUpTable ast =
match ast with
| Ast.SolutionFile((Ast.Version(_), projectList, _)) ->
projectList
|> List.toSeq
|> Seq.map (fun project ->
match project with
| Ast.Project(Ast.ProjectInfo(_,Ast.ProjectName(name),Ast.ProjectPath(path), Ast.ProjectGuid(guid)), projectDependencyList) ->
(guid, (name, path, (MakeProjectDependencyList projectDependencyList))))
|> Map.ofSeq
let AllProjectTargets (projectLookupTable:seq<KeyValuePair<Guid,String*String*Guid list>>) =
Seq.fold (fun (accum:StringBuilder) (kvp:KeyValuePair<Guid,String*String*Guid list>) ->
accum.Append(" ").Append(kvp.Value |> (fun (name, _ , _) -> name)))
(new StringBuilder())
projectLookupTable
let rec VisitSolutionConfigurationGlobalSection globalSectionList =
match globalSectionList with
| SolutionConfigurationPlatforms(theSolutionConfigs)::_ ->
Some(theSolutionConfigs)
| _::tail -> VisitSolutionConfigurationGlobalSection tail
| [] -> None
let MakeSolutionConfigPlatforms ast =
match ast with
| Ast.SolutionFile((_, _,globalSectionList)) ->
(VisitSolutionConfigurationGlobalSection globalSectionList).Value