C#: Change RestoreSettings to have general extraArgs parameter

This allows the string of package feeds to be constructed once and used repeatedly in the parallel restore loop as well.
This commit is contained in:
Michael B. Gale
2025-03-24 17:08:05 +00:00
parent 7a92a72a9a
commit d564529f3c
3 changed files with 19 additions and 17 deletions

View File

@@ -67,19 +67,6 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
args += $" --configfile \"{restoreSettings.PathToNugetConfig}\"";
}
// Add package sources. If any are present, they override all sources specified in
// the configuration file(s).
if (restoreSettings.Sources != null)
{
var feedArgs = new StringBuilder();
foreach (string source in restoreSettings.Sources)
{
feedArgs.Append($" -s {source}");
}
args += feedArgs.ToString();
}
if (restoreSettings.ForceReevaluation)
{
args += " --force";
@@ -90,6 +77,11 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
args += " /p:EnableWindowsTargeting=true";
}
if (restoreSettings.ExtraArgs != null)
{
args += $" {restoreSettings.ExtraArgs}";
}
return args;
}