File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,13 @@ internal class MSBuildLogger(IBaseProtocolClientManager baseProtocolClientManage
1414 private readonly ICollection < string > _diagnosticKeysCollection = [ ] ;
1515 private int Warnings = 0 ;
1616 private int Errors = 0 ;
17- private readonly DateTime _buildStartTimestamp ;
18- private readonly string [ ] _targetsOfInterest = [ "Clean" , "Build" , "Restore" ] ;
17+ private TimeProvider _timeProvider = TimeProvider . System ;
18+ private DateTimeOffset _buildStartTimestamp ;
19+ private readonly string [ ] _targetsOfInterest = [
20+ "Clean" ,
21+ "Build" ,
22+ "Restore" ,
23+ ] ;
1924
2025 public LoggerVerbosity Verbosity { get ; set ; } = LoggerVerbosity . Normal ;
2126
@@ -36,8 +41,12 @@ public void Initialize(IEventSource eventSource)
3641
3742 private void TargetStarted ( object sender , TargetStartedEventArgs e )
3843 {
39- if ( _targetsOfInterest . Contains ( e . TargetName , StringComparer . InvariantCultureIgnoreCase ) &&
40- e . BuildReason == TargetBuiltReason . None )
44+ if ( _buildStartTimestamp == null )
45+ {
46+ _buildStartTimestamp = _timeProvider . GetUtcNow ( ) ;
47+ }
48+
49+ if ( _targetsOfInterest . Contains ( e . TargetName , StringComparer . InvariantCultureIgnoreCase ) )
4150 {
4251 var taskId = new TaskId { Id = e . ProjectFile + "#" + e . TargetName + "#" + e . ThreadId } ;
4352 var taskStartParams = new TaskStartParams
You can’t perform that action at this time.
0 commit comments