dependabot-nuget 0.292.0 → 0.293.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/.gitignore +1 -0
  3. data/helpers/lib/NuGetUpdater/Directory.Packages.props +1 -0
  4. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Correlator.cs +197 -0
  5. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/DotNetPackageCorrelation.csproj +12 -0
  6. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/PackageMapper.cs +68 -0
  7. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/PackageSet.cs +11 -0
  8. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/Release.cs +25 -0
  9. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/ReleasesFile.cs +9 -0
  10. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/RuntimePackages.cs +11 -0
  11. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/Sdk.cs +13 -0
  12. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/SemVerComparer.cs +16 -0
  13. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/SemVersionConverter.cs +42 -0
  14. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/DotNetPackageCorrelation.Cli.csproj +16 -0
  15. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/Program.cs +32 -0
  16. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/CorrelatorTests.cs +99 -0
  17. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/DotNetPackageCorrelation.Test.csproj +18 -0
  18. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/EndToEndTests.cs +30 -0
  19. data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/RuntimePackagesTests.cs +206 -0
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +6 -4
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +8 -7
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +4 -4
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +17 -5
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +7 -1
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +46 -6
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +8 -0
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +8 -17
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +4 -4
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Extensions.cs +1 -1
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Clone/CloneWorker.cs +2 -1
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.targets +2 -2
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +7 -20
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +3 -3
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +99 -2
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/EnsureDotNetPackageCorrelation.targets +25 -0
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +9 -22
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +5 -1
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/MissingFileException.cs +2 -1
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NativeResult.cs +3 -3
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +3 -0
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotFound.cs +7 -3
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotParseable.cs +15 -0
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +24 -0
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +6 -21
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/UnparseableFileException.cs +12 -0
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +21 -0
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +6 -30
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DotNetPackageCorrelationManager.cs +46 -0
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +51 -27
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +15 -4
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +15 -9
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +20 -12
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +108 -0
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +16 -12
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +1 -1
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +15 -28
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +5 -4
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +9 -1
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestBase.cs +24 -0
  61. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/ExpectedUpdateOperationResult.cs +1 -1
  62. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +11 -15
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +1 -1
  64. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +14 -8
  65. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +148 -3
  66. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +12 -14
  67. data/helpers/lib/NuGetUpdater/NuGetUpdater.sln +18 -1
  68. data/lib/dependabot/nuget/native_helpers.rb +41 -16
  69. metadata +25 -6
  70. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs +0 -12
@@ -11,6 +11,11 @@ module Dependabot
11
11
  module NativeHelpers
12
12
  extend T::Sig
13
13
 
14
+ sig { returns(String) }
15
+ def self.job_id
16
+ ENV.fetch("DEPENDABOT_JOB_ID")
17
+ end
18
+
14
19
  sig { returns(String) }
15
20
  def self.native_helpers_root
16
21
  helpers_root = ENV.fetch("DEPENDABOT_NATIVE_HELPERS_PATH", nil)
@@ -66,6 +71,8 @@ module Dependabot
66
71
  command_parts = [
67
72
  exe_path,
68
73
  "discover",
74
+ "--job-id",
75
+ job_id,
69
76
  "--job-path",
70
77
  job_path,
71
78
  "--repo-root",
@@ -81,6 +88,8 @@ module Dependabot
81
88
  fingerprint = [
82
89
  exe_path,
83
90
  "discover",
91
+ "--job-id",
92
+ "<job-id>",
84
93
  "--job-path",
85
94
  "<job-path>",
86
95
  "--repo-root",
@@ -127,6 +136,8 @@ module Dependabot
127
136
  command_parts = [
128
137
  exe_path,
129
138
  "analyze",
139
+ "--job-id",
140
+ job_id,
130
141
  "--job-path",
131
142
  job_path,
132
143
  "--repo-root",
@@ -144,6 +155,8 @@ module Dependabot
144
155
  fingerprint = [
145
156
  exe_path,
146
157
  "analyze",
158
+ "--job-id",
159
+ "<job-id>",
147
160
  "--job-path",
148
161
  "<job-path>",
149
162
  "--discovery-file-path",
@@ -190,6 +203,8 @@ module Dependabot
190
203
  command_parts = [
191
204
  exe_path,
192
205
  "update",
206
+ "--job-id",
207
+ job_id,
193
208
  "--job-path",
194
209
  job_path,
195
210
  "--repo-root",
@@ -212,6 +227,8 @@ module Dependabot
212
227
  fingerprint = [
213
228
  exe_path,
214
229
  "update",
230
+ "--job-id",
231
+ "<job-id>",
215
232
  "--job-path",
216
233
  "<job-path>",
217
234
  "--repo-root",
@@ -290,29 +307,37 @@ module Dependabot
290
307
  puts output
291
308
  end
292
309
 
310
+ # rubocop:disable Metrics/AbcSize
293
311
  sig { params(json: T::Hash[String, T.untyped]).void }
294
312
  def self.ensure_no_errors(json)
295
- error_type = T.let(json.fetch("ErrorType", nil), T.nilable(String))
296
- error_details = json.fetch("ErrorDetails", nil)
313
+ error = T.let(json.fetch("Error", nil), T.nilable(T::Hash[String, T.untyped]))
314
+ return if error.nil?
315
+
316
+ error_type = T.let(error.fetch("error-type"), String)
317
+ error_details = T.let(error.fetch("error-details", {}), T::Hash[String, T.untyped])
318
+
297
319
  case error_type
298
- when "None", nil
299
- # no issue
300
- when "DependencyFileNotParseable"
301
- raise DependencyFileNotParseable, T.must(T.let(error_details, T.nilable(String)))
302
- when "AuthenticationFailure"
303
- raise PrivateSourceAuthenticationFailure, T.let(error_details, T.nilable(String))
304
- when "BadRequirement"
305
- raise BadRequirementError, T.let(error_details, T.nilable(String))
306
- when "MissingFile"
307
- raise DependencyFileNotFound, T.let(error_details, T.nilable(String))
308
- when "UpdateNotPossible"
309
- raise UpdateNotPossible, T.let(error_details, T::Array[String])
310
- when "Unknown"
311
- raise DependabotError, T.let(error_details, String)
320
+ when "dependency_file_not_found"
321
+ file_path = T.let(error_details.fetch("file-path"), String)
322
+ message = T.let(error_details.fetch("message", nil), T.nilable(String))
323
+ raise DependencyFileNotFound.new(file_path, message)
324
+ when "dependency_file_not_parseable"
325
+ file_path = T.let(error_details.fetch("file-path"), String)
326
+ message = T.let(error_details.fetch("message", nil), T.nilable(String))
327
+ raise DependencyFileNotParseable.new(file_path, message)
328
+ when "illformed_requirement"
329
+ raise BadRequirementError, T.let(error_details.fetch("message"), String)
330
+ when "private_source_authentication_failure"
331
+ raise PrivateSourceAuthenticationFailure, T.let(error_details.fetch("source"), String)
332
+ when "update_not_possible"
333
+ raise UpdateNotPossible, T.let(error_details.fetch("dependencies"), T::Array[String])
334
+ when "unknown_error"
335
+ raise DependabotError, error_details.to_json
312
336
  else
313
337
  raise "Unexpected error type from native tool: #{error_type}: #{error_details}"
314
338
  end
315
339
  end
340
+ # rubocop:enable Metrics/AbcSize
316
341
  end
317
342
  end
318
343
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-nuget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.292.0
4
+ version: 0.293.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.292.0
19
+ version: 0.293.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.292.0
26
+ version: 0.293.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -269,6 +269,22 @@ files:
269
269
  - helpers/lib/NuGetUpdater/Directory.Build.targets
270
270
  - helpers/lib/NuGetUpdater/Directory.Common.props
271
271
  - helpers/lib/NuGetUpdater/Directory.Packages.props
272
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/DotNetPackageCorrelation.Cli.csproj
273
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/Program.cs
274
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/CorrelatorTests.cs
275
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/DotNetPackageCorrelation.Test.csproj
276
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/EndToEndTests.cs
277
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/RuntimePackagesTests.cs
278
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Correlator.cs
279
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/DotNetPackageCorrelation.csproj
280
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/PackageMapper.cs
281
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/PackageSet.cs
282
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/Release.cs
283
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/ReleasesFile.cs
284
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/RuntimePackages.cs
285
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/Sdk.cs
286
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/SemVerComparer.cs
287
+ - helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/SemVersionConverter.cs
272
288
  - helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.props
273
289
  - helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.targets
274
290
  - helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Build.Tasks/NuGet.Build.Tasks.csproj
@@ -397,7 +413,7 @@ files:
397
413
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs
398
414
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs
399
415
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs
400
- - helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs
416
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/EnsureDotNetPackageCorrelation.targets
401
417
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/EvaluationResult.cs
402
418
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/EvaluationResultType.cs
403
419
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs
@@ -426,6 +442,7 @@ files:
426
442
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs
427
443
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFile.cs
428
444
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotFound.cs
445
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotParseable.cs
429
446
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs
430
447
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs
431
448
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs
@@ -450,6 +467,7 @@ files:
450
467
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs
451
468
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/VersionConverter.cs
452
469
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/TargetFrameworkReporter.targets
470
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/UnparseableFileException.cs
453
471
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/UpdateNotPossibleException.cs
454
472
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
455
473
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs
@@ -467,6 +485,7 @@ files:
467
485
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/CollectionExtensions.cs
468
486
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs
469
487
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs
488
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DotNetPackageCorrelationManager.cs
470
489
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs
471
490
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs
472
491
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ImmutableArrayExtensions.cs
@@ -509,7 +528,7 @@ licenses:
509
528
  - MIT
510
529
  metadata:
511
530
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
512
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.292.0
531
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.293.0
513
532
  post_install_message:
514
533
  rdoc_options: []
515
534
  require_paths:
@@ -1,12 +0,0 @@
1
- namespace NuGetUpdater.Core;
2
-
3
- public enum ErrorType
4
- {
5
- None,
6
- AuthenticationFailure,
7
- BadRequirement,
8
- MissingFile,
9
- UpdateNotPossible,
10
- DependencyFileNotParseable,
11
- Unknown,
12
- }