dependabot-nuget 0.276.0 → 0.278.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +42 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +132 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +11 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +9 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFile.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +49 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobFile.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobSource.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MarkAsProcessed.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedDependency.cs +16 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedRequirement.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementSource.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatedDependencyList.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs +59 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +283 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +28 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +16 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +34 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +223 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +60 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/TestApiHandler.cs +35 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs +69 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +22 -0
- data/lib/dependabot/nuget/file_fetcher.rb +17 -0
- metadata +29 -5
@@ -0,0 +1,35 @@
|
|
1
|
+
using NuGetUpdater.Core.Run;
|
2
|
+
using NuGetUpdater.Core.Run.ApiModel;
|
3
|
+
|
4
|
+
namespace NuGetUpdater.Core.Test;
|
5
|
+
|
6
|
+
internal class TestApiHandler : IApiHandler
|
7
|
+
{
|
8
|
+
private readonly List<(Type, object)> _receivedMessages = new();
|
9
|
+
|
10
|
+
public IEnumerable<(Type Type, object Object)> ReceivedMessages => _receivedMessages;
|
11
|
+
|
12
|
+
public Task UpdateDependencyList(UpdatedDependencyList updatedDependencyList)
|
13
|
+
{
|
14
|
+
_receivedMessages.Add((typeof(UpdatedDependencyList), updatedDependencyList));
|
15
|
+
return Task.CompletedTask;
|
16
|
+
}
|
17
|
+
|
18
|
+
public Task IncrementMetric(IncrementMetric incrementMetric)
|
19
|
+
{
|
20
|
+
_receivedMessages.Add((typeof(IncrementMetric), incrementMetric));
|
21
|
+
return Task.CompletedTask;
|
22
|
+
}
|
23
|
+
|
24
|
+
public Task CreatePullRequest(CreatePullRequest createPullRequest)
|
25
|
+
{
|
26
|
+
_receivedMessages.Add((typeof(CreatePullRequest), createPullRequest));
|
27
|
+
return Task.CompletedTask;
|
28
|
+
}
|
29
|
+
|
30
|
+
public Task MarkAsProcessed(MarkAsProcessed markAsProcessed)
|
31
|
+
{
|
32
|
+
_receivedMessages.Add((typeof(MarkAsProcessed), markAsProcessed));
|
33
|
+
return Task.CompletedTask;
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
using System.Text.Json;
|
2
|
+
|
3
|
+
using NuGetUpdater.Core.Discover;
|
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 UpdatedDependencyListTests
|
12
|
+
{
|
13
|
+
[Fact]
|
14
|
+
public void GetUpdatedDependencyListFromDiscovery()
|
15
|
+
{
|
16
|
+
var discovery = new WorkspaceDiscoveryResult()
|
17
|
+
{
|
18
|
+
Path = "src",
|
19
|
+
IsSuccess = true,
|
20
|
+
Projects = [
|
21
|
+
new()
|
22
|
+
{
|
23
|
+
FilePath = "project.csproj",
|
24
|
+
Dependencies = [
|
25
|
+
new("Microsoft.Extensions.DependencyModel", "6.0.0", DependencyType.PackageReference, TargetFrameworks: ["net6.0"]),
|
26
|
+
new("System.Text.Json", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["net6.0"], IsTransitive: true),
|
27
|
+
],
|
28
|
+
IsSuccess = true,
|
29
|
+
Properties = [],
|
30
|
+
TargetFrameworks = ["net8.0"],
|
31
|
+
ReferencedProjectPaths = [],
|
32
|
+
}
|
33
|
+
]
|
34
|
+
};
|
35
|
+
var updatedDependencyList = RunWorker.GetUpdatedDependencyListFromDiscovery(discovery);
|
36
|
+
var expectedDependencyList = new UpdatedDependencyList()
|
37
|
+
{
|
38
|
+
Dependencies =
|
39
|
+
[
|
40
|
+
new ReportedDependency()
|
41
|
+
{
|
42
|
+
Name = "Microsoft.Extensions.DependencyModel",
|
43
|
+
Version = "6.0.0",
|
44
|
+
Requirements =
|
45
|
+
[
|
46
|
+
new ReportedRequirement()
|
47
|
+
{
|
48
|
+
Requirement = "6.0.0",
|
49
|
+
File = "/src/project.csproj",
|
50
|
+
Groups = ["dependencies"],
|
51
|
+
}
|
52
|
+
]
|
53
|
+
},
|
54
|
+
new ReportedDependency()
|
55
|
+
{
|
56
|
+
Name = "System.Text.Json",
|
57
|
+
Version = "6.0.0",
|
58
|
+
Requirements = [],
|
59
|
+
}
|
60
|
+
],
|
61
|
+
DependencyFiles = ["/src/project.csproj"],
|
62
|
+
};
|
63
|
+
|
64
|
+
// doing JSON comparison makes this easier; we don't have to define custom record equality and we get an easy diff
|
65
|
+
var actualJson = JsonSerializer.Serialize(updatedDependencyList);
|
66
|
+
var expectedJson = JsonSerializer.Serialize(expectedDependencyList);
|
67
|
+
Assert.Equal(expectedJson, actualJson);
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
using Xunit;
|
2
|
+
|
3
|
+
namespace NuGetUpdater.Core.Test.Utilities;
|
4
|
+
|
5
|
+
public class PathHelperTests
|
6
|
+
{
|
7
|
+
[Theory]
|
8
|
+
[InlineData("a/b/c", "a/b/c")]
|
9
|
+
[InlineData("a/b/../c", "a/c")]
|
10
|
+
[InlineData("a/..//c", "c")]
|
11
|
+
[InlineData("/a/b/c", "/a/b/c")]
|
12
|
+
[InlineData("/a/b/../c", "/a/c")]
|
13
|
+
[InlineData("/a/..//c", "/c")]
|
14
|
+
[InlineData("a/b/./c", "a/b/c")]
|
15
|
+
[InlineData("a/../../b", "b")]
|
16
|
+
[InlineData("../../../a/b", "a/b")]
|
17
|
+
public void VerifyNormalizeUnixPathParts(string input, string expected)
|
18
|
+
{
|
19
|
+
var actual = input.NormalizeUnixPathParts();
|
20
|
+
Assert.Equal(expected, actual);
|
21
|
+
}
|
22
|
+
}
|
@@ -52,6 +52,7 @@ module Dependabot
|
|
52
52
|
@nuget_config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
53
53
|
@packages_config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
54
54
|
@assembly_binding_redirect_config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
55
|
+
@packages_lock_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
55
56
|
end
|
56
57
|
|
57
58
|
sig { override.returns(T::Array[DependencyFile]) }
|
@@ -63,6 +64,7 @@ module Dependabot
|
|
63
64
|
*packages_config_files,
|
64
65
|
*assembly_binding_redirect_config_files,
|
65
66
|
*nuget_config_files,
|
67
|
+
*packages_lock_files,
|
66
68
|
global_json,
|
67
69
|
dotnet_tools_json,
|
68
70
|
packages_props
|
@@ -266,6 +268,21 @@ module Dependabot
|
|
266
268
|
@nuget_config_files
|
267
269
|
end
|
268
270
|
|
271
|
+
sig { returns(T::Array[Dependabot::DependencyFile]) }
|
272
|
+
def packages_lock_files
|
273
|
+
return @packages_lock_files if @packages_lock_files
|
274
|
+
|
275
|
+
candidate_paths =
|
276
|
+
[*project_files.map { |f| File.dirname(f.name) }, "."].uniq
|
277
|
+
|
278
|
+
@packages_lock_files =
|
279
|
+
candidate_paths.filter_map do |dir|
|
280
|
+
file = repo_contents(dir: dir)
|
281
|
+
.find { |f| f.name.casecmp("packages.lock.json").zero? }
|
282
|
+
fetch_file_from_host(File.join(dir, file.name)) if file
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
269
286
|
sig do
|
270
287
|
params(
|
271
288
|
project_file: Dependabot::DependencyFile,
|
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.
|
4
|
+
version: 0.278.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-09-
|
11
|
+
date: 2024-09-26 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.
|
19
|
+
version: 0.278.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.
|
26
|
+
version: 0.278.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,11 +293,13 @@ files:
|
|
293
293
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs
|
294
294
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs
|
295
295
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs
|
296
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs
|
296
297
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs
|
297
298
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj
|
298
299
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs
|
299
300
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs
|
300
301
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs
|
302
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs
|
301
303
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs
|
302
304
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj
|
303
305
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs
|
@@ -325,6 +327,10 @@ files:
|
|
325
327
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs
|
326
328
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs
|
327
329
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj
|
330
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs
|
331
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs
|
332
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/TestApiHandler.cs
|
333
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs
|
328
334
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs
|
329
335
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryEnvironment.cs
|
330
336
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestBase.cs
|
@@ -342,6 +348,7 @@ files:
|
|
342
348
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/DiffUtil.cs
|
343
349
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs
|
344
350
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs
|
351
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs
|
345
352
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs
|
346
353
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalysisResult.cs
|
347
354
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs
|
@@ -388,11 +395,28 @@ files:
|
|
388
395
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/NativeResult.cs
|
389
396
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj
|
390
397
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Property.cs
|
398
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs
|
399
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs
|
400
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFile.cs
|
401
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs
|
402
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs
|
403
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobFile.cs
|
404
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobSource.cs
|
405
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MarkAsProcessed.cs
|
406
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedDependency.cs
|
407
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedRequirement.cs
|
408
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementSource.cs
|
409
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatedDependencyList.cs
|
410
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs
|
411
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs
|
412
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs
|
413
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs
|
391
414
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
|
392
415
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs
|
393
416
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/ConfigurationFile.cs
|
394
417
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs
|
395
418
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs
|
419
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs
|
396
420
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs
|
397
421
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs
|
398
422
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationResult.cs
|
@@ -463,7 +487,7 @@ licenses:
|
|
463
487
|
- MIT
|
464
488
|
metadata:
|
465
489
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
466
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
490
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.278.0
|
467
491
|
post_install_message:
|
468
492
|
rdoc_options: []
|
469
493
|
require_paths:
|