-
Notifications
You must be signed in to change notification settings - Fork 1.4k
MSBuild server #7634
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
Merged
Merged
MSBuild server #7634
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
b0a788d
[WIP-FEATURE] MSBuild server node (#7489)
MichalPavlik 3c24e9a
Removed IHanshake interface and removed duplicate code from ServerNod…
MichalPavlik 3be5f95
[WIP-FEATURE] MSBuild client (#7540)
AR-May cdacf78
Change server mutex name generationt to support posix
rokonec e0a7bc8
Fix appending FORCECONSOLECOLOR log parametr
rokonec f97f022
Server instrumentation (#7602)
Forgind 5c2eead
Added cancelation feature (#7638)
MichalPavlik 5ade626
Fix control sequence emission (#7630)
Forgind 8080b4c
Solving memory leak by reusing BuildManager and ProjectRoolElementCache
rokonec e41cf8a
Do not clear project root element cache if in auto reload.
rokonec 447225c
Reduce if
rokonec 836f6ef
Solving memory leak by reusing BuildManager and ProjectRoolElementCac…
rokonec 88f571c
Put msbuild server feature under ChangeWave 17.4. (#7661)
AR-May 88f3410
Add support for MSBUILDDEBUGONSTART env. var. for msbuild server clie…
AR-May b4a3482
Fix msbuild server process launch. (#7673)
AR-May 206f918
Add test for MSBuild Server (#7592)
Forgind c2691b1
Merge branch 'feature/msbuild-server' of https://github.com/dotnet/ms…
rokonec 90d6f32
Added cancelation support for client. (#7659)
MichalPavlik 4b42b69
Fix graceful disconnection (#7701)
rokonec 39a56d0
Moving public types not intended to use externally to "Microsoft.Buil…
MichalPavlik 60179f8
Merge branch 'feature/msbuild-server' of https://github.com/dotnet/ms…
rokonec 1c9ed27
Propagete Console properties to MSBuild Server (#7683)
rokonec c994838
Merge branch 'feature/msbuild-server' of https://github.com/dotnet/ms…
rokonec dec0fbc
Fix arguments passing to MSBuild Server (#7723)
rokonec 324efc5
Merge branch 'main' into feature/msbuild-server
AR-May b92eeef
Fix wrong merge.
AR-May 8d2ea0f
Make logging asynchronous
AR-May 8904e83
Merge branch 'feature/msbuild-server' of https://github.com/dotnet/ms…
rokonec 981a7bd
Update src/Build/BackEnd/Client/MSBuildClient.cs
MichalPavlik 93c62a3
MSBuild Server: Always run MSBuild nodes with MSBUILDUSESERVER disabl…
AR-May 8032e69
Fix copyright info. (#7758)
AR-May 200fbb9
Fixed some commented issues (#7759)
MichalPavlik 23fb4a6
Update doc (#7740)
MichalPavlik a55907e
Merge branch 'main' into feature/msbuild-server
AR-May 7a293b2
Added argument null checking
rokonec c9a1e61
Delete dead commented code
rokonec 072b447
Delete dead code
rokonec 265f3b7
prefix mutexes name by msbuild
rokonec 2aa65ba
Reuse ConnectToPipeStream from NodeProviderOutOfProcBase
rokonec ca8f983
Merge branch 'feature/msbuild-server' of https://github.com/dotnet/ms…
rokonec e45470a
Merge branch 'main' of https://github.com/dotnet/msbuild into feature…
rokonec 504f720
Unshipped api fix
rokonec c625fc1
Reduces allocations in case the tracing is not enabled (#7814)
MichalPavlik 6d00e2b
Fix msbuild client exit type for connection errors. (#7816)
AR-May 26b43b0
Emmit BuildTelemetry event (#7778)
rokonec 60abe1f
Increase console refresh to 25Hz
rokonec ae46347
Do not recover from TrySendBuildCommand failure
rokonec 9c2f0f3
Move *ConcoleConfiguration classes to its own files
rokonec aa17a3f
Change test timing
rokonec b87a5be
Add comment for graph build telemetry project
rokonec 568e61f
Fix English in comment
rokonec 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,121 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| #nullable disable | ||
| using System; | ||
| using System.Globalization; | ||
| using Microsoft.Build.Framework.Telemetry; | ||
| using Shouldly; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.Build.UnitTests.Telemetry; | ||
|
|
||
| public class KnownTelemetry_Tests | ||
| { | ||
| [Fact] | ||
| public void BuildTelemetryCanBeSetToNull() | ||
| { | ||
| KnownTelemetry.BuildTelemetry = new BuildTelemetry(); | ||
| KnownTelemetry.BuildTelemetry = null; | ||
|
|
||
| KnownTelemetry.BuildTelemetry.ShouldBeNull(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void BuildTelemetryCanBeSet() | ||
| { | ||
| BuildTelemetry buildTelemetry = new BuildTelemetry(); | ||
| KnownTelemetry.BuildTelemetry = buildTelemetry; | ||
|
|
||
| KnownTelemetry.BuildTelemetry.ShouldBeSameAs(buildTelemetry); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void BuildTelemetryConstructedHasNoProperties() | ||
| { | ||
| BuildTelemetry buildTelemetry = new BuildTelemetry(); | ||
|
|
||
| buildTelemetry.DisplayVersion.ShouldBeNull(); | ||
| buildTelemetry.EventName.ShouldBe("build"); | ||
| buildTelemetry.FinishedAt.ShouldBeNull(); | ||
| buildTelemetry.FrameworkName.ShouldBeNull(); | ||
| buildTelemetry.Host.ShouldBeNull(); | ||
| buildTelemetry.InitialServerState.ShouldBeNull(); | ||
| buildTelemetry.InnerStartAt.ShouldBeNull(); | ||
| buildTelemetry.Project.ShouldBeNull(); | ||
| buildTelemetry.ServerFallbackReason.ShouldBeNull(); | ||
| buildTelemetry.StartAt.ShouldBeNull(); | ||
| buildTelemetry.Success.ShouldBeNull(); | ||
| buildTelemetry.Target.ShouldBeNull(); | ||
| buildTelemetry.Version.ShouldBeNull(); | ||
|
|
||
| buildTelemetry.UpdateEventProperties(); | ||
| buildTelemetry.Properties.ShouldBeEmpty(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void BuildTelemetryCreateProperProperties() | ||
| { | ||
| BuildTelemetry buildTelemetry = new BuildTelemetry(); | ||
|
|
||
| DateTime startAt = new DateTime(2023, 01, 02, 10, 11, 22); | ||
| DateTime innerStartAt = new DateTime(2023, 01, 02, 10, 20, 30); | ||
| DateTime finishedAt = new DateTime(2023, 12, 13, 14, 15, 16); | ||
|
|
||
| buildTelemetry.DisplayVersion = "Some Display Version"; | ||
| buildTelemetry.FinishedAt = finishedAt; | ||
| buildTelemetry.FrameworkName = "new .NET"; | ||
| buildTelemetry.Host = "Host description"; | ||
| buildTelemetry.InitialServerState = "hot"; | ||
| buildTelemetry.InnerStartAt = innerStartAt; | ||
| buildTelemetry.Project = @"C:\\dev\\theProject"; | ||
| buildTelemetry.ServerFallbackReason = "busy"; | ||
| buildTelemetry.StartAt = startAt; | ||
| buildTelemetry.Success = true; | ||
| buildTelemetry.Target = "clean"; | ||
| buildTelemetry.Version = new Version(1, 2, 3, 4); | ||
|
|
||
| buildTelemetry.UpdateEventProperties(); | ||
| buildTelemetry.Properties.Count.ShouldBe(11); | ||
|
|
||
| buildTelemetry.Properties["BuildEngineDisplayVersion"].ShouldBe("Some Display Version"); | ||
| buildTelemetry.Properties["BuildEngineFrameworkName"].ShouldBe("new .NET"); | ||
| buildTelemetry.Properties["BuildEngineHost"].ShouldBe("Host description"); | ||
| buildTelemetry.Properties["InitialMSBuildServerState"].ShouldBe("hot"); | ||
| buildTelemetry.Properties["ProjectPath"].ShouldBe(@"C:\\dev\\theProject"); | ||
| buildTelemetry.Properties["ServerFallbackReason"].ShouldBe("busy"); | ||
| buildTelemetry.Properties["BuildSuccess"].ShouldBe("True"); | ||
| buildTelemetry.Properties["BuildTarget"].ShouldBe("clean"); | ||
| buildTelemetry.Properties["BuildEngineVersion"].ShouldBe("1.2.3.4"); | ||
|
|
||
| // verify computed | ||
| buildTelemetry.Properties["BuildDurationInMilliseconds"] = (finishedAt - startAt).TotalMilliseconds.ToString(CultureInfo.InvariantCulture); | ||
| buildTelemetry.Properties["InnerBuildDurationInMilliseconds"] = (finishedAt - innerStartAt).TotalMilliseconds.ToString(CultureInfo.InvariantCulture); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void BuildTelemetryHandleNullsInRecordedTimes() | ||
| { | ||
| BuildTelemetry buildTelemetry = new BuildTelemetry(); | ||
|
|
||
| buildTelemetry.StartAt = DateTime.MinValue; | ||
| buildTelemetry.FinishedAt = null; | ||
| buildTelemetry.UpdateEventProperties(); | ||
| buildTelemetry.Properties.ShouldBeEmpty(); | ||
|
|
||
| buildTelemetry.StartAt = null; | ||
| buildTelemetry.FinishedAt = DateTime.MaxValue; | ||
| buildTelemetry.UpdateEventProperties(); | ||
| buildTelemetry.Properties.ShouldBeEmpty(); | ||
|
|
||
| buildTelemetry.InnerStartAt = DateTime.MinValue; | ||
| buildTelemetry.FinishedAt = null; | ||
| buildTelemetry.UpdateEventProperties(); | ||
| buildTelemetry.Properties.ShouldBeEmpty(); | ||
|
|
||
| buildTelemetry.InnerStartAt = null; | ||
| buildTelemetry.FinishedAt = DateTime.MaxValue; | ||
| buildTelemetry.UpdateEventProperties(); | ||
| buildTelemetry.Properties.ShouldBeEmpty(); | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
src/Build.UnitTests/BackEnd/RedirectConsoleWriter_Tests.cs
This file contains hidden or 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,31 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System; | ||
| using System.IO; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Build.Experimental; | ||
| using Shouldly; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.Build.Engine.UnitTests.BackEnd | ||
| { | ||
| public class RedirectConsoleWriter_Tests | ||
| { | ||
| [Fact] | ||
| public async Task EmitConsoleMessages() | ||
|
rokonec marked this conversation as resolved.
|
||
| { | ||
| StringBuilder sb = new StringBuilder(); | ||
|
|
||
| using (TextWriter writer = OutOfProcServerNode.RedirectConsoleWriter.Create(text => sb.Append(text))) | ||
| { | ||
| writer.WriteLine("Line 1"); | ||
| await Task.Delay(80); // should be somehow bigger than `RedirectConsoleWriter` flush period - see its constructor | ||
| writer.Write("Line 2"); | ||
| } | ||
|
|
||
| sb.ToString().ShouldBe($"Line 1{Environment.NewLine}Line 2"); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.