WiP
This commit is contained in:
parent
94e74d846a
commit
a473c2bad7
3 changed files with 12 additions and 48 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<Target Name="RunValidation">
|
<Target Name="RunValidation">
|
||||||
<Message Text="================================"/>
|
<Message Text="================================"/>
|
||||||
<DotNetMSBuild Arguments='$(MSBuildThisFileDirectory)/InvokeWithStage2.proj /p:ToolPath="$(Stage2Dir)" /v:diag'
|
<DotNetMSBuild Arguments=" /v:diag $(MSBuildThisFileDirectory)/InvokeWithStage2.proj /p:ToolPath="$(Stage2Dir)""
|
||||||
ToolPath="$(Stage2Dir)" />
|
ToolPath="$(Stage2Dir)" />
|
||||||
<Message Text="================================"/>
|
<Message Text="================================"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
|
@ -15,22 +15,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
public DotNetTool()
|
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; }
|
protected abstract string Command { get; }
|
||||||
|
@ -41,8 +25,15 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new EnvironmentFilter()
|
var ev2r = new EnvironmentFilter()
|
||||||
.GetEnvironmentVariableNamesToRemove()
|
.GetEnvironmentVariableNamesToRemove();
|
||||||
|
|
||||||
|
foreach (var ev in ev2r)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"EV {ev}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ev2r
|
||||||
.ToDictionary(e => e, e => (string)null);
|
.ToDictionary(e => e, e => (string)null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,14 +67,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
protected override string GetWorkingDirectory()
|
protected override string GetWorkingDirectory()
|
||||||
{
|
{
|
||||||
|
|
||||||
Log.LogMessage(MessageImportance.High, "OVERRIDING ");
|
|
||||||
|
|
||||||
foreach (var ev in EnvironmentVariables)
|
|
||||||
{
|
|
||||||
Log.LogMessage(MessageImportance.High, $"{ev}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return WorkingDirectory ?? base.GetWorkingDirectory();
|
return WorkingDirectory ?? base.GetWorkingDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
private IEnumerable<string> _environmentVariablesToKeep = new string []
|
private IEnumerable<string> _environmentVariablesToKeep = new string []
|
||||||
{
|
{
|
||||||
"DOTNET_CLI_TELEMETRY_SESSIONID",
|
"DOTNET_CLI_TELEMETRY_SESSIONID",
|
||||||
|
"DOTNET_SKIP_FIRST_TIME_EXPERIENCE",
|
||||||
"NUGET_PACKAGES"
|
"NUGET_PACKAGES"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,38 +38,18 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
.GetEnvironmentVariables()
|
.GetEnvironmentVariables()
|
||||||
.Keys
|
.Keys
|
||||||
.Cast<string>();
|
.Cast<string>();
|
||||||
|
|
||||||
foreach (var envVar in allEnvironmentVariableNames)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"ev: {envVar}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var environmentVariablesToRemoveByPrefix = allEnvironmentVariableNames
|
var environmentVariablesToRemoveByPrefix = allEnvironmentVariableNames
|
||||||
.Where(e => _prefixesOfEnvironmentVariablesToRemove.Any(p => e.StartsWith(p)));
|
.Where(e => _prefixesOfEnvironmentVariablesToRemove.Any(p => e.StartsWith(p)));
|
||||||
|
|
||||||
foreach (var envVar in environmentVariablesToRemoveByPrefix)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"evp: {envVar}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var environmentVariablesToRemoveByName = allEnvironmentVariableNames
|
var environmentVariablesToRemoveByName = allEnvironmentVariableNames
|
||||||
.Where(e => _environmentVariablesToRemove.Contains(e));
|
.Where(e => _environmentVariablesToRemove.Contains(e));
|
||||||
|
|
||||||
foreach (var envVar in environmentVariablesToRemoveByName)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"evn: {envVar}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var environmentVariablesToRemove = environmentVariablesToRemoveByName
|
var environmentVariablesToRemove = environmentVariablesToRemoveByName
|
||||||
.Concat(environmentVariablesToRemoveByPrefix)
|
.Concat(environmentVariablesToRemoveByPrefix)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.Except(_environmentVariablesToKeep);
|
.Except(_environmentVariablesToKeep);
|
||||||
|
|
||||||
foreach (var envVar in environmentVariablesToRemove)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"evr: {envVar}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return environmentVariablesToRemove;
|
return environmentVariablesToRemove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue