dependabot-nuget 0.288.0 → 0.290.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +19 -17
  3. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Packaging/NuGet.Packaging.csproj +0 -1
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +7 -3
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +1 -1
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +29 -2
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +25 -4
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +0 -6
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +33 -16
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +25 -10
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +0 -13
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementArrayConverter.cs +39 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +1 -1
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Clone/ShellGitCommandHandler.cs +1 -1
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +60 -66
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs +2 -2
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscovery.cs +2 -2
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +11 -3
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscoveryResult.cs +1 -0
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +2 -4
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +54 -11
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +0 -1
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +1 -2
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +1 -1
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +2 -2
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Advisory.cs +13 -0
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs +18 -1
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CommitOptions.cs +8 -0
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Condition.cs +19 -0
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs +8 -0
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs +9 -0
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +13 -10
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PullRequest.cs +11 -0
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementsUpdateStrategy.cs +15 -0
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +67 -58
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/VersionConverter.cs +19 -0
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +15 -44
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +4 -4
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +5 -5
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +2 -10
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +38 -33
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +25 -23
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +16 -12
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs +1 -1
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +19 -19
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs +11 -1
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +2 -0
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +18 -17
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -17
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +17 -9
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProjectHelper.cs +96 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +5 -2
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +87 -5
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +2 -5
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +45 -1
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +35 -1
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +16 -0
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +6 -0
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +143 -36
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +184 -48
  61. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +5 -5
  62. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +32 -10
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +85 -0
  64. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +402 -102
  65. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +342 -2
  66. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs +60 -2
  67. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +18 -7
  68. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestLogger.cs +1 -1
  69. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/BindingRedirectsTests.cs +1 -1
  70. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +24 -0
  71. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +4 -14
  72. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +84 -0
  73. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +66 -0
  74. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +95 -0
  75. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1 -7
  76. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/AssertEx.cs +1 -1
  77. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/LinuxOnlyAttribute.cs +12 -0
  78. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +558 -711
  79. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +47 -2
  80. data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +4 -2
  81. data/lib/dependabot/nuget/analysis/dependency_analysis.rb +3 -3
  82. data/lib/dependabot/nuget/discovery/dependency_details.rb +10 -3
  83. data/lib/dependabot/nuget/discovery/dependency_file_discovery.rb +8 -12
  84. data/lib/dependabot/nuget/discovery/discovery_json_reader.rb +214 -29
  85. data/lib/dependabot/nuget/discovery/project_discovery.rb +41 -8
  86. data/lib/dependabot/nuget/discovery/workspace_discovery.rb +14 -19
  87. data/lib/dependabot/nuget/file_fetcher.rb +11 -393
  88. data/lib/dependabot/nuget/file_parser.rb +23 -61
  89. data/lib/dependabot/nuget/file_updater.rb +28 -23
  90. data/lib/dependabot/nuget/native_helpers.rb +14 -5
  91. data/lib/dependabot/nuget/update_checker/requirements_updater.rb +23 -27
  92. data/lib/dependabot/nuget/update_checker.rb +116 -190
  93. metadata +20 -32
  94. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Packages.props +0 -29
  95. data/lib/dependabot/nuget/discovery/directory_packages_props_discovery.rb +0 -43
  96. data/lib/dependabot/nuget/file_fetcher/import_paths_finder.rb +0 -73
  97. data/lib/dependabot/nuget/file_fetcher/sln_project_paths_finder.rb +0 -60
  98. data/lib/dependabot/nuget/http_response_helpers.rb +0 -19
  99. data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +0 -102
  100. data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +0 -129
  101. data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +0 -171
  102. data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +0 -63
  103. data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +0 -82
  104. data/lib/dependabot/nuget/native_discovery/native_property_details.rb +0 -43
  105. data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +0 -68
  106. data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +0 -105
  107. data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +0 -201
  108. data/lib/dependabot/nuget/nuget_client.rb +0 -223
  109. data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +0 -116
  110. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +0 -297
  111. data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +0 -221
  112. data/lib/dependabot/nuget/update_checker/nuspec_fetcher.rb +0 -110
  113. data/lib/dependabot/nuget/update_checker/property_updater.rb +0 -196
  114. data/lib/dependabot/nuget/update_checker/repository_finder.rb +0 -466
  115. data/lib/dependabot/nuget/update_checker/tfm_comparer.rb +0 -34
  116. data/lib/dependabot/nuget/update_checker/tfm_finder.rb +0 -30
  117. data/lib/dependabot/nuget/update_checker/version_finder.rb +0 -449
@@ -9,7 +9,6 @@ public record ExpectedWorkspaceDiscoveryResult : NativeResult
9
9
  public required string Path { get; init; }
10
10
  public bool IsSuccess { get; init; } = true;
11
11
  public ImmutableArray<ExpectedSdkProjectDiscoveryResult> Projects { get; init; }
12
- public ImmutableArray<string> ImportedFiles { get; init; } = [];
13
12
  public int? ExpectedProjectCount { get; init; }
14
13
  public ExpectedDependencyDiscoveryResult? GlobalJson { get; init; }
15
14
  public ExpectedDependencyDiscoveryResult? DotNetToolsJson { get; init; }
@@ -17,10 +16,11 @@ public record ExpectedWorkspaceDiscoveryResult : NativeResult
17
16
 
18
17
  public record ExpectedSdkProjectDiscoveryResult : ExpectedDependencyDiscoveryResult
19
18
  {
20
- public ImmutableArray<Property> Properties { get; init; } = [];
21
- public ImmutableArray<string> TargetFrameworks { get; init; } = [];
22
- public ImmutableArray<string> ReferencedProjectPaths { get; init; } = [];
23
- public ImmutableArray<string>? ImportedFiles { get; init; } = null;
19
+ public required ImmutableArray<Property> Properties { get; init; }
20
+ public required ImmutableArray<string> TargetFrameworks { get; init; }
21
+ public required ImmutableArray<string> ReferencedProjectPaths { get; init; }
22
+ public required ImmutableArray<string> ImportedFiles { get; init; }
23
+ public required ImmutableArray<string> AdditionalFiles { get; init; }
24
24
  }
25
25
 
26
26
  public record ExpectedDependencyDiscoveryResult : IDiscoveryResultWithDependencies
@@ -50,7 +50,9 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
50
50
  [
51
51
  new("TargetFramework", "net8.0", "src/library.csproj"),
52
52
  ],
53
- TargetFrameworks = ["net8.0"]
53
+ TargetFrameworks = ["net8.0"],
54
+ ReferencedProjectPaths = [],
55
+ AdditionalFiles = [],
54
56
  }
55
57
  ]
56
58
  );
@@ -99,7 +101,12 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
99
101
  [
100
102
  new("TargetFramework", "net8.0", "src/library.csproj"),
101
103
  ],
102
- TargetFrameworks = ["net8.0"]
104
+ TargetFrameworks = ["net8.0"],
105
+ ReferencedProjectPaths = [],
106
+ ImportedFiles = [
107
+ "../Directory.Build.targets"
108
+ ],
109
+ AdditionalFiles = [],
103
110
  }
104
111
  ]
105
112
  );
@@ -160,7 +167,8 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
160
167
  [
161
168
  new("TargetFramework", "net8.0", "src/library1/library1.csproj"),
162
169
  ],
163
- TargetFrameworks = ["net8.0"]
170
+ TargetFrameworks = ["net8.0"],
171
+ AdditionalFiles = [],
164
172
  },
165
173
  new()
166
174
  {
@@ -173,7 +181,10 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
173
181
  [
174
182
  new("TargetFramework", "net8.0", "src/library2/library2.csproj"),
175
183
  ],
176
- TargetFrameworks = ["net8.0"]
184
+ TargetFrameworks = ["net8.0"],
185
+ ReferencedProjectPaths = [],
186
+ ImportedFiles = [],
187
+ AdditionalFiles = [],
177
188
  }
178
189
  ]
179
190
  );
@@ -232,7 +243,8 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
232
243
  [
233
244
  new("TargetFramework", "net8.0", "src/library1/library1.csproj"),
234
245
  ],
235
- TargetFrameworks = ["net8.0"]
246
+ TargetFrameworks = ["net8.0"],
247
+ AdditionalFiles = [],
236
248
  },
237
249
  new()
238
250
  {
@@ -247,7 +259,9 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
247
259
  [
248
260
  new("TargetFramework", "net8.0", "src/library2/library2.csproj"),
249
261
  ],
250
- TargetFrameworks = ["net8.0"]
262
+ TargetFrameworks = ["net8.0"],
263
+ ReferencedProjectPaths = [],
264
+ AdditionalFiles = [],
251
265
  }
252
266
  ]
253
267
  );
@@ -291,7 +305,9 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
291
305
  [
292
306
  new("TargetFrameworks", "net7.0;net8.0", "src/library.csproj"),
293
307
  ],
294
- TargetFrameworks = ["net7.0", "net8.0"]
308
+ TargetFrameworks = ["net7.0", "net8.0"],
309
+ ReferencedProjectPaths = [],
310
+ AdditionalFiles = [],
295
311
  },
296
312
  ]
297
313
  );
@@ -334,7 +350,9 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
334
350
  [
335
351
  new("TargetFramework", "netstandard2.0", "src/library.csproj"),
336
352
  ],
337
- TargetFrameworks = ["netstandard2.0"]
353
+ TargetFrameworks = ["netstandard2.0"],
354
+ ReferencedProjectPaths = [],
355
+ AdditionalFiles = [],
338
356
  },
339
357
  ]
340
358
  );
@@ -386,7 +404,9 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
386
404
  new("ManagePackageVersionsCentrally", "true", "src/library.csproj"),
387
405
  new("TargetFramework", "net8.0", "src/library.csproj"),
388
406
  ],
389
- TargetFrameworks = ["net8.0"]
407
+ TargetFrameworks = ["net8.0"],
408
+ ReferencedProjectPaths = [],
409
+ AdditionalFiles = [],
390
410
  },
391
411
  ]
392
412
  );
@@ -451,7 +471,9 @@ public class SdkProjectDiscoveryTests : DiscoveryWorkerTestBase
451
471
  new("ManagePackageVersionsCentrally", "true", "src/library.csproj"),
452
472
  new("TargetFramework", "net8.0", "src/library.csproj"),
453
473
  ],
454
- TargetFrameworks = ["net8.0"]
474
+ TargetFrameworks = ["net8.0"],
475
+ ReferencedProjectPaths = [],
476
+ AdditionalFiles = [],
455
477
  },
456
478
  ]
457
479
  );
@@ -0,0 +1,85 @@
1
+ using NuGet.Versioning;
2
+
3
+ using NuGetUpdater.Core.Analyze;
4
+ using NuGetUpdater.Core.Run;
5
+ using NuGetUpdater.Core.Run.ApiModel;
6
+
7
+ using Xunit;
8
+
9
+ namespace NuGetUpdater.Core.Test.Run;
10
+
11
+ public class MiscellaneousTests
12
+ {
13
+ [Theory]
14
+ [MemberData(nameof(RequirementsFromIgnoredVersionsData))]
15
+ public void RequirementsFromIgnoredVersions(string dependencyName, Condition[] ignoreConditions, Requirement[] expectedRequirements)
16
+ {
17
+ var job = new Job()
18
+ {
19
+ Source = new()
20
+ {
21
+ Provider = "github",
22
+ Repo = "some/repo"
23
+ },
24
+ IgnoreConditions = ignoreConditions
25
+ };
26
+ var actualRequirements = RunWorker.GetIgnoredRequirementsForDependency(job, dependencyName);
27
+ var actualRequirementsStrings = string.Join("|", actualRequirements.Select(r => r.ToString()));
28
+ var expectedRequirementsStrings = string.Join("|", expectedRequirements.Select(r => r.ToString()));
29
+ Assert.Equal(expectedRequirementsStrings, actualRequirementsStrings);
30
+ }
31
+
32
+ public static IEnumerable<object?[]> RequirementsFromIgnoredVersionsData()
33
+ {
34
+ yield return
35
+ [
36
+ // dependencyName
37
+ "Some.Package",
38
+ // ignoredConditions
39
+ new Condition[]
40
+ {
41
+ new()
42
+ {
43
+ DependencyName = "SOME.PACKAGE",
44
+ VersionRequirement = Requirement.Parse("> 1.2.3")
45
+ },
46
+ new()
47
+ {
48
+ DependencyName = "some.package",
49
+ VersionRequirement = Requirement.Parse("<= 2.0.0")
50
+ },
51
+ new()
52
+ {
53
+ DependencyName = "Unrelated.Package",
54
+ VersionRequirement = Requirement.Parse("= 3.4.5")
55
+ }
56
+ },
57
+ // expectedRequirements
58
+ new Requirement[]
59
+ {
60
+ new IndividualRequirement(">", NuGetVersion.Parse("1.2.3")),
61
+ new IndividualRequirement("<=", NuGetVersion.Parse("2.0.0")),
62
+ }
63
+ ];
64
+
65
+ // version requirement is null => ignore all
66
+ yield return
67
+ [
68
+ // dependencyName
69
+ "Some.Package",
70
+ // ignoredConditions
71
+ new Condition[]
72
+ {
73
+ new()
74
+ {
75
+ DependencyName = "Some.Package"
76
+ }
77
+ },
78
+ // expectedRequirements
79
+ new Requirement[]
80
+ {
81
+ new IndividualRequirement(">", NuGetVersion.Parse("0.0.0"))
82
+ }
83
+ ];
84
+ }
85
+ }