dependabot-nuget 0.280.0 → 0.282.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Common.props +1 -1
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +4 -6
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +4 -6
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +4 -7
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +4 -6
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +3 -5
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +0 -3
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +0 -1
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +1 -2
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +3 -6
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +9 -9
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +2 -2
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +1 -1
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +2 -2
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +5 -5
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs +1 -1
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +3 -3
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs +1 -1
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscovery.cs +1 -1
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +1 -1
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +2 -2
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs +1 -1
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +2 -2
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +2 -2
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +2 -2
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +1 -1
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +2 -2
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +16 -6
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +1 -1
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +1 -1
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +2 -2
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/{SdkPackageUpdater.cs → PackageReferenceUpdater.cs} +97 -37
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +26 -10
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +12 -4
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs +9 -0
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +14 -16
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs +6 -0
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +25 -23
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +1 -1
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +1 -1
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs +7 -7
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolverEnvironment.cs +12 -0
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -1
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +1 -1
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +1 -1
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +4 -4
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestLogger.cs +11 -0
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/ExpectedUpdateOperationResult.cs +8 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +3 -3
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +14 -6
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +1 -1
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +1 -1
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/{UpdateWorkerTests.Sdk.cs → UpdateWorkerTests.PackageReference.cs} +200 -23
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +221 -8
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +56 -18
  59. data/lib/dependabot/nuget/file_fetcher.rb +58 -21
  60. data/lib/dependabot/nuget/file_updater.rb +1 -0
  61. data/lib/dependabot/nuget/native_helpers.rb +10 -16
  62. metadata +19 -15
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2728d8749a316ac4ecbd46826beffaefc51e5101c1154d0fdef5ad756158c256
4
- data.tar.gz: 3ec34208b76ed22dbef3ae0e49511e77f85d73aea1b980180292b5225e26367a
3
+ metadata.gz: 40a4e33161303780b957de20221c3daf909d922bdff17bd22dead842f80a585e
4
+ data.tar.gz: f3faa68e7a0d0ef1e3a431acb17569b88309802cffb7be3315d080d0a2ec5f33
5
5
  SHA512:
6
- metadata.gz: 4cf2906e79a866fb5c4d89807e893d6486f1fae08b9b951da9a049fbd546cc59d522d6b8ace80fe0ee59353eb93224b648370b404bf69ff845d89fafd70894ba
7
- data.tar.gz: '05801823dee91eba1e490ee4fef1d44a2e83f632c7823c5ae6bd9cd3955d085c8c6c5e015023c4a6a0e34ed453e2e3d956c9399f955d608fd87381ef2ff620d7'
6
+ metadata.gz: 2d6e0c85681853fcd2d8a539ac2c4b116b8837442073954cd0fc4b717a45ce17cffa8d16f9f3e5d6e9db1f0beffdedb9577e56a05652285e706efabeedef1338
7
+ data.tar.gz: 1ba69c4b218959952b6d86553b24871bbbf43d0a443f35f9de886bdfa78029ae7ea9885c9b8247cb98e5ab39e6e8ea8c923ce4cec60404251791482da7ee923c
@@ -12,6 +12,6 @@
12
12
  <CommonTargetFramework>net9.0</CommonTargetFramework>
13
13
  <ImplicitUsings>enable</ImplicitUsings>
14
14
  <UseArtifactsOutput>true</UseArtifactsOutput>
15
- <ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
15
+ <ArtifactsPath>$(MSBuildThisFileDirectory)artifacts\$(OS)</ArtifactsPath>
16
16
  </PropertyGroup>
17
17
  </Project>
@@ -11,7 +11,6 @@ internal static class AnalyzeCommand
11
11
  internal static readonly Option<FileInfo> DependencyFilePathOption = new("--dependency-file-path") { IsRequired = true };
12
12
  internal static readonly Option<FileInfo> DiscoveryFilePathOption = new("--discovery-file-path") { IsRequired = true };
13
13
  internal static readonly Option<DirectoryInfo> AnalysisFolderOption = new("--analysis-folder-path") { IsRequired = true };
14
- internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
15
14
 
16
15
  internal static Command GetCommand(Action<int> setExitCode)
17
16
  {
@@ -20,17 +19,16 @@ internal static class AnalyzeCommand
20
19
  RepoRootOption,
21
20
  DependencyFilePathOption,
22
21
  DiscoveryFilePathOption,
23
- AnalysisFolderOption,
24
- VerboseOption
22
+ AnalysisFolderOption
25
23
  };
26
24
 
27
25
  command.TreatUnmatchedTokensAsErrors = true;
28
26
 
29
- command.SetHandler(async (repoRoot, discoveryPath, dependencyPath, analysisDirectory, verbose) =>
27
+ command.SetHandler(async (repoRoot, discoveryPath, dependencyPath, analysisDirectory) =>
30
28
  {
31
- var worker = new AnalyzeWorker(new Logger(verbose));
29
+ var worker = new AnalyzeWorker(new ConsoleLogger());
32
30
  await worker.RunAsync(repoRoot.FullName, discoveryPath.FullName, dependencyPath.FullName, analysisDirectory.FullName);
33
- }, RepoRootOption, DiscoveryFilePathOption, DependencyFilePathOption, AnalysisFolderOption, VerboseOption);
31
+ }, RepoRootOption, DiscoveryFilePathOption, DependencyFilePathOption, AnalysisFolderOption);
34
32
 
35
33
  return command;
36
34
  }
@@ -10,7 +10,6 @@ internal static class DiscoverCommand
10
10
  internal static readonly Option<DirectoryInfo> RepoRootOption = new("--repo-root") { IsRequired = true };
11
11
  internal static readonly Option<string> WorkspaceOption = new("--workspace") { IsRequired = true };
12
12
  internal static readonly Option<FileInfo> OutputOption = new("--output") { IsRequired = true };
13
- internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
14
13
 
15
14
  internal static Command GetCommand(Action<int> setExitCode)
16
15
  {
@@ -18,17 +17,16 @@ internal static class DiscoverCommand
18
17
  {
19
18
  RepoRootOption,
20
19
  WorkspaceOption,
21
- OutputOption,
22
- VerboseOption
20
+ OutputOption
23
21
  };
24
22
 
25
23
  command.TreatUnmatchedTokensAsErrors = true;
26
24
 
27
- command.SetHandler(async (repoRoot, workspace, outputPath, verbose) =>
25
+ command.SetHandler(async (repoRoot, workspace, outputPath) =>
28
26
  {
29
- var worker = new DiscoveryWorker(new Logger(verbose));
27
+ var worker = new DiscoveryWorker(new ConsoleLogger());
30
28
  await worker.RunAsync(repoRoot.FullName, workspace, outputPath.FullName);
31
- }, RepoRootOption, WorkspaceOption, OutputOption, VerboseOption);
29
+ }, RepoRootOption, WorkspaceOption, OutputOption);
32
30
 
33
31
  return command;
34
32
  }
@@ -1,4 +1,3 @@
1
- using System;
2
1
  using System.CommandLine;
3
2
 
4
3
  using NuGetUpdater.Core;
@@ -10,25 +9,23 @@ internal static class FrameworkCheckCommand
10
9
  {
11
10
  internal static readonly Option<string[]> ProjectTfmsOption = new("--project-tfms") { IsRequired = true, AllowMultipleArgumentsPerToken = true };
12
11
  internal static readonly Option<string[]> PackageTfmsOption = new("--package-tfms") { IsRequired = true, AllowMultipleArgumentsPerToken = true };
13
- internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
14
12
 
15
13
  internal static Command GetCommand(Action<int> setExitCode)
16
14
  {
17
15
  Command command = new("framework-check", "Checks that a project's target frameworks are satisfied by the target frameworks supported by a package.")
18
16
  {
19
17
  ProjectTfmsOption,
20
- PackageTfmsOption,
21
- VerboseOption
18
+ PackageTfmsOption
22
19
  };
23
20
 
24
21
  command.TreatUnmatchedTokensAsErrors = true;
25
22
 
26
- command.SetHandler((projectTfms, packageTfms, verbose) =>
23
+ command.SetHandler((projectTfms, packageTfms) =>
27
24
  {
28
- setExitCode(CompatibilityChecker.IsCompatible(projectTfms, packageTfms, new Logger(verbose))
25
+ setExitCode(CompatibilityChecker.IsCompatible(projectTfms, packageTfms, new ConsoleLogger())
29
26
  ? 0
30
27
  : 1);
31
- }, ProjectTfmsOption, PackageTfmsOption, VerboseOption);
28
+ }, ProjectTfmsOption, PackageTfmsOption);
32
29
 
33
30
  return command;
34
31
  }
@@ -13,7 +13,6 @@ internal static class RunCommand
13
13
  internal static readonly Option<string> JobIdOption = new("--job-id") { IsRequired = true };
14
14
  internal static readonly Option<FileInfo> OutputPathOption = new("--output-path") { IsRequired = true };
15
15
  internal static readonly Option<string> BaseCommitShaOption = new("--base-commit-sha") { IsRequired = true };
16
- internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
17
16
 
18
17
  internal static Command GetCommand(Action<int> setExitCode)
19
18
  {
@@ -24,18 +23,17 @@ internal static class RunCommand
24
23
  ApiUrlOption,
25
24
  JobIdOption,
26
25
  OutputPathOption,
27
- BaseCommitShaOption,
28
- VerboseOption
26
+ BaseCommitShaOption
29
27
  };
30
28
 
31
29
  command.TreatUnmatchedTokensAsErrors = true;
32
30
 
33
- command.SetHandler(async (jobPath, repoContentsPath, apiUrl, jobId, outputPath, baseCommitSha, verbose) =>
31
+ command.SetHandler(async (jobPath, repoContentsPath, apiUrl, jobId, outputPath, baseCommitSha) =>
34
32
  {
35
33
  var apiHandler = new HttpApiHandler(apiUrl.ToString(), jobId);
36
- var worker = new RunWorker(apiHandler, new Logger(verbose));
34
+ var worker = new RunWorker(apiHandler, new ConsoleLogger());
37
35
  await worker.RunAsync(jobPath, repoContentsPath, baseCommitSha, outputPath);
38
- }, JobPathOption, RepoContentsPathOption, ApiUrlOption, JobIdOption, OutputPathOption, BaseCommitShaOption, VerboseOption);
36
+ }, JobPathOption, RepoContentsPathOption, ApiUrlOption, JobIdOption, OutputPathOption, BaseCommitShaOption);
39
37
 
40
38
  return command;
41
39
  }
@@ -12,7 +12,6 @@ internal static class UpdateCommand
12
12
  internal static readonly Option<string> NewVersionOption = new("--new-version") { IsRequired = true };
13
13
  internal static readonly Option<string> PreviousVersionOption = new("--previous-version") { IsRequired = true };
14
14
  internal static readonly Option<bool> IsTransitiveOption = new("--transitive", getDefaultValue: () => false);
15
- internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
16
15
  internal static readonly Option<string?> ResultOutputPathOption = new("--result-output-path", getDefaultValue: () => null);
17
16
 
18
17
  internal static Command GetCommand(Action<int> setExitCode)
@@ -25,18 +24,17 @@ internal static class UpdateCommand
25
24
  NewVersionOption,
26
25
  PreviousVersionOption,
27
26
  IsTransitiveOption,
28
- VerboseOption,
29
27
  ResultOutputPathOption
30
28
  };
31
29
 
32
30
  command.TreatUnmatchedTokensAsErrors = true;
33
31
 
34
- command.SetHandler(async (repoRoot, solutionOrProjectFile, dependencyName, newVersion, previousVersion, isTransitive, verbose, resultOutputPath) =>
32
+ command.SetHandler(async (repoRoot, solutionOrProjectFile, dependencyName, newVersion, previousVersion, isTransitive, resultOutputPath) =>
35
33
  {
36
- var worker = new UpdaterWorker(new Logger(verbose));
34
+ var worker = new UpdaterWorker(new ConsoleLogger());
37
35
  await worker.RunAsync(repoRoot.FullName, solutionOrProjectFile.FullName, dependencyName, previousVersion, newVersion, isTransitive, resultOutputPath);
38
36
  setExitCode(0);
39
- }, RepoRootOption, SolutionOrProjectFileOption, DependencyNameOption, NewVersionOption, PreviousVersionOption, IsTransitiveOption, VerboseOption, ResultOutputPathOption);
37
+ }, RepoRootOption, SolutionOrProjectFileOption, DependencyNameOption, NewVersionOption, PreviousVersionOption, IsTransitiveOption, ResultOutputPathOption);
40
38
 
41
39
  return command;
42
40
  }
@@ -34,7 +34,6 @@ public partial class EntryPointTests
34
34
  Path.Join(path, "Some.Package.json"),
35
35
  "--analysis-folder-path",
36
36
  Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
37
- "--verbose",
38
37
  ],
39
38
  packages: [
40
39
  MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0", additionalMetadata: [repositoryXml]),
@@ -151,7 +150,6 @@ public partial class EntryPointTests
151
150
  Path.Join(path, "some-global-tool.json"),
152
151
  "--analysis-folder-path",
153
152
  Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
154
- "--verbose",
155
153
  ],
156
154
  packages:
157
155
  [
@@ -239,7 +237,6 @@ public partial class EntryPointTests
239
237
  Path.Join(path, "Some.MSBuild.Sdk.json"),
240
238
  "--analysis-folder-path",
241
239
  Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
242
- "--verbose",
243
240
  ],
244
241
  packages:
245
242
  [
@@ -28,7 +28,6 @@ public partial class EntryPointTests
28
28
  args.AddRange(projectTfms.Split(' ', StringSplitOptions.TrimEntries));
29
29
  args.Add("--package-tfms");
30
30
  args.AddRange(packageTfms.Split(' ', StringSplitOptions.TrimEntries));
31
- args.Add("--verbose");
32
31
 
33
32
  var actual = await Program.Main(args.ToArray());
34
33
 
@@ -105,8 +105,7 @@ public partial class EntryPointTests
105
105
  "--output-path",
106
106
  Path.Combine(tempDirectory.DirectoryPath, "output.json"),
107
107
  "--base-commit-sha",
108
- "BASE-COMMIT-SHA",
109
- "--verbose"
108
+ "BASE-COMMIT-SHA"
110
109
  };
111
110
 
112
111
  var output = new StringBuilder();
@@ -128,8 +128,7 @@ public partial class EntryPointTests
128
128
  "--new-version",
129
129
  "13.0.1",
130
130
  "--previous-version",
131
- "7.0.1",
132
- "--verbose"
131
+ "7.0.1"
133
132
  ],
134
133
  packages:
135
134
  [
@@ -207,8 +206,7 @@ public partial class EntryPointTests
207
206
  "--new-version",
208
207
  "6.6.1",
209
208
  "--previous-version",
210
- "6.1.0",
211
- "--verbose"
209
+ "6.1.0"
212
210
  ],
213
211
  packages:
214
212
  [
@@ -364,8 +362,7 @@ public partial class EntryPointTests
364
362
  "--new-version",
365
363
  "13.0.1",
366
364
  "--previous-version",
367
- "7.0.1",
368
- "--verbose"
365
+ "7.0.1"
369
366
  ];
370
367
 
371
368
  // verify base run
@@ -16,7 +16,7 @@ public partial class AnalyzeWorker
16
16
  {
17
17
  public const string AnalysisDirectoryName = "./.dependabot/analysis";
18
18
 
19
- private readonly Logger _logger;
19
+ private readonly ILogger _logger;
20
20
 
21
21
  internal static readonly JsonSerializerOptions SerializerOptions = new()
22
22
  {
@@ -24,7 +24,7 @@ public partial class AnalyzeWorker
24
24
  Converters = { new JsonStringEnumConverter(), new RequirementConverter() },
25
25
  };
26
26
 
27
- public AnalyzeWorker(Logger logger)
27
+ public AnalyzeWorker(ILogger logger)
28
28
  {
29
29
  _logger = logger;
30
30
  }
@@ -213,7 +213,7 @@ public partial class AnalyzeWorker
213
213
  ImmutableHashSet<string> packageIds,
214
214
  ImmutableArray<NuGetFramework> projectFrameworks,
215
215
  NuGetContext nugetContext,
216
- Logger logger,
216
+ ILogger logger,
217
217
  CancellationToken cancellationToken)
218
218
  {
219
219
  var versionResult = await VersionFinder.GetVersionsAsync(
@@ -239,7 +239,7 @@ public partial class AnalyzeWorker
239
239
  NuGetVersion version,
240
240
  bool findLowestVersion,
241
241
  NuGetContext nugetContext,
242
- Logger logger,
242
+ ILogger logger,
243
243
  CancellationToken cancellationToken)
244
244
  {
245
245
  var versionResult = await VersionFinder.GetVersionsAsync(
@@ -267,7 +267,7 @@ public partial class AnalyzeWorker
267
267
  ImmutableArray<NuGetFramework> projectFrameworks,
268
268
  bool findLowestVersion,
269
269
  NuGetContext nugetContext,
270
- Logger logger,
270
+ ILogger logger,
271
271
  CancellationToken cancellationToken)
272
272
  {
273
273
  var versions = versionResult.GetVersions();
@@ -299,7 +299,7 @@ public partial class AnalyzeWorker
299
299
  IEnumerable<NuGetVersion> orderedVersions,
300
300
  ImmutableArray<NuGetFramework> projectFrameworks,
301
301
  NuGetContext nugetContext,
302
- Logger logger,
302
+ ILogger logger,
303
303
  CancellationToken cancellationToken)
304
304
  {
305
305
  if (NuGetVersion.TryParse(versionString, out var currentVersion))
@@ -350,7 +350,7 @@ public partial class AnalyzeWorker
350
350
  NuGetVersion currentVersion,
351
351
  ImmutableArray<NuGetFramework> projectFrameworks,
352
352
  NuGetContext nugetContext,
353
- Logger logger,
353
+ ILogger logger,
354
354
  CancellationToken cancellationToken)
355
355
  {
356
356
  foreach (var packageId in packageIds)
@@ -376,7 +376,7 @@ public partial class AnalyzeWorker
376
376
  ImmutableHashSet<string> packageIds,
377
377
  NuGetVersion updatedVersion,
378
378
  NuGetContext nugetContext,
379
- Logger logger,
379
+ ILogger logger,
380
380
  CancellationToken cancellationToken)
381
381
  {
382
382
  // We need to find all projects which have the given dependency. Even in cases that they
@@ -459,7 +459,7 @@ public partial class AnalyzeWorker
459
459
  }).ToImmutableArray();
460
460
  }
461
461
 
462
- internal static async Task WriteResultsAsync(string analysisDirectory, string dependencyName, AnalysisResult result, Logger logger)
462
+ internal static async Task WriteResultsAsync(string analysisDirectory, string dependencyName, AnalysisResult result, ILogger logger)
463
463
  {
464
464
  if (!Directory.Exists(analysisDirectory))
465
465
  {
@@ -21,7 +21,7 @@ internal static class CompatibilityChecker
21
21
  PackageIdentity package,
22
22
  ImmutableArray<NuGetFramework> projectFrameworks,
23
23
  NuGetContext nugetContext,
24
- Logger logger,
24
+ ILogger logger,
25
25
  CancellationToken cancellationToken)
26
26
  {
27
27
  var (isDevDependency, packageFrameworks) = await GetPackageInfoAsync(
@@ -37,7 +37,7 @@ internal static class CompatibilityChecker
37
37
  ImmutableArray<NuGetFramework> projectFrameworks,
38
38
  bool isDevDependency,
39
39
  ImmutableArray<NuGetFramework> packageFrameworks,
40
- Logger logger)
40
+ ILogger logger)
41
41
  {
42
42
  // development dependencies are packages such as analyzers which need to be compatible with the compiler not the
43
43
  // project itself, but some packages that report themselves as development dependencies still contain target
@@ -14,7 +14,7 @@ internal static class DependencyFinder
14
14
  ImmutableHashSet<string> packageIds,
15
15
  NuGetVersion version,
16
16
  NuGetContext nugetContext,
17
- Logger logger,
17
+ ILogger logger,
18
18
  CancellationToken cancellationToken)
19
19
  {
20
20
  var versionString = version.ToNormalizedString();
@@ -19,10 +19,10 @@ internal record NuGetContext : IDisposable
19
19
  public ISettings Settings { get; }
20
20
  public IMachineWideSettings MachineWideSettings { get; }
21
21
  public ImmutableArray<PackageSource> PackageSources { get; }
22
- public ILogger Logger { get; }
22
+ public NuGet.Common.ILogger Logger { get; }
23
23
  public string TempPackageDirectory { get; }
24
24
 
25
- public NuGetContext(string? currentDirectory = null, ILogger? logger = null)
25
+ public NuGetContext(string? currentDirectory = null, NuGet.Common.ILogger? logger = null)
26
26
  {
27
27
  SourceCacheContext = new SourceCacheContext();
28
28
  PackageDownloadContext = new PackageDownloadContext(SourceCacheContext);
@@ -15,7 +15,7 @@ internal static class VersionFinder
15
15
  string packageId,
16
16
  NuGetVersion currentVersion,
17
17
  NuGetContext nugetContext,
18
- Logger logger,
18
+ ILogger logger,
19
19
  CancellationToken cancellationToken)
20
20
  {
21
21
  var versionFilter = CreateVersionFilter(currentVersion);
@@ -26,7 +26,7 @@ internal static class VersionFinder
26
26
  public static Task<VersionResult> GetVersionsAsync(
27
27
  DependencyInfo dependencyInfo,
28
28
  NuGetContext nugetContext,
29
- Logger logger,
29
+ ILogger logger,
30
30
  CancellationToken cancellationToken)
31
31
  {
32
32
  var packageId = dependencyInfo.Name;
@@ -42,7 +42,7 @@ internal static class VersionFinder
42
42
  NuGetVersion currentVersion,
43
43
  Func<NuGetVersion, bool> versionFilter,
44
44
  NuGetContext nugetContext,
45
- Logger logger,
45
+ ILogger logger,
46
46
  CancellationToken cancellationToken)
47
47
  {
48
48
  var includePrerelease = currentVersion.IsPrerelease;
@@ -130,7 +130,7 @@ internal static class VersionFinder
130
130
  IEnumerable<string> packageIds,
131
131
  NuGetVersion version,
132
132
  NuGetContext nugetContext,
133
- Logger logger,
133
+ ILogger logger,
134
134
  CancellationToken cancellationToken)
135
135
  {
136
136
  foreach (var packageId in packageIds)
@@ -148,7 +148,7 @@ internal static class VersionFinder
148
148
  string packageId,
149
149
  NuGetVersion version,
150
150
  NuGetContext nugetContext,
151
- Logger logger,
151
+ ILogger logger,
152
152
  CancellationToken cancellationToken)
153
153
  {
154
154
  var includePrerelease = version.IsPrerelease;
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
4
4
 
5
5
  internal static class DirectoryPackagesPropsDiscovery
6
6
  {
7
- public static DirectoryPackagesPropsDiscoveryResult? Discover(string repoRootPath, string workspacePath, ImmutableArray<ProjectDiscoveryResult> projectResults, Logger logger)
7
+ public static DirectoryPackagesPropsDiscoveryResult? Discover(string repoRootPath, string workspacePath, ImmutableArray<ProjectDiscoveryResult> projectResults, ILogger logger)
8
8
  {
9
9
  var projectResult = projectResults.FirstOrDefault(
10
10
  p => p.Properties.FirstOrDefault(prop => prop.Name.Equals("ManagePackageVersionsCentrally", StringComparison.OrdinalIgnoreCase)) is Property property
@@ -16,7 +16,7 @@ public partial class DiscoveryWorker
16
16
  {
17
17
  public const string DiscoveryResultFileName = "./.dependabot/discovery.json";
18
18
 
19
- private readonly Logger _logger;
19
+ private readonly ILogger _logger;
20
20
  private readonly HashSet<string> _processedProjectPaths = new(StringComparer.OrdinalIgnoreCase); private readonly HashSet<string> _restoredMSBuildSdks = new(StringComparer.OrdinalIgnoreCase);
21
21
 
22
22
  internal static readonly JsonSerializerOptions SerializerOptions = new()
@@ -25,7 +25,7 @@ public partial class DiscoveryWorker
25
25
  Converters = { new JsonStringEnumConverter() },
26
26
  };
27
27
 
28
- public DiscoveryWorker(Logger logger)
28
+ public DiscoveryWorker(ILogger logger)
29
29
  {
30
30
  _logger = logger;
31
31
  }
@@ -125,7 +125,7 @@ public partial class DiscoveryWorker
125
125
  /// Restores MSBuild SDKs from the given dependencies.
126
126
  /// </summary>
127
127
  /// <returns>Returns `true` when SDKs were restored successfully.</returns>
128
- private async Task<bool> TryRestoreMSBuildSdksAsync(string repoRootPath, string workspacePath, ImmutableArray<Dependency> dependencies, Logger logger)
128
+ private async Task<bool> TryRestoreMSBuildSdksAsync(string repoRootPath, string workspacePath, ImmutableArray<Dependency> dependencies, ILogger logger)
129
129
  {
130
130
  var msbuildSdks = dependencies
131
131
  .Where(d => d.Type == DependencyType.MSBuildSdk && !string.IsNullOrEmpty(d.Version))
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
4
4
 
5
5
  internal static class DotNetToolsJsonDiscovery
6
6
  {
7
- public static DotNetToolsJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath, Logger logger)
7
+ public static DotNetToolsJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath, ILogger logger)
8
8
  {
9
9
  if (!MSBuildHelper.TryGetDotNetToolsJsonPath(repoRootPath, workspacePath, out var dotnetToolsJsonPath))
10
10
  {
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
4
4
 
5
5
  internal static class GlobalJsonDiscovery
6
6
  {
7
- public static GlobalJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath, Logger logger)
7
+ public static GlobalJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath, ILogger logger)
8
8
  {
9
9
  if (!MSBuildHelper.TryGetGlobalJsonPath(repoRootPath, workspacePath, out var globalJsonPath))
10
10
  {
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
4
4
 
5
5
  internal static class PackagesConfigDiscovery
6
6
  {
7
- public static PackagesConfigDiscoveryResult? Discover(string workspacePath, string projectPath, Logger logger)
7
+ public static PackagesConfigDiscoveryResult? Discover(string workspacePath, string projectPath, ILogger logger)
8
8
  {
9
9
  if (!NuGetHelper.TryGetPackagesConfigFile(projectPath, out var packagesConfigPath))
10
10
  {
@@ -6,7 +6,7 @@ namespace NuGetUpdater.Core.Discover;
6
6
 
7
7
  internal static class SdkProjectDiscovery
8
8
  {
9
- public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverAsync(string repoRootPath, string workspacePath, string projectPath, Logger logger)
9
+ public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverAsync(string repoRootPath, string workspacePath, string projectPath, ILogger logger)
10
10
  {
11
11
  // Determine which targets and props files contribute to the build.
12
12
  var (buildFiles, projectTargetFrameworks) = await MSBuildHelper.LoadBuildFilesAndTargetFrameworksAsync(repoRootPath, projectPath);
@@ -97,7 +97,7 @@ internal static class SdkProjectDiscovery
97
97
  return results.ToImmutable();
98
98
  }
99
99
 
100
- private static async Task<ImmutableArray<Dependency>> GetTransitiveDependencies(string repoRootPath, string projectPath, ImmutableArray<string> tfms, ImmutableArray<Dependency> directDependencies, Logger logger)
100
+ private static async Task<ImmutableArray<Dependency>> GetTransitiveDependencies(string repoRootPath, string projectPath, ImmutableArray<string> tfms, ImmutableArray<Dependency> directDependencies, ILogger logger)
101
101
  {
102
102
  Dictionary<string, Dependency> transitiveDependencies = new(StringComparer.OrdinalIgnoreCase);
103
103
  foreach (var tfm in tfms)
@@ -2,9 +2,9 @@ namespace NuGetUpdater.Core;
2
2
 
3
3
  public enum ErrorType
4
4
  {
5
- // TODO: add `Unknown` option to track all other failure types
6
5
  None,
7
6
  AuthenticationFailure,
8
7
  MissingFile,
9
8
  UpdateNotPossible,
9
+ Unknown,
10
10
  }
@@ -4,10 +4,10 @@ namespace NuGetUpdater.Core;
4
4
 
5
5
  internal sealed class DotNetToolsJsonBuildFile : JsonBuildFile
6
6
  {
7
- public static DotNetToolsJsonBuildFile Open(string basePath, string path, Logger logger)
7
+ public static DotNetToolsJsonBuildFile Open(string basePath, string path, ILogger logger)
8
8
  => new(basePath, path, File.ReadAllText(path), logger);
9
9
 
10
- public DotNetToolsJsonBuildFile(string basePath, string path, string contents, Logger logger)
10
+ public DotNetToolsJsonBuildFile(string basePath, string path, string contents, ILogger logger)
11
11
  : base(basePath, path, contents, logger)
12
12
  {
13
13
  }
@@ -4,10 +4,10 @@ namespace NuGetUpdater.Core;
4
4
 
5
5
  internal sealed class GlobalJsonBuildFile : JsonBuildFile
6
6
  {
7
- public static GlobalJsonBuildFile Open(string basePath, string path, Logger logger)
7
+ public static GlobalJsonBuildFile Open(string basePath, string path, ILogger logger)
8
8
  => new(basePath, path, File.ReadAllText(path), logger);
9
9
 
10
- public GlobalJsonBuildFile(string basePath, string path, string contents, Logger logger)
10
+ public GlobalJsonBuildFile(string basePath, string path, string contents, ILogger logger)
11
11
  : base(basePath, path, contents, logger)
12
12
  {
13
13
  }
@@ -8,9 +8,9 @@ namespace NuGetUpdater.Core;
8
8
  internal abstract class JsonBuildFile : BuildFile<string>
9
9
  {
10
10
  protected Lazy<JsonNode?> Node;
11
- private readonly Logger logger;
11
+ private readonly ILogger logger;
12
12
 
13
- public JsonBuildFile(string repoRootPath, string path, string contents, Logger logger)
13
+ public JsonBuildFile(string repoRootPath, string path, string contents, ILogger logger)
14
14
  : base(repoRootPath, path, contents)
15
15
  {
16
16
  Node = new Lazy<JsonNode?>(() => null);
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.FrameworkChecker;
4
4
 
5
5
  public class CompatibilityChecker
6
6
  {
7
- public static bool IsCompatible(string[] projectTfms, string[] packageTfms, Logger logger)
7
+ public static bool IsCompatible(string[] projectTfms, string[] packageTfms, ILogger logger)
8
8
  {
9
9
  var projectFrameworks = projectTfms.Select(ParseFramework);
10
10
  var packageFrameworks = packageTfms.Select(ParseFramework);
@@ -12,7 +12,7 @@ namespace NuGetUpdater.Core.Run;
12
12
  public class RunWorker
13
13
  {
14
14
  private readonly IApiHandler _apiHandler;
15
- private readonly Logger _logger;
15
+ private readonly ILogger _logger;
16
16
 
17
17
  internal static readonly JsonSerializerOptions SerializerOptions = new()
18
18
  {
@@ -21,7 +21,7 @@ public class RunWorker
21
21
  Converters = { new JsonStringEnumConverter() },
22
22
  };
23
23
 
24
- public RunWorker(IApiHandler apiHandler, Logger logger)
24
+ public RunWorker(IApiHandler apiHandler, ILogger logger)
25
25
  {
26
26
  _apiHandler = apiHandler;
27
27
  _logger = logger;