@@ -107,20 +107,19 @@ let TestHardcodedFiles() =
107107 analyseEfficiency graph
108108
109109let private parseProjectAndGetSourceFiles ( projectFile : string ) =
110- log " building project"
111110 let m = AnalyzerManager()
112111 let analyzer = m.GetProject( projectFile)
113112 let results = analyzer.Build()
114113 // TODO Generalise for multiple TFMs
115114 let res = results.Results |> Seq.head
116115 let files = res.SourceFiles
117- log " built"
116+ log " built project using Buildalyzer "
118117 files
119118
120119[<TestCase( @" C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" ) >]
121120[<TestCase( @" C:\projekty\fsharp\fsharp_main\src\Compiler\FSharp.Compiler.Service.fsproj" ) >]
122121let TestProject ( projectFile : string ) =
123- log " start "
122+ log $ " Start finding file dependency graph for {projectFile} "
124123 let files = parseProjectAndGetSourceFiles projectFile
125124 let files =
126125 files
@@ -130,22 +129,24 @@ let TestProject (projectFile : string) =
130129 { Name = f; Code = code; AST = ast}
131130 )
132131 |> Array.filter ( fun x ->
133- ASTVisit.extractModuleRefs x.AST
134- |> Array.forall ( function | ReferenceOrAbbreviation.Reference _ -> true | ReferenceOrAbbreviation.Abbreviation _ -> false )
132+ true
133+ //ASTVisit.extractModuleRefs x.AST
134+ //|> Array.forall (function | ReferenceOrAbbreviation.Reference _ -> true | ReferenceOrAbbreviation.Abbreviation _ -> false)
135135 )
136136 let N = files.Length
137137 log $" {N} files read and parsed"
138138
139139 let graph = AutomatedDependencyResolving.detectFileDependencies files
140- log " deps detected"
140+ log " Deps detected"
141141
142142 let totalDeps = graph.Graph |> Seq.sumBy ( fun ( KeyValue ( idx , deps )) -> deps.Length)
143143 let maxPossibleDeps = ( N * ( N-1 )) / 2
144144
145145 let graphJson = graph.Graph |> Seq.map ( fun ( KeyValue ( idx , deps )) -> graph.Files[ idx]. Name, deps |> Array.map ( fun d -> graph.Files[ d]. Name)) |> dict
146146 let json = JsonConvert.SerializeObject( graphJson, Formatting.Indented)
147- System.IO.File.WriteAllText( " deps_graph.json" , json)
147+ let path = $" {System.IO.Path.GetFileName(projectFile)}.deps.json"
148+ System.IO.File.WriteAllText( path, json)
148149
149- printfn $" Analysed {N} files, detected {totalDeps}/{maxPossibleDeps} file dependencies."
150- printfn " Wrote graph as json in deps_graph.json "
150+ log $" Analysed {N} files, detected {totalDeps}/{maxPossibleDeps} file dependencies ( %.1f {100.0 * double(totalDeps) / double(maxPossibleDeps)}%%) ."
151+ log $ " Wrote graph in {path} "
151152 analyseEfficiency graph
0 commit comments