Skip to content

Commit 0511243

Browse files
committed
C#: Rename ExtraArgs to NugetSources.
1 parent dc13650 commit 0511243

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ private string GetRestoreArgs(RestoreSettings restoreSettings)
9595
args += " /p:EnableWindowsTargeting=true";
9696
}
9797

98-
if (restoreSettings.ExtraArgs is not null)
98+
if (restoreSettings.NugetSources is not null)
9999
{
100-
args += $" {restoreSettings.ExtraArgs}";
100+
args += $" {restoreSettings.NugetSources}";
101101
}
102102

103103
return args;

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/IDotNet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public interface IDotNet
1717
IList<string> GetNugetFeedsFromFolder(string folderPath);
1818
}
1919

20-
public record class RestoreSettings(string File, string PackageDirectory, bool ForceDotnetRefAssemblyFetching, string? ExtraArgs = null, string? PathToNugetConfig = null, bool ForceReevaluation = false, bool TargetWindows = false);
20+
public record class RestoreSettings(string File, string PackageDirectory, bool ForceDotnetRefAssemblyFetching, string? NugetSources = null, string? PathToNugetConfig = null, bool ForceReevaluation = false, bool TargetWindows = false);
2121

2222
public partial record class RestoreResult(bool Success, IList<string> Output)
2323
{

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public HashSet<AssemblyLookupLocation> Restore()
118118
compilationInfoContainer.CompilationInfos.Add(("NuGet feed responsiveness checked", CheckNugetFeedResponsiveness ? "1" : "0"));
119119

120120
HashSet<string> explicitFeeds = [];
121-
string? explicitRestoreSources = null;
121+
string? explicitNugetSources = null;
122122

123123
try
124124
{
@@ -153,13 +153,13 @@ public HashSet<AssemblyLookupLocation> Restore()
153153

154154
// If feed responsiveness is being checked, we only want to use the feeds that are reachable (note this set includes private
155155
// registry feeds if they are reachable).
156-
explicitRestoreSources = MakeRestoreSourcesArgument(reachableFeeds);
156+
explicitNugetSources = MakeRestoreSourcesArgument(reachableFeeds);
157157
}
158158
else if (HasPrivateRegistryFeeds)
159159
{
160160
// If private registries are configured they need to be included as sources for the restore, which requires that
161161
// they are provided as source arguments for the restore. The private registries are included in the `allFeeds` set.
162-
explicitRestoreSources = MakeRestoreSourcesArgument(allFeeds);
162+
explicitNugetSources = MakeRestoreSourcesArgument(allFeeds);
163163
}
164164

165165
using (var nuget = new NugetExeWrapper(fileProvider, legacyPackageDirectory, logger))
@@ -202,9 +202,9 @@ public HashSet<AssemblyLookupLocation> Restore()
202202
}
203203

204204
// Restore project dependencies with `dotnet restore`.
205-
var restoredProjects = RestoreSolutions(explicitRestoreSources, out var container);
205+
var restoredProjects = RestoreSolutions(explicitNugetSources, out var container);
206206
var projects = fileProvider.Projects.Except(restoredProjects);
207-
RestoreProjects(projects, explicitRestoreSources, out var containers);
207+
RestoreProjects(projects, explicitNugetSources, out var containers);
208208

209209
var dependencies = containers.Flatten(container);
210210

@@ -291,7 +291,7 @@ private List<string> GetReachableFallbackNugetFeeds(HashSet<string>? feedsFromNu
291291
/// Populates dependencies with the relevant dependencies from the assets files generated by the restore.
292292
/// Returns a list of projects that are up to date with respect to restore.
293293
/// </summary>
294-
private IEnumerable<string> RestoreSolutions(string? explicitRestoreSources, out DependencyContainer dependencies)
294+
private IEnumerable<string> RestoreSolutions(string? nugetSources, out DependencyContainer dependencies)
295295
{
296296
var successCount = 0;
297297
var nugetSourceFailures = 0;
@@ -302,7 +302,7 @@ private IEnumerable<string> RestoreSolutions(string? explicitRestoreSources, out
302302
var projects = fileProvider.Solutions.SelectMany(solution =>
303303
{
304304
logger.LogInfo($"Restoring solution {solution}...");
305-
var res = dotnet.Restore(new(solution, PackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: true, ExtraArgs: explicitRestoreSources, TargetWindows: isWindows));
305+
var res = dotnet.Restore(new(solution, PackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: true, NugetSources: nugetSources, TargetWindows: isWindows));
306306
if (res.Success)
307307
{
308308
successCount++;
@@ -357,7 +357,7 @@ private void RestoreProjects(IEnumerable<string> projects, string? explicitResto
357357
foreach (var project in projectGroup)
358358
{
359359
logger.LogInfo($"Restoring project {project}...");
360-
var res = dotnet.Restore(new(project, PackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: true, ExtraArgs: explicitRestoreSources, TargetWindows: isWindows));
360+
var res = dotnet.Restore(new(project, PackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: true, NugetSources: explicitRestoreSources, TargetWindows: isWindows));
361361
assets.AddDependenciesRange(res.AssetsFilePaths);
362362
lock (sync)
363363
{

0 commit comments

Comments
 (0)