From a473c2bad74c4beeeb0042fb196bc8321e6c1b08 Mon Sep 17 00:00:00 2001 From: PiotrP Date: Wed, 25 Jan 2017 18:23:42 -0800 Subject: [PATCH] WiP --- .../InvokeWithStage0.proj | 2 +- build_projects/dotnet-cli-build/DotNetTool.cs | 35 +++++-------------- .../EnvironmentVariableFilter.cs | 23 ++---------- 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj index 3437872d9..71dc8d373 100644 --- a/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj +++ b/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj @@ -4,7 +4,7 @@ - diff --git a/build_projects/dotnet-cli-build/DotNetTool.cs b/build_projects/dotnet-cli-build/DotNetTool.cs index d433c526a..478c1139e 100644 --- a/build_projects/dotnet-cli-build/DotNetTool.cs +++ b/build_projects/dotnet-cli-build/DotNetTool.cs @@ -15,22 +15,6 @@ namespace Microsoft.DotNet.Cli.Build { public DotNetTool() { - // var ev2r = new EnvironmentFilter() - // .GetEnvironmentVariableNamesToRemove(); - - // foreach (var ev in ev2r) - // { - // Console.WriteLine($"EV {ev}"); - // } - - // EnvironmentVariables = ev2r - // .Select(e => $"{e}=") - // .ToArray(); - - // foreach (var ev in EnvironmentVariables) - // { - // Console.WriteLine($"EV {ev}"); - // } } protected abstract string Command { get; } @@ -41,8 +25,15 @@ namespace Microsoft.DotNet.Cli.Build { get { - return new EnvironmentFilter() - .GetEnvironmentVariableNamesToRemove() + var ev2r = new EnvironmentFilter() + .GetEnvironmentVariableNamesToRemove(); + + foreach (var ev in ev2r) + { + Console.WriteLine($"EV {ev}"); + } + + return ev2r .ToDictionary(e => e, e => (string)null); } } @@ -76,14 +67,6 @@ namespace Microsoft.DotNet.Cli.Build protected override string GetWorkingDirectory() { - -Log.LogMessage(MessageImportance.High, "OVERRIDING "); - - foreach (var ev in EnvironmentVariables) - { - Log.LogMessage(MessageImportance.High, $"{ev}"); - } - return WorkingDirectory ?? base.GetWorkingDirectory(); } diff --git a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs index 183ad58d6..87a965b22 100644 --- a/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs +++ b/build_projects/dotnet-cli-build/EnvironmentVariableFilter.cs @@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Cli.Build private IEnumerable _environmentVariablesToKeep = new string [] { "DOTNET_CLI_TELEMETRY_SESSIONID", + "DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "NUGET_PACKAGES" }; @@ -37,38 +38,18 @@ namespace Microsoft.DotNet.Cli.Build .GetEnvironmentVariables() .Keys .Cast(); - - foreach (var envVar in allEnvironmentVariableNames) - { - Console.WriteLine($"ev: {envVar}"); - } var environmentVariablesToRemoveByPrefix = allEnvironmentVariableNames .Where(e => _prefixesOfEnvironmentVariablesToRemove.Any(p => e.StartsWith(p))); - - foreach (var envVar in environmentVariablesToRemoveByPrefix) - { - Console.WriteLine($"evp: {envVar}"); - } - + var environmentVariablesToRemoveByName = allEnvironmentVariableNames .Where(e => _environmentVariablesToRemove.Contains(e)); - foreach (var envVar in environmentVariablesToRemoveByName) - { - Console.WriteLine($"evn: {envVar}"); - } - var environmentVariablesToRemove = environmentVariablesToRemoveByName .Concat(environmentVariablesToRemoveByPrefix) .Distinct() .Except(_environmentVariablesToKeep); - foreach (var envVar in environmentVariablesToRemove) - { - Console.WriteLine($"evr: {envVar}"); - } - return environmentVariablesToRemove; } }