@@ -42,17 +42,17 @@ private static void AnalyseStandalone(
4242 ( compilation , options ) => analyser . Initialize ( output . FullName , extractionInput . CompilationInfos , compilation , options ) ,
4343 ( ) =>
4444 {
45- foreach ( var type in analyser . MissingNamespaces )
45+ foreach ( var type in analyser . ExtractionContext ! . MissingNamespaces )
4646 {
4747 progressMonitor . MissingNamespace ( type ) ;
4848 }
4949
50- foreach ( var type in analyser . MissingTypes )
50+ foreach ( var type in analyser . ExtractionContext ! . MissingTypes )
5151 {
5252 progressMonitor . MissingType ( type ) ;
5353 }
5454
55- progressMonitor . MissingSummary ( analyser . MissingTypes . Count ( ) , analyser . MissingNamespaces . Count ( ) ) ;
55+ progressMonitor . MissingSummary ( analyser . ExtractionContext ! . MissingTypes . Count ( ) , analyser . ExtractionContext ! . MissingNamespaces . Count ( ) ) ;
5656 } ) ;
5757 }
5858 finally
@@ -69,29 +69,6 @@ private static void AnalyseStandalone(
6969 }
7070 }
7171
72- private static void ExtractStandalone (
73- ExtractionInput extractionInput ,
74- IProgressMonitor pm ,
75- ILogger logger ,
76- CommonOptions options )
77- {
78- var stopwatch = new Stopwatch ( ) ;
79- stopwatch . Start ( ) ;
80-
81- var canonicalPathCache = CanonicalPathCache . Create ( logger , 1000 ) ;
82- var pathTransformer = new PathTransformer ( canonicalPathCache ) ;
83-
84- using var analyser = new StandaloneAnalyser ( pm , logger , pathTransformer , canonicalPathCache , false ) ;
85- try
86- {
87- AnalyseStandalone ( analyser , extractionInput , options , pm , stopwatch ) ;
88- }
89- catch ( Exception ex ) // lgtm[cs/catch-of-all-exceptions]
90- {
91- analyser . Logger . Log ( Severity . Error , " Unhandled exception: {0}" , ex ) ;
92- }
93- }
94-
9572 private class ExtractionProgress : IProgressMonitor
9673 {
9774 public ExtractionProgress ( ILogger output )
@@ -141,8 +118,8 @@ public record ExtractionInput(IEnumerable<string> Sources, IEnumerable<string> R
141118
142119 public static ExitCode Run ( Options options )
143120 {
144- var stopwatch = new Stopwatch ( ) ;
145- stopwatch . Start ( ) ;
121+ var overallStopwatch = new Stopwatch ( ) ;
122+ overallStopwatch . Start ( ) ;
146123
147124 using var logger = new ConsoleLogger ( options . Verbosity , logThreadId : true ) ;
148125 logger . Log ( Severity . Info , "Extracting C# with build-mode set to 'none'" ) ;
@@ -158,12 +135,26 @@ public static ExitCode Run(Options options)
158135
159136 logger . Log ( Severity . Info , "" ) ;
160137 logger . Log ( Severity . Info , "Extracting..." ) ;
161- ExtractStandalone (
162- new ExtractionInput ( dependencyManager . AllSourceFiles , dependencyManager . ReferenceFiles , dependencyManager . CompilationInfos ) ,
163- new ExtractionProgress ( logger ) ,
164- fileLogger ,
165- options ) ;
166- logger . Log ( Severity . Info , $ "Extraction completed in { stopwatch . Elapsed } ") ;
138+
139+ var analyzerStopwatch = new Stopwatch ( ) ;
140+ analyzerStopwatch . Start ( ) ;
141+
142+ var canonicalPathCache = CanonicalPathCache . Create ( fileLogger , 1000 ) ;
143+ var pathTransformer = new PathTransformer ( canonicalPathCache ) ;
144+
145+ var progressMonitor = new ExtractionProgress ( logger ) ;
146+ using var analyser = new StandaloneAnalyser ( progressMonitor , fileLogger , pathTransformer , canonicalPathCache , false ) ;
147+ try
148+ {
149+ var extractionInput = new ExtractionInput ( dependencyManager . AllSourceFiles , dependencyManager . ReferenceFiles , dependencyManager . CompilationInfos ) ;
150+ AnalyseStandalone ( analyser , extractionInput , options , progressMonitor , analyzerStopwatch ) ;
151+ }
152+ catch ( Exception ex ) // lgtm[cs/catch-of-all-exceptions]
153+ {
154+ fileLogger . Log ( Severity . Error , " Unhandled exception: {0}" , ex ) ;
155+ }
156+
157+ logger . Log ( Severity . Info , $ "Extraction completed in { overallStopwatch . Elapsed } ") ;
167158
168159 return ExitCode . Ok ;
169160 }
0 commit comments