-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add Buildcheck events support + BuildSubmissionStarted #797
Merged
KirillOsenkov
merged 11 commits into
KirillOsenkov:main
from
YuliiaKovalova:dev/ykovalova/add_buildcheck_events_support
Aug 28, 2024
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8d5b2f8
add buildcheck events support + BuildSubmissionStartedEvent
YuliiaKovalova 90eee57
cleanup
YuliiaKovalova cbeb162
update file format version
YuliiaKovalova f6437c4
typo
YuliiaKovalova 7c47390
fix strings reading
YuliiaKovalova 3c35c19
Merge branch 'KirillOsenkov:main' into dev/ykovalova/add_buildcheck_e…
YuliiaKovalova 3a09df6
adjust reading buildcheck event args
YuliiaKovalova 72ec17a
remove extra code
YuliiaKovalova c03a9a7
fix review comments
YuliiaKovalova a13ee19
add new events to writer
YuliiaKovalova 779802d
add BuildSubmissionStartedEvent to writer
YuliiaKovalova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Build.Framework; | ||
|
||
namespace StructuredLogger.BinaryLogger | ||
{ | ||
/// <summary> | ||
/// Base class for all build check event args. | ||
/// Not intended to be extended by external code. | ||
/// </summary> | ||
internal abstract class BuildCheckEventArgs : BuildEventArgs | ||
{ } | ||
|
||
/// <summary> | ||
/// Transport mean for the BuildCheck tracing data from additional nodes. | ||
/// </summary> | ||
/// <param name="tracingData"></param> | ||
internal sealed class BuildCheckTracingEventArgs(Dictionary<string, TimeSpan> tracingData) : BuildCheckEventArgs | ||
{ | ||
public Dictionary<string, TimeSpan> TracingData { get; private set; } = tracingData; | ||
} | ||
|
||
internal sealed class BuildCheckAcquisitionEventArgs(string acquisitionPath, string projectPath) : BuildCheckEventArgs | ||
{ | ||
public string AcquisitionPath { get; private set; } = acquisitionPath; | ||
|
||
public string ProjectPath { get; private set; } = projectPath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/StructuredLogger/BinaryLogger/BuildSubmissionStartedEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Build.Framework; | ||
|
||
namespace StructuredLogger.BinaryLogger | ||
{ | ||
internal class BuildSubmissionStartedEvent() | ||
: BuildStatusEventArgs(message: "", helpKeyword: null, senderName: null, eventTimestamp: DateTime.UtcNow) | ||
{ | ||
public IDictionary<string, string?> GlobalProperties { get; set; } | ||
|
||
public IEnumerable<string> EntryProjectsFullPath { get; set; } | ||
|
||
public IEnumerable<string> TargetNames { get; set; } | ||
|
||
public BuildRequestDataFlags Flags { get; set; } | ||
|
||
public int SubmissionId { get; set; } | ||
} | ||
|
||
public enum BuildRequestDataFlags | ||
{ | ||
/// <summary> | ||
/// No flags. | ||
/// </summary> | ||
None = 0, | ||
|
||
/// <summary> | ||
/// When this flag is present, the existing ProjectInstance in the build will be replaced by this one. | ||
/// </summary> | ||
ReplaceExistingProjectInstance = 1 << 0, | ||
|
||
/// <summary> | ||
/// When this flag is present, the "BuildResult" issued in response to this request will | ||
/// include "BuildResult.ProjectStateAfterBuild". | ||
/// </summary> | ||
ProvideProjectStateAfterBuild = 1 << 1, | ||
|
||
/// <summary> | ||
/// When this flag is present and the project has previously been built on a node whose affinity is | ||
/// incompatible with the affinity this request requires, we will ignore the project state (but not | ||
/// target results) that were previously generated. | ||
/// </summary> | ||
/// <remarks> | ||
/// This usually is not desired behavior. It is only provided for those cases where the client | ||
/// knows that the new build request does not depend on project state generated by a previous request. Setting | ||
/// this flag can provide a performance boost in the case of incompatible node affinities, as MSBuild would | ||
/// otherwise have to serialize the project state from one node to another, which may be | ||
/// expensive depending on how much data the project previously generated. | ||
/// | ||
/// This flag has no effect on target results, so if a previous request already built a target, the new | ||
/// request will not re-build that target (nor will any of the project state mutations which previously | ||
/// occurred as a consequence of building that target be re-applied.) | ||
/// </remarks> | ||
IgnoreExistingProjectState = 1 << 2, | ||
|
||
/// <summary> | ||
/// When this flag is present, caches including the "ProjectRootElementCacheBase" will be cleared | ||
/// after the build request completes. This is used when the build request is known to modify a lot of | ||
/// state such as restoring packages or generating parts of the import graph. | ||
/// </summary> | ||
ClearCachesAfterBuild = 1 << 3, | ||
|
||
/// <summary> | ||
/// When this flag is present, the top level target(s) in the build request will be skipped if those targets | ||
/// are not defined in the Project to build. This only applies to this build request (if another target calls | ||
/// the "missing target" at any other point this will still result in an error). | ||
/// </summary> | ||
SkipNonexistentTargets = 1 << 4, | ||
|
||
/// <summary> | ||
/// When this flag is present, the "BuildResult" issued in response to this request will | ||
/// include a "BuildResult.ProjectStateAfterBuild" that includes ONLY the | ||
/// explicitly-requested properties, items, and metadata. | ||
/// </summary> | ||
ProvideSubsetOfStateAfterBuild = 1 << 5, | ||
|
||
/// <summary> | ||
/// When this flag is present, projects loaded during build will ignore missing imports ("ProjectLoadSettings.IgnoreMissingImports" and "ProjectLoadSettings.IgnoreInvalidImports"). | ||
/// This is especially useful during a restore since some imports might come from packages that haven't been restored yet. | ||
/// </summary> | ||
IgnoreMissingEmptyAndInvalidImports = 1 << 6, | ||
|
||
/// <summary> | ||
/// When this flag is present, an unresolved MSBuild project SDK will fail the build. This flag is used to | ||
/// change the "IgnoreMissingEmptyAndInvalidImports" behavior to still fail when an SDK is missing | ||
/// because those are more fatal. | ||
/// </summary> | ||
FailOnUnresolvedSdk = 1 << 7, | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this class already known to viewer?
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.
I have added it as a part of this PR
https://github.com/KirillOsenkov/MSBuildStructuredLog/pull/797/files#diff-3280c719e5b13a87456db15d9462ea10354769ef6fc8d731c436ac74a183bfa7:~:text=internal%20sealed%20class-,BuildCheckTracingEventArgs,-(Dictionary%3C
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.