C#: Initialise `DependabotProxy` in `DotNetCliInvoker`

This commit is contained in:
Michael B. Gale 2024-11-19 12:26:54 +00:00
Родитель f346e38058
Коммит b1828a8dc0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: FF5E2765BD00628F
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -27,7 +27,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
Info();
}
private DotNet(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory) : this(new DotNetCliInvoker(logger, Path.Combine(dotNetPath ?? string.Empty, "dotnet")), logger, tempWorkingDirectory) { }
private DotNet(ILogger logger, string? dotNetPath, TemporaryDirectory tempWorkingDirectory) : this(new DotNetCliInvoker(logger, Path.Combine(dotNetPath ?? string.Empty, "dotnet"), tempWorkingDirectory), logger, tempWorkingDirectory) { }
internal static IDotNet Make(IDotNetCliInvoker dotnetCliInvoker, ILogger logger) => new DotNet(dotnetCliInvoker, logger);

Просмотреть файл

@ -12,12 +12,14 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
internal sealed class DotNetCliInvoker : IDotNetCliInvoker
{
private readonly ILogger logger;
private readonly DependabotProxy proxy;
public string Exec { get; }
public DotNetCliInvoker(ILogger logger, string exec)
public DotNetCliInvoker(ILogger logger, string exec, TemporaryDirectory tempWorkingDirectory)
{
this.logger = logger;
this.proxy = new DependabotProxy(tempWorkingDirectory);
this.Exec = exec;
logger.LogInfo($"Using .NET CLI executable: '{Exec}'");
}
@ -38,6 +40,14 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en";
startInfo.EnvironmentVariables["MSBUILDDISABLENODEREUSE"] = "1";
startInfo.EnvironmentVariables["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "true";
// Configure the proxy settings, if applicable.
this.proxy.ApplyProxy(this.logger, startInfo);
this.logger.LogInfo(startInfo.EnvironmentVariables["HTTP_PROXY"] ?? "");
this.logger.LogInfo(startInfo.EnvironmentVariables["HTTPS_PROXY"] ?? "");
this.logger.LogInfo(startInfo.EnvironmentVariables["SSL_CERT_FILE"] ?? "");
return startInfo;
}