@@ -42,17 +42,17 @@ private static void AnalyseStandalone(
42
42
( compilation , options ) => analyser . Initialize ( output . FullName , extractionInput . CompilationInfos , compilation , options ) ,
43
43
( ) =>
44
44
{
45
- foreach ( var type in analyser . MissingNamespaces )
45
+ foreach ( var type in analyser . ExtractionContext ! . MissingNamespaces )
46
46
{
47
47
progressMonitor . MissingNamespace ( type ) ;
48
48
}
49
49
50
- foreach ( var type in analyser . MissingTypes )
50
+ foreach ( var type in analyser . ExtractionContext ! . MissingTypes )
51
51
{
52
52
progressMonitor . MissingType ( type ) ;
53
53
}
54
54
55
- progressMonitor . MissingSummary ( analyser . MissingTypes . Count ( ) , analyser . MissingNamespaces . Count ( ) ) ;
55
+ progressMonitor . MissingSummary ( analyser . ExtractionContext ! . MissingTypes . Count ( ) , analyser . ExtractionContext ! . MissingNamespaces . Count ( ) ) ;
56
56
} ) ;
57
57
}
58
58
finally
@@ -69,29 +69,6 @@ private static void AnalyseStandalone(
69
69
}
70
70
}
71
71
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
-
95
72
private class ExtractionProgress : IProgressMonitor
96
73
{
97
74
public ExtractionProgress ( ILogger output )
@@ -141,8 +118,8 @@ public record ExtractionInput(IEnumerable<string> Sources, IEnumerable<string> R
141
118
142
119
public static ExitCode Run ( Options options )
143
120
{
144
- var stopwatch = new Stopwatch ( ) ;
145
- stopwatch . Start ( ) ;
121
+ var overallStopwatch = new Stopwatch ( ) ;
122
+ overallStopwatch . Start ( ) ;
146
123
147
124
using var logger = new ConsoleLogger ( options . Verbosity , logThreadId : true ) ;
148
125
logger . Log ( Severity . Info , "Extracting C# with build-mode set to 'none'" ) ;
@@ -158,12 +135,26 @@ public static ExitCode Run(Options options)
158
135
159
136
logger . Log ( Severity . Info , "" ) ;
160
137
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 } ") ;
167
158
168
159
return ExitCode . Ok ;
169
160
}
0 commit comments