dependabot-nuget 0.257.0 → 0.259.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +2 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
  27. data/helpers/lib/NuGetUpdater/global.json +6 -0
  28. data/lib/dependabot/nuget/file_parser.rb +4 -5
  29. data/lib/dependabot/nuget/file_updater.rb +1 -1
  30. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
  31. data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
  32. data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
  33. data/lib/dependabot/nuget/update_checker.rb +1 -0
  34. metadata +8 -5
@@ -0,0 +1,6 @@
1
+ {
2
+ "sdk": {
3
+ "version": "8.0.300",
4
+ "rollForward": "latestMinor"
5
+ }
6
+ }
@@ -16,20 +16,19 @@ module Dependabot
16
16
  extend T::Sig
17
17
 
18
18
  require "dependabot/file_parsers/base/dependency_set"
19
+ require_relative "cache_manager"
19
20
 
20
21
  sig { override.returns(T::Array[Dependabot::Dependency]) }
21
22
  def parse
22
- workspace_path = project_files.first&.directory
23
- return [] unless workspace_path
24
23
  return [] unless repo_contents_path
25
24
 
26
- # `workspace_path` is the only unique value here so we use it as the cache key
27
25
  cache = T.let(CacheManager.cache("file_parser.parse"), T::Hash[String, T::Array[Dependabot::Dependency]])
28
- key = workspace_path
26
+ # key the cache on the dependency files, excluding the content
27
+ key = dependency_files.map { |d| d.to_h.except("content") }.to_s
29
28
  cache[key] ||= begin
30
29
  # run discovery for the repo
31
30
  NativeHelpers.run_nuget_discover_tool(repo_root: T.must(repo_contents_path),
32
- workspace_path: workspace_path,
31
+ workspace_path: source&.directory || "/",
33
32
  output_path: DiscoveryJsonReader.discovery_file_path,
34
33
  credentials: credentials)
35
34
  discovered_dependencies.dependencies
@@ -202,7 +202,7 @@ module Dependabot
202
202
 
203
203
  sig { returns(T::Array[Dependabot::DependencyFile]) }
204
204
  def project_files
205
- dependency_files.select { |df| df.name.match?(/\.([a-z]{2})?proj$/) }
205
+ dependency_files.select { |df| df.name.match?(/\.(cs|vb|fs)proj$/) }
206
206
  end
207
207
 
208
208
  sig { returns(T::Array[Dependabot::DependencyFile]) }
@@ -37,13 +37,15 @@ module Dependabot
37
37
  params(
38
38
  dependency: Dependabot::Dependency,
39
39
  dependency_files: T::Array[Dependabot::DependencyFile],
40
+ ignored_versions: T::Array[String],
40
41
  credentials: T::Array[Dependabot::Credential],
41
42
  repo_contents_path: T.nilable(String)
42
43
  ).void
43
44
  end
44
- def initialize(dependency:, dependency_files:, credentials:, repo_contents_path:)
45
+ def initialize(dependency:, dependency_files:, ignored_versions:, credentials:, repo_contents_path:)
45
46
  @dependency = dependency
46
47
  @dependency_files = dependency_files
48
+ @ignored_versions = ignored_versions
47
49
  @credentials = credentials
48
50
  @repo_contents_path = repo_contents_path
49
51
  end
@@ -127,6 +129,9 @@ module Dependabot
127
129
  sig { returns(T::Array[Dependabot::DependencyFile]) }
128
130
  attr_reader :dependency_files
129
131
 
132
+ sig { returns(T::Array[String]) }
133
+ attr_reader :ignored_versions
134
+
130
135
  sig { returns(T::Array[Dependabot::Credential]) }
131
136
  attr_reader :credentials
132
137
 
@@ -280,7 +285,7 @@ module Dependabot
280
285
  dependency: dep,
281
286
  dependency_files: dependency_files,
282
287
  credentials: credentials,
283
- ignored_versions: [],
288
+ ignored_versions: ignored_versions,
284
289
  raise_on_ignored: false,
285
290
  security_advisories: [],
286
291
  repo_contents_path: repo_contents_path
@@ -134,6 +134,7 @@ module Dependabot
134
134
  DependencyFinder.new(
135
135
  dependency: dependency,
136
136
  dependency_files: dependency_files,
137
+ ignored_versions: ignored_versions,
137
138
  credentials: credentials,
138
139
  repo_contents_path: repo_contents_path
139
140
  ).updated_peer_dependencies.each do |peer_dependency|
@@ -187,12 +187,11 @@ module Dependabot
187
187
  end
188
188
  def filter_ignored_versions(possible_versions)
189
189
  filtered = possible_versions
190
-
191
190
  ignored_versions.each do |req|
192
- ignore_req = requirement_class.new(parse_requirement_string(req))
191
+ ignore_reqs = parse_requirement_string(req).map { |r| requirement_class.new(r) }
193
192
  filtered =
194
193
  filtered
195
- .reject { |v| ignore_req.satisfied_by?(v.fetch(:version)) }
194
+ .reject { |v| ignore_reqs.any? { |r| r.satisfied_by?(v.fetch(:version)) } }
196
195
  end
197
196
 
198
197
  if @raise_on_ignored && filter_lower_versions(filtered).empty? &&
@@ -125,6 +125,7 @@ module Dependabot
125
125
  updated_dependencies += DependencyFinder.new(
126
126
  dependency: updated_dependency,
127
127
  dependency_files: dependency_files,
128
+ ignored_versions: ignored_versions,
128
129
  credentials: credentials,
129
130
  repo_contents_path: @repo_contents_path
130
131
  ).updated_peer_dependencies
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.257.0
4
+ version: 0.259.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2024-05-30 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.257.0
19
+ version: 0.259.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.257.0
26
+ version: 0.259.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -303,6 +303,7 @@ files:
303
303
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs
304
304
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs
305
305
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs
306
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs
306
307
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs
307
308
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs
308
309
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs
@@ -313,6 +314,7 @@ files:
313
314
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs
314
315
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/FrameworkCompatibilityServiceFacts.cs
315
316
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs
317
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs
316
318
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj
317
319
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs
318
320
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestBase.cs
@@ -380,6 +382,7 @@ files:
380
382
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs
381
383
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs
382
384
  - helpers/lib/NuGetUpdater/NuGetUpdater.sln
385
+ - helpers/lib/NuGetUpdater/global.json
383
386
  - helpers/lib/NuGetUpdater/xunit.runner.json
384
387
  - lib/dependabot/nuget.rb
385
388
  - lib/dependabot/nuget/cache_manager.rb
@@ -419,7 +422,7 @@ licenses:
419
422
  - MIT
420
423
  metadata:
421
424
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
422
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.257.0
425
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.259.0
423
426
  post_install_message:
424
427
  rdoc_options: []
425
428
  require_paths: