Skip to content

Commit 51a1071

Browse files
author
Ondřej Štorc
authored
Merge pull request #5613 from ostorc/rarAsService/node
This PR provides MSBuild necessary infrastructure to start up new RAR node and connect to it. Implements #5555
2 parents d58e2b7 + d82b3f3 commit 51a1071

File tree

64 files changed

+1180
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1180
-228
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
NU5125: Arcade uses licenseUrl when doing pack, which now causes NU5125 warning. This disables that warning until arcade can switch over.
5252
-->
5353

54-
<NoWarn>$(NoWarn);NU1603;NU5105;NU5125;1701;1702</NoWarn>
54+
<NoWarn>$(NoWarn);NU1603;NU5105;NU5125;1701;1702;VSTHRD002;VSTHRD105;VSTHRD110;VSTHRD200</NoWarn>
5555
</PropertyGroup>
5656

5757
<PropertyGroup Condition="'$(Configuration)' == 'Debug-MONO'">

eng/Packages.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetVersion)" />
1818
<PackageReference Update="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.15" />
1919
<PackageReference Update="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.16.30" />
20-
<PackageReference Update="Microsoft.Win32.Registry" Version="4.3.0" />
20+
<PackageReference Update="Microsoft.Win32.Registry" Version="4.6.0" />
2121
<PackageReference Update="NuGet.Build.Tasks" Version="$(NuGetBuildTasksVersion)" />
2222
<PackageReference Update="NuGet.Frameworks" Version="$(NuGetBuildTasksVersion)" />
2323
<PackageReference Update="PdbGit" Version="3.0.41" />
@@ -52,6 +52,8 @@
5252
<PackageReference Update="xunit.assert" Version="$(XUnitVersion)" />
5353
<PackageReference Update="xunit.console" Version="$(XUnitVersion)" />
5454
<PackageReference Update="xunit.core" Version="$(XUnitVersion)" />
55+
<PackageReference Update="StreamJsonRpc" Version="2.4.48" />
56+
<PackageReference Update="Newtonsoft.Json" Version="12.*" PrivateAssets="all" />
5557
</ItemGroup>
5658

5759
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">

eng/Signing.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<Project>
22
<ItemGroup>
3+
<FileSignInfo Include="Nerdbank.Streams.dll" CertificateName="3PartySHA2" />
4+
<FileSignInfo Include="MessagePack.dll" CertificateName="3PartySHA2" />
5+
<FileSignInfo Include="MessagePack.Annotations.dll" CertificateName="3PartySHA2" />
36
<ItemsToSign Include="$(VisualStudioSetupOutputPath)DevDivPackages\*.nupkg" />
47
</ItemGroup>
58
</Project>

ref/Microsoft.Build.Tasks.Core/net/Microsoft.Build.Tasks.Core.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ public ResolveAssemblyReference() { }
940940
public string TargetFrameworkVersion { get { throw null; } set { } }
941941
public string TargetProcessorArchitecture { get { throw null; } set { } }
942942
public bool UnresolveFrameworkAssembliesFromHigherFrameworks { get { throw null; } set { } }
943+
public bool UseResolveAssemblyReferenceService { get { throw null; } set { } }
943944
public string WarnOrErrorOnTargetArchitectureMismatch { get { throw null; } set { } }
944945
public override bool Execute() { throw null; }
945946
}

ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ public ResolveAssemblyReference() { }
677677
public string TargetFrameworkVersion { get { throw null; } set { } }
678678
public string TargetProcessorArchitecture { get { throw null; } set { } }
679679
public bool UnresolveFrameworkAssembliesFromHigherFrameworks { get { throw null; } set { } }
680+
public bool UseResolveAssemblyReferenceService { get { throw null; } set { } }
680681
public string WarnOrErrorOnTargetArchitectureMismatch { get { throw null; } set { } }
681682
public override bool Execute() { throw null; }
682683
}

ref/Microsoft.Build/net/Microsoft.Build.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,12 @@ internal ProjectTaskOutputPropertyInstance() { }
13831383
public string TaskParameter { get { throw null; } }
13841384
public override Microsoft.Build.Construction.ElementLocation TaskParameterLocation { get { throw null; } }
13851385
}
1386+
public sealed partial class RarNode
1387+
{
1388+
public RarNode() { }
1389+
public Microsoft.Build.Execution.NodeEngineShutdownReason Run(bool nodeReuse, bool lowPriority, out System.Exception shutdownException, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken)) { shutdownException = default(System.Exception); throw null; }
1390+
public Microsoft.Build.Execution.NodeEngineShutdownReason Run(out System.Exception shutdownException) { shutdownException = default(System.Exception); throw null; }
1391+
}
13861392
public partial class RequestedProjectState
13871393
{
13881394
public RequestedProjectState() { }

ref/Microsoft.Build/netstandard/Microsoft.Build.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,12 @@ internal ProjectTaskOutputPropertyInstance() { }
13771377
public string TaskParameter { get { throw null; } }
13781378
public override Microsoft.Build.Construction.ElementLocation TaskParameterLocation { get { throw null; } }
13791379
}
1380+
public sealed partial class RarNode
1381+
{
1382+
public RarNode() { }
1383+
public Microsoft.Build.Execution.NodeEngineShutdownReason Run(bool nodeReuse, bool lowPriority, out System.Exception shutdownException, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken)) { shutdownException = default(System.Exception); throw null; }
1384+
public Microsoft.Build.Execution.NodeEngineShutdownReason Run(out System.Exception shutdownException) { shutdownException = default(System.Exception); throw null; }
1385+
}
13801386
public partial class RequestedProjectState
13811387
{
13821388
public RequestedProjectState() { }

src/Build/BackEnd/BuildManager/BuildManager.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,6 +2018,26 @@ private void PerformSchedulingActions(IEnumerable<ScheduleResponse> responses)
20182018
}
20192019
}
20202020

2021+
internal bool CreateRarNode()
2022+
{
2023+
// If the _buildParametrs is not set, we are in OutOfProc mode, so continue
2024+
// Else check if users specified that he want to use multiple nodes, if so use RARaaS
2025+
if (_buildParameters?.MaxNodeCount == 1)
2026+
return false;
2027+
2028+
string nodeLocation = _buildParameters?.NodeExeLocation ?? BuildEnvironmentHelper.Instance.CurrentMSBuildExePath;
2029+
if (string.IsNullOrEmpty(nodeLocation))
2030+
{
2031+
// Couldn't find a path to MSBuild.exe; can't create a new node.
2032+
return false;
2033+
}
2034+
2035+
bool nodeReuse = _buildParameters?.EnableNodeReuse ?? true;
2036+
bool lowPriority = _buildParameters?.LowPriority ?? false;
2037+
string commandLineArgs = $"/nologo /nodemode:3 /nodeReuse:{nodeReuse} /low:{lowPriority}";
2038+
return NodeProviderOutOfProcBase.LaunchNode(nodeLocation, commandLineArgs) != -1;
2039+
}
2040+
20212041
/// <summary>
20222042
/// Completes a submission using the specified overall results.
20232043
/// </summary>

src/Build/BackEnd/Components/Communications/NodeEndpointOutOfProc.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ internal NodeEndpointOutOfProc(
5454
/// </summary>
5555
protected override Handshake GetHandshake()
5656
{
57-
return new Handshake(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, is64Bit: EnvironmentUtilities.Is64BitProcess, nodeReuse: _enableReuse, lowPriority: _lowPriority));
57+
return new Handshake(CommunicationsUtilities.GetHandshakeOptions(
58+
taskHost: false,
59+
is64Bit: EnvironmentUtilities.Is64BitProcess,
60+
nodeReuse: _enableReuse,
61+
lowPriority: _lowPriority));
5862
}
5963

6064
#region Structs

src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ public int AvailableNodes
6363
/// </summary>
6464
/// <param name="enableNodeReuse">Is reuse of build nodes allowed?</param>
6565
/// <param name="enableLowPriority">Is the build running at low priority?</param>
66-
internal static Handshake GetHandshake(bool enableNodeReuse, bool enableLowPriority)
66+
/// <param name="specialNode">/Indicates if node can not accept standard MSBuild work</param>
67+
internal static Handshake GetHandshake(bool enableNodeReuse, bool enableLowPriority, bool specialNode)
6768
{
6869
CommunicationsUtilities.Trace("MSBUILDNODEHANDSHAKESALT=\"{0}\", msbuildDirectory=\"{1}\", enableNodeReuse={2}, enableLowPriority={3}", Traits.MSBuildNodeHandshakeSalt, BuildEnvironmentHelper.Instance.MSBuildToolsDirectory32, enableNodeReuse, enableLowPriority);
69-
return new Handshake(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, nodeReuse: enableNodeReuse, lowPriority: enableLowPriority, is64Bit: EnvironmentUtilities.Is64BitProcess));
70+
return new Handshake(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, nodeReuse: enableNodeReuse, lowPriority: enableLowPriority, specialNode: specialNode, is64Bit: EnvironmentUtilities.Is64BitProcess));
7071
}
7172

7273
/// <summary>

0 commit comments

Comments
 (0)