-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BuildCheck Replay Mode #10224
BuildCheck Replay Mode #10224
Conversation
…o reuse it for binlog replay 2. removed inheritance of EventArgsDispatcher from BinaryLogReplayEventSource, instead use it as a field 3. created BuildCheckEventArgsDispatcher
… AnalysisDisatcherContext; remove commented code
Looks like there is a compatibility problem
I will change the implementation slightly to make it compatible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good!
It feels that it deserves a small diagram or a design description
src/Build/BuildCheck/Infrastructure/BuildCheckBinaryLogReplaySourcerWrapper.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/AnalysisContext/AnalysisLoggingContext.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @surayya-MS - to me it appears to be a solid implementation!!
I'd love to see the description of the replay mechanics, together with the diagram as part of the https://github.com/dotnet/msbuild/blob/main/documentation/specs/proposed/BuildCheck-Architecture.md
The new interfaces and classes would probably benefit from brief xml comments (doesn't have to be on each method - but at least for the whole type)
One diagram I'd like (not blocking for this PR but I think it'd help) is something like this: graph LR
Real[Live build] -->|EventArgs| mux[???] -->|BuildCheck API| check[BuildCheck<br/><i>#40;doesn't care about<br/>live vs replay#41;</i>]
log[Replayed log] -->|EventArgs| mux
check -->|Check results| out[???]
with those question-mark blocks filled in. |
src/Build/BuildCheck/Infrastructure/AnalysisContext/AnalysisDispatchingContext.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/AnalysisContext/AnalysisDispatchingContext.cs
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/AnalysisContext/AnalysisDispatchingContext.cs
Outdated
Show resolved
Hide resolved
src/Build/BuildCheck/Infrastructure/BuildCheckBuildEventHandler.cs
Outdated
Show resolved
Hide resolved
…spatchingContext.cs Co-authored-by: Rainer Sigwald <[email protected]>
…spatchingContext.cs Co-authored-by: Rainer Sigwald <[email protected]>
…r.cs Co-authored-by: Rainer Sigwald <[email protected]>
Co-authored-by: Rainer Sigwald <[email protected]>
Co-authored-by: Rainer Sigwald <[email protected]>
Events come from BinaryLogReplayEventSource and passed to
The new events from BuildCheck are passed to the mergedEventSource |
Fixes #9760
Refactoring of BuildCheck infrastructure
Currently BuildCheck uses
LoggingService
andLoggingContext
produced by theAnalyzerLoggingContextFactory
.Removed usage of
LoggingService
instance and instead usedLoggingContext
to log events. This was needed becauseBuildCheckManager
could use theLoggingService
instance from the very first build that is no longer available afterwards. The commits:31af242
e47a8ff
Now I needed to decouple from
AnalyzerLoggingContext : LoggingContext
. The only usage ofAnalyzerLoggingContext
are these methods:LogComment
,LogCommentFromText
,LogErrorFromText
andLogBuildEvent
. So, I created IAnalysisContext with similar methods, and the names start withDispatch
:Then created AnalysisLoggingContext : IAnalysis that uses
LoggingService
and AnalysisLoggingContextFactory similar to the existing AnalyzerLoggingContextFactory.Implementing BuildCheck Replay Mode
Now, I need to be able to produce new
BuildEventArgs
and invoke it for the loggers to pick it up. Similar to whatLoggingService
does. For that reason, implemented AnalysisDispatchingContext : IAnalysisContext and the factory - AnalysisDispatchingContextFactory.Because the code for the creation of the events was duplicated, I put it all in a helper class EventsCreatorHelper.
Seperated the logic of handling the events from BuildCheckConnectorLogger and put it into BuildCheckBuildEventHandler to reuse it later.
The last part. When replaying binary log with BuildCheck enabled, I create a new IEventSource mergedEventSource. The logic is extracted into a new static class BuildCheckReplayModeConnector
replayEventSource
are passed to themergedEventSource
unchanged.BuildCheckBuildEventHandler.HandleBuildEvent
to thereplayEventSource.AnyEventRaised
event, in order to produce new events from BuildCheck.BuildCheckBuildEventHandler
instance usesmergedEventSource
to invoke new eventsBinaryLogReplayEventSource replaySource
Notes