Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/Build.UnitTests/BackEnd/DebugUtils_tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Shared;
using Microsoft.Build.Shared.Debugging;
using Shouldly;
Expand Down Expand Up @@ -58,8 +59,8 @@ public void SetDebugPath_WhenUserSetRelativePath()
var transientDebugEngine = env.SetEnvironmentVariable("MSBuildDebugEngine", "1");
try
{
DebugUtils.SetDebugPath();
string resultPath = DebugUtils.DebugPath;
FrameworkDebugUtils.SetDebugPath();
string resultPath = FrameworkDebugUtils.DebugPath;
resultPath.ShouldNotBeNull();
resultPath.ShouldBe(Path.Combine(relativePath, ".MSBuild_Logs"));
Directory.Exists(resultPath).ShouldBeTrue();
Expand All @@ -69,7 +70,7 @@ public void SetDebugPath_WhenUserSetRelativePath()
// Reset DebugPath to not affect other tests
transientEnvVar.Revert();
transientDebugEngine.Revert();
DebugUtils.SetDebugPath();
FrameworkDebugUtils.SetDebugPath();
}
}
}
Expand All @@ -93,8 +94,8 @@ public void SetDebugPath_WhenUserSetAbsolutePath()
var transientDebugEngine = env.SetEnvironmentVariable("MSBuildDebugEngine", "1");
try
{
DebugUtils.SetDebugPath();
string resultPath = DebugUtils.DebugPath;
FrameworkDebugUtils.SetDebugPath();
string resultPath = FrameworkDebugUtils.DebugPath;
resultPath.ShouldNotBeNull();
resultPath.ShouldBe(Path.Combine(fullInSolutionPath, ".MSBuild_Logs"));
}
Expand All @@ -103,7 +104,7 @@ public void SetDebugPath_WhenUserSetAbsolutePath()
// Reset DebugPath to not affect other tests
transientEnvVar.Revert();
transientDebugEngine.Revert();
DebugUtils.SetDebugPath();
FrameworkDebugUtils.SetDebugPath();
}
}
}
Expand All @@ -124,8 +125,8 @@ public void SetDebugPath_WhenUserNotSetDebugPath()
var transientDebugEngine = env.SetEnvironmentVariable("MSBuildDebugEngine", "1");
try
{
DebugUtils.SetDebugPath();
string resultPath = DebugUtils.DebugPath;
FrameworkDebugUtils.SetDebugPath();
string resultPath = FrameworkDebugUtils.DebugPath;
resultPath.ShouldNotBeNull();
resultPath.ShouldBe(Path.Combine(Directory.GetCurrentDirectory(), ".MSBuild_Logs"));
}
Expand All @@ -134,7 +135,7 @@ public void SetDebugPath_WhenUserNotSetDebugPath()
// Reset DebugPath to not affect other tests
transientEnvVar.Revert();
transientDebugEngine.Revert();
DebugUtils.SetDebugPath();
FrameworkDebugUtils.SetDebugPath();
}
}
}
Expand All @@ -144,7 +145,7 @@ public void IsInTaskHostNode_ReturnsFalseForCentralNode()
{
// When running in the main test process (no /nodemode argument),
// we should not be in a TaskHost node
DebugUtils.IsInTaskHostNode().ShouldBeFalse();
FrameworkDebugUtils.IsInTaskHostNode().ShouldBeFalse();
}
}
}
4 changes: 2 additions & 2 deletions src/Build.UnitTests/BackEnd/TaskExecutionHost_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ public void TaskExceptionHandlingTest(Type exceptionType, bool isCritical)
// Force initing the DebugPath from the env var - as we need it to be unique for those tests.
// The ProjectCacheTests DataMemberAttribute usages (specifically SuccessfulGraphsWithBuildParameters) lead
// to the DebugPath being set before this test runs - and hence the env var is ignored.
DebugUtils.SetDebugPath();
FrameworkDebugUtils.SetDebugPath();

ObjectModelHelpers.BuildProjectExpectFailure($"""
<Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
Expand Down Expand Up @@ -1102,7 +1102,7 @@ public void TaskExceptionHandlingTest(Type exceptionType, bool isCritical)

// Reset DebugPath to not affect other tests
transientEnvVar.Revert();
DebugUtils.SetDebugPath();
FrameworkDebugUtils.SetDebugPath();
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions src/Build/BackEnd/BuildManager/BuildManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,13 @@ ILoggingService InitializeLoggingService()
// VS builds discard many msbuild events so attach a binlogger to capture them all.
IEnumerable<ILogger> AppendDebuggingLoggers(IEnumerable<ILogger> loggers)
{
if (DebugUtils.ShouldDebugCurrentProcess is false ||
if (FrameworkDebugUtils.ShouldDebugCurrentProcess is false ||
Traits.Instance.DebugEngine is false)
{
return loggers;
}

var binlogPath = DebugUtils.FindNextAvailableDebugFilePath($"{DebugUtils.ProcessInfoString}_BuildManager_{_hostName}.binlog");
var binlogPath = DebugUtils.FindNextAvailableDebugFilePath($"{FrameworkDebugUtils.ProcessInfoString}_BuildManager_{_hostName}.binlog");

var logger = new BinaryLogger { Parameters = binlogPath };

Expand Down Expand Up @@ -811,7 +811,7 @@ private static void AttachDebugger()
return;
}

if (!DebugUtils.ShouldDebugCurrentProcess)
if (!FrameworkDebugUtils.ShouldDebugCurrentProcess)
{
return;
}
Expand Down Expand Up @@ -2239,7 +2239,7 @@ static void DumpGraph(ProjectGraph graph, IReadOnlyDictionary<ProjectGraphNode,
return;
}

var logPath = DebugUtils.FindNextAvailableDebugFilePath($"{DebugUtils.ProcessInfoString}_ProjectGraph.dot");
var logPath = DebugUtils.FindNextAvailableDebugFilePath($"{FrameworkDebugUtils.ProcessInfoString}_ProjectGraph.dot");

File.WriteAllText(logPath, graph.ToDot(targetList));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Build/BackEnd/BuildManager/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ internal BuildParameters(BuildParameters other, bool resetEnvironment = false)
_enableNodeReuse = other._enableNodeReuse;
_enableRarNode = other._enableRarNode;
_buildProcessEnvironment = resetEnvironment
? CommunicationsUtilities.GetEnvironmentVariables()
? FrameworkCommunicationsUtilities.GetEnvironmentVariables()
: other._buildProcessEnvironment;
_environmentProperties = other._environmentProperties != null ? new PropertyDictionary<ProjectPropertyInstance>(other._environmentProperties) : null;
_forwardingLoggers = other._forwardingLoggers != null ? new List<ForwardingLoggerRecord>(other._forwardingLoggers) : null;
Expand Down Expand Up @@ -1040,7 +1040,7 @@ private static int GetStaticIntVariableOrDefault(string environmentVariable, ref
/// </summary>
private void Initialize(PropertyDictionary<ProjectPropertyInstance> environmentProperties, ProjectRootElementCacheBase projectRootElementCache, ToolsetProvider toolsetProvider)
{
_buildProcessEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
_buildProcessEnvironment = FrameworkCommunicationsUtilities.GetEnvironmentVariables();
_environmentProperties = environmentProperties;
ProjectRootElementCache = projectRootElementCache;
ResetCaches = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ internal class BuildRequestEngine : IBuildRequestEngine, IBuildComponent
internal BuildRequestEngine()
{
_debugDumpState = Traits.Instance.DebugScheduler;
_debugDumpPath = DebugUtils.DebugPath;
_debugDumpPath = FrameworkDebugUtils.DebugPath;
_debugForceCaching = Environment.GetEnvironmentVariable("MSBUILDDEBUGFORCECACHING") == "1";

if (String.IsNullOrEmpty(_debugDumpPath))
Expand Down
3 changes: 1 addition & 2 deletions src/Build/BackEnd/Components/Scheduler/Scheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.Build.Framework;
using Microsoft.Build.ProjectCache;
using Microsoft.Build.Shared;
using Microsoft.Build.Shared.Debugging;
using Microsoft.Build.Shared.FileSystem;
using BuildAbortedException = Microsoft.Build.Exceptions.BuildAbortedException;
using ILoggingService = Microsoft.Build.BackEnd.Logging.ILoggingService;
Expand Down Expand Up @@ -212,7 +211,7 @@ public Scheduler()
{
// Be careful moving these to Traits, changing the timing of reading environment variables has a breaking potential.
_debugDumpState = Traits.Instance.DebugScheduler;
_debugDumpPath = DebugUtils.DebugPath;
_debugDumpPath = FrameworkDebugUtils.DebugPath;
_schedulingUnlimitedVariable = Environment.GetEnvironmentVariable("MSBUILDSCHEDULINGUNLIMITED");
_nodeLimitOffset = 0;

Expand Down
5 changes: 2 additions & 3 deletions src/Build/BackEnd/Node/InProcNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.Build.BackEnd.Components.Caching;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
using Microsoft.Build.Internal;
using Microsoft.Build.Shared;
using Microsoft.Build.Shared.Debugging;
using ILoggingService = Microsoft.Build.BackEnd.Logging.ILoggingService;
Expand Down Expand Up @@ -352,7 +351,7 @@ private NodeEngineShutdownReason HandleShutdown(out Exception exception)
NativeMethodsShared.SetCurrentDirectory(_savedCurrentDirectory);

// Restore the original environment.
CommunicationsUtilities.SetEnvironment(_savedEnvironment);
FrameworkCommunicationsUtilities.SetEnvironment(_savedEnvironment);
}

exception = _shutdownException;
Expand Down Expand Up @@ -482,7 +481,7 @@ private void HandleNodeConfiguration(NodeConfiguration configuration)
CultureInfo.CurrentUICulture = configuration.BuildParameters.UICulture;

// Snapshot the initial environment.
_savedEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
_savedEnvironment = FrameworkCommunicationsUtilities.GetEnvironmentVariables();

// Save the current directory.
_savedCurrentDirectory = NativeMethodsShared.GetCurrentDirectory();
Expand Down
4 changes: 2 additions & 2 deletions src/Build/BackEnd/Node/OutOfProcNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ private NodeEngineShutdownReason HandleShutdown(out Exception exception)
{
try
{
CommunicationsUtilities.SetEnvironment(_savedEnvironment);
FrameworkCommunicationsUtilities.SetEnvironment(_savedEnvironment);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -714,7 +714,7 @@ private void HandleNodeConfiguration(NodeConfiguration configuration)
_buildParameters.ProjectRootElementCache = s_projectRootElementCacheBase;

// Snapshot the current environment
_savedEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
_savedEnvironment = FrameworkCommunicationsUtilities.GetEnvironmentVariables();

// Change to the startup directory
try
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Node/OutOfProcServerNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void HandleServerNodeBuildCommand(ServerNodeBuildCommand command)
// Set build process context
Directory.SetCurrentDirectory(command.StartupDirectory);

CommunicationsUtilities.SetEnvironment(command.BuildProcessEnvironment);
FrameworkCommunicationsUtilities.SetEnvironment(command.BuildProcessEnvironment);
Traits.UpdateFromEnvironment();

Thread.CurrentThread.CurrentCulture = command.Culture;
Expand Down
2 changes: 0 additions & 2 deletions src/Build/Microsoft.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@
<Compile Include="BackEnd\Node\INode.cs" />
<!-- ########################## -->
<Compile Include="BackEnd\TaskExecutionHost\TaskExecutionHost.cs" />
<Compile Include="BackEnd\TaskExecutionHost\MultiProcessTaskEnvironmentDriver.cs" />
<Compile Include="BackEnd\TaskExecutionHost\MultiThreadedTaskEnvironmentDriver.cs" />
<!-- #### COLLECTIONS ### -->
<Compile Include="..\Shared\CollectionHelpers.cs" />
<Compile Include="Collections\ArrayDictionary.cs" />
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Utilities/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private static bool UsingDifferentToolsVersionFromProjectFile(string toolsVersio
/// </summary>
internal static PropertyDictionary<ProjectPropertyInstance> GetEnvironmentProperties(bool makeReadOnly)
{
IDictionary<string, string> environmentVariablesBag = CommunicationsUtilities.GetEnvironmentVariables();
IDictionary<string, string> environmentVariablesBag = FrameworkCommunicationsUtilities.GetEnvironmentVariables();

var envPropertiesHashSet = new RetrievableValuedEntryHashSet<ProjectPropertyInstance>(environmentVariablesBag.Count + 2, MSBuildNameIgnoreCaseComparer.Default);

Expand Down
Loading
Loading