Skip to content

Commit

Permalink
Adding a private indicator for the activation of the terminal logger (#…
Browse files Browse the repository at this point in the history
…10423)

Adding a private indicator for the activation of the terminal logger
  • Loading branch information
MichalPavlik authored Jul 29, 2024
1 parent 491b0df commit 2b46099
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/MSBuild/XMake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2516,6 +2516,11 @@ private static bool ProcessCommandLineSwitches(
#endif

bool useTerminalLogger = ProcessTerminalLoggerConfiguration(commandLineSwitches, out string aggregatedTerminalLoggerParameters);

// This is temporary until we can remove the need for the environment variable.
// DO NOT use this environment variable for any new features as it will be removed without further notice.
Environment.SetEnvironmentVariable("_MSBUILDTLENABLED", useTerminalLogger ? "1" : "0");

DisplayVersionMessageIfNeeded(recursing, useTerminalLogger, commandLineSwitches);

// Idle priority would prevent the build from proceeding as the user does normal actions.
Expand Down
5 changes: 5 additions & 0 deletions src/UnitTests.Shared/TestEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ void AssertDictionaryInclusion(IDictionary superset, IDictionary subset, string
{
foreach (var key in subset.Keys)
{
if (key is "_MSBUILDTLENABLED")
{
continue;
}

// workaround for https://github.com/dotnet/msbuild/pull/3866
// if the initial environment had empty keys, then MSBuild will accidentally remove them via Environment.SetEnvironmentVariable
if (operation != "removed" || !string.IsNullOrEmpty((string)subset[key]))
Expand Down

0 comments on commit 2b46099

Please sign in to comment.