dependabot-nuget 0.242.0 → 0.243.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/.editorconfig +37 -28
- data/helpers/lib/NuGetUpdater/.gitignore +1 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/AssemblyMetadataExtractor.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +178 -176
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs +5 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +10 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +16 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +18 -17
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +7 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +13 -20
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +9 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +32 -16
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +42 -22
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +32 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs +47 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs +55 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +12 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +50 -42
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +16 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +6 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/ProjectBuildFileTests.cs +18 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/FrameworkCompatibilityServiceFacts.cs +7 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +9 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorker.DirsProj.cs +81 -80
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +22 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +140 -104
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +25 -25
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +8 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +198 -22
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +401 -399
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs +17 -15
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +111 -42
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterTests.cs +161 -82
- data/lib/dependabot/nuget/file_fetcher.rb +3 -23
- data/lib/dependabot/nuget/file_parser/project_file_parser.rb +47 -60
- data/lib/dependabot/nuget/file_parser.rb +24 -6
- data/lib/dependabot/nuget/file_updater.rb +42 -6
- data/lib/dependabot/nuget/native_helpers.rb +27 -8
- data/lib/dependabot/nuget/nuget_client.rb +130 -24
- data/lib/dependabot/nuget/nuget_config_credential_helpers.rb +7 -3
- data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +63 -59
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +2 -2
- data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +1 -1
- data/lib/dependabot/nuget/update_checker/nuspec_fetcher.rb +22 -17
- data/lib/dependabot/nuget/update_checker/repository_finder.rb +292 -270
- data/lib/dependabot/nuget/update_checker/tfm_comparer.rb +11 -13
- data/lib/dependabot/nuget/update_checker/tfm_finder.rb +80 -82
- data/lib/dependabot/nuget/update_checker/version_finder.rb +4 -7
- data/lib/dependabot/nuget/version.rb +18 -7
- data/lib/dependabot/nuget.rb +0 -2
- metadata +7 -5
@@ -41,11 +41,11 @@ public class FrameworkCompatibilityServiceFacts
|
|
41
41
|
public void UnknownSupportedPackageReturnsSetWithSameFramework()
|
42
42
|
{
|
43
43
|
var framework = NuGetFramework.Parse("net45-client");
|
44
|
-
var frameworks = new List<NuGetFramework>
|
44
|
+
var frameworks = new List<NuGetFramework> { framework };
|
45
45
|
var compatible = _service.GetCompatibleFrameworks(frameworks);
|
46
46
|
|
47
47
|
Assert.False(framework.IsUnsupported);
|
48
|
-
Assert.
|
48
|
+
Assert.Single(compatible);
|
49
49
|
Assert.Contains(framework, compatible);
|
50
50
|
}
|
51
51
|
|
@@ -57,10 +57,10 @@ public class FrameworkCompatibilityServiceFacts
|
|
57
57
|
{
|
58
58
|
var unsupportedFramework = NuGetFramework.Parse(unsupportedFrameworkName);
|
59
59
|
|
60
|
-
var result = _service.GetCompatibleFrameworks(
|
60
|
+
var result = _service.GetCompatibleFrameworks([unsupportedFramework]);
|
61
61
|
|
62
62
|
Assert.True(unsupportedFramework.IsUnsupported);
|
63
|
-
Assert.
|
63
|
+
Assert.Empty(result);
|
64
64
|
}
|
65
65
|
|
66
66
|
[Theory]
|
@@ -71,10 +71,10 @@ public class FrameworkCompatibilityServiceFacts
|
|
71
71
|
{
|
72
72
|
var portableFramework = NuGetFramework.Parse(pclFrameworkName);
|
73
73
|
|
74
|
-
var result = _service.GetCompatibleFrameworks(
|
74
|
+
var result = _service.GetCompatibleFrameworks([portableFramework]);
|
75
75
|
|
76
76
|
Assert.True(portableFramework.IsPCL);
|
77
|
-
Assert.
|
77
|
+
Assert.Empty(result);
|
78
78
|
}
|
79
79
|
|
80
80
|
[Theory]
|
@@ -113,7 +113,7 @@ public class FrameworkCompatibilityServiceFacts
|
|
113
113
|
projectFrameworks.Add(NuGetFramework.Parse(frameworkName));
|
114
114
|
}
|
115
115
|
|
116
|
-
var compatibleFrameworks = _service.GetCompatibleFrameworks(
|
116
|
+
var compatibleFrameworks = _service.GetCompatibleFrameworks([packageFramework]);
|
117
117
|
Assert.Equal(windowsProjectFrameworks.Length, compatibleFrameworks.Count);
|
118
118
|
|
119
119
|
var containsAllCompatibleFrameworks = compatibleFrameworks.All(cf => projectFrameworks.Contains(cf));
|
@@ -23,8 +23,8 @@ public class PackagesConfigUpdaterTests
|
|
23
23
|
public static IEnumerable<object[]> PackagesDirectoryPathTestData()
|
24
24
|
{
|
25
25
|
// project with namespace
|
26
|
-
yield return
|
27
|
-
|
26
|
+
yield return
|
27
|
+
[
|
28
28
|
"""
|
29
29
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
30
30
|
<ItemGroup>
|
@@ -38,11 +38,11 @@ public class PackagesConfigUpdaterTests
|
|
38
38
|
"Newtonsoft.Json",
|
39
39
|
"7.0.1",
|
40
40
|
@"..\packages"
|
41
|
-
|
41
|
+
];
|
42
42
|
|
43
43
|
// project without namespace
|
44
|
-
yield return
|
45
|
-
|
44
|
+
yield return
|
45
|
+
[
|
46
46
|
"""
|
47
47
|
<Project>
|
48
48
|
<ItemGroup>
|
@@ -56,11 +56,11 @@ public class PackagesConfigUpdaterTests
|
|
56
56
|
"Newtonsoft.Json",
|
57
57
|
"7.0.1",
|
58
58
|
@"..\packages"
|
59
|
-
|
59
|
+
];
|
60
60
|
|
61
61
|
// project with non-standard packages path
|
62
|
-
yield return
|
63
|
-
|
62
|
+
yield return
|
63
|
+
[
|
64
64
|
"""
|
65
65
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
66
66
|
<ItemGroup>
|
@@ -74,6 +74,6 @@ public class PackagesConfigUpdaterTests
|
|
74
74
|
"Newtonsoft.Json",
|
75
75
|
"7.0.1",
|
76
76
|
@"..\not-a-path-you-would-expect"
|
77
|
-
|
77
|
+
];
|
78
78
|
}
|
79
79
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
using System;
|
2
|
+
using System.Collections.Generic;
|
2
3
|
using System.IO;
|
3
4
|
using System.Linq;
|
4
5
|
using System.Threading.Tasks;
|
@@ -23,53 +24,53 @@ public partial class UpdateWorkerTests
|
|
23
24
|
// initial
|
24
25
|
projectContents: """
|
25
26
|
<Project Sdk="Microsoft.Build.NoTargets">
|
26
|
-
|
27
|
+
|
27
28
|
<ItemGroup>
|
28
29
|
<ProjectReference Include="src/test-project.csproj" />
|
29
30
|
</ItemGroup>
|
30
31
|
|
31
32
|
</Project>
|
32
33
|
""",
|
33
|
-
additionalFiles:
|
34
|
-
|
34
|
+
additionalFiles:
|
35
|
+
[
|
35
36
|
("src/test-project.csproj",
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
"""
|
38
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
39
|
+
<PropertyGroup>
|
40
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
41
|
+
</PropertyGroup>
|
42
|
+
|
43
|
+
<ItemGroup>
|
44
|
+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
|
45
|
+
</ItemGroup>
|
46
|
+
</Project>
|
47
|
+
""")
|
48
|
+
],
|
48
49
|
// expected
|
49
50
|
expectedProjectContents: """
|
50
51
|
<Project Sdk="Microsoft.Build.NoTargets">
|
51
|
-
|
52
|
+
|
52
53
|
<ItemGroup>
|
53
54
|
<ProjectReference Include="src/test-project.csproj" />
|
54
55
|
</ItemGroup>
|
55
56
|
|
56
57
|
</Project>
|
57
58
|
""",
|
58
|
-
additionalFilesExpected:
|
59
|
-
|
59
|
+
additionalFilesExpected:
|
60
|
+
[
|
60
61
|
("src/test-project.csproj",
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
62
|
+
"""
|
63
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
64
|
+
<PropertyGroup>
|
65
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
66
|
+
</PropertyGroup>
|
67
|
+
|
68
|
+
<ItemGroup>
|
69
|
+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
70
|
+
</ItemGroup>
|
71
|
+
</Project>
|
72
|
+
""")
|
73
|
+
]);
|
73
74
|
}
|
74
75
|
|
75
76
|
[Fact]
|
@@ -100,73 +101,73 @@ public partial class UpdateWorkerTests
|
|
100
101
|
// initial
|
101
102
|
projectContents: """
|
102
103
|
<Project Sdk="Microsoft.Build.NoTargets">
|
103
|
-
|
104
|
+
|
104
105
|
<ItemGroup>
|
105
106
|
<ProjectReference Include="src/dirs.proj" />
|
106
107
|
</ItemGroup>
|
107
108
|
|
108
109
|
</Project>
|
109
110
|
""",
|
110
|
-
additionalFiles:
|
111
|
-
|
111
|
+
additionalFiles:
|
112
|
+
[
|
112
113
|
("src/dirs.proj",
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
114
|
+
"""
|
115
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
116
|
+
|
117
|
+
<ItemGroup>
|
118
|
+
<ProjectReference Include="test-project/test-project.csproj" />
|
119
|
+
</ItemGroup>
|
120
|
+
|
121
|
+
</Project>
|
122
|
+
"""),
|
122
123
|
("src/test-project/test-project.csproj",
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
124
|
+
"""
|
125
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
126
|
+
<PropertyGroup>
|
127
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
128
|
+
</PropertyGroup>
|
129
|
+
|
130
|
+
<ItemGroup>
|
131
|
+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
|
132
|
+
</ItemGroup>
|
133
|
+
</Project>
|
134
|
+
""")
|
135
|
+
],
|
135
136
|
// expected
|
136
137
|
expectedProjectContents: """
|
137
138
|
<Project Sdk="Microsoft.Build.NoTargets">
|
138
|
-
|
139
|
+
|
139
140
|
<ItemGroup>
|
140
141
|
<ProjectReference Include="src/dirs.proj" />
|
141
142
|
</ItemGroup>
|
142
143
|
|
143
144
|
</Project>
|
144
145
|
""",
|
145
|
-
additionalFilesExpected:
|
146
|
-
|
146
|
+
additionalFilesExpected:
|
147
|
+
[
|
147
148
|
("src/dirs.proj",
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
149
|
+
"""
|
150
|
+
<Project Sdk="Microsoft.Build.NoTargets">
|
151
|
+
|
152
|
+
<ItemGroup>
|
153
|
+
<ProjectReference Include="test-project/test-project.csproj" />
|
154
|
+
</ItemGroup>
|
155
|
+
|
156
|
+
</Project>
|
157
|
+
"""),
|
157
158
|
("src/test-project/test-project.csproj",
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
159
|
+
"""
|
160
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
161
|
+
<PropertyGroup>
|
162
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
163
|
+
</PropertyGroup>
|
164
|
+
|
165
|
+
<ItemGroup>
|
166
|
+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
167
|
+
</ItemGroup>
|
168
|
+
</Project>
|
169
|
+
""")
|
170
|
+
]);
|
170
171
|
}
|
171
172
|
|
172
173
|
static async Task TestUpdateForDirsProj(
|
@@ -179,8 +180,8 @@ public partial class UpdateWorkerTests
|
|
179
180
|
(string Path, string Content)[]? additionalFiles = null,
|
180
181
|
(string Path, string Content)[]? additionalFilesExpected = null)
|
181
182
|
{
|
182
|
-
additionalFiles ??=
|
183
|
-
additionalFilesExpected ??=
|
183
|
+
additionalFiles ??= [];
|
184
|
+
additionalFilesExpected ??= [];
|
184
185
|
|
185
186
|
var projectName = "dirs";
|
186
187
|
var projectFileName = $"{projectName}.proj";
|
@@ -18,7 +18,15 @@ public abstract class UpdateWorkerTestBase
|
|
18
18
|
bool isTransitive = false,
|
19
19
|
(string Path, string Content)[]? additionalFiles = null,
|
20
20
|
string projectFilePath = "test-project.csproj")
|
21
|
-
=> TestUpdateForProject(
|
21
|
+
=> TestUpdateForProject(
|
22
|
+
dependencyName,
|
23
|
+
oldVersion,
|
24
|
+
newVersion,
|
25
|
+
(projectFilePath, projectContents),
|
26
|
+
expectedProjectContents: projectContents,
|
27
|
+
isTransitive,
|
28
|
+
additionalFiles,
|
29
|
+
additionalFilesExpected: additionalFiles);
|
22
30
|
|
23
31
|
protected static Task TestUpdateForProject(
|
24
32
|
string dependencyName,
|
@@ -30,10 +38,15 @@ public abstract class UpdateWorkerTestBase
|
|
30
38
|
(string Path, string Content)[]? additionalFiles = null,
|
31
39
|
(string Path, string Content)[]? additionalFilesExpected = null,
|
32
40
|
string projectFilePath = "test-project.csproj")
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
41
|
+
=> TestUpdateForProject(
|
42
|
+
dependencyName,
|
43
|
+
oldVersion,
|
44
|
+
newVersion,
|
45
|
+
(Path: projectFilePath, Content: projectContents),
|
46
|
+
expectedProjectContents,
|
47
|
+
isTransitive,
|
48
|
+
additionalFiles,
|
49
|
+
additionalFilesExpected);
|
37
50
|
|
38
51
|
protected static async Task TestUpdateForProject(
|
39
52
|
string dependencyName,
|
@@ -45,8 +58,8 @@ public abstract class UpdateWorkerTestBase
|
|
45
58
|
(string Path, string Content)[]? additionalFiles = null,
|
46
59
|
(string Path, string Content)[]? additionalFilesExpected = null)
|
47
60
|
{
|
48
|
-
additionalFiles ??=
|
49
|
-
additionalFilesExpected ??=
|
61
|
+
additionalFiles ??= [];
|
62
|
+
additionalFilesExpected ??= [];
|
50
63
|
|
51
64
|
var projectFilePath = projectFile.Path;
|
52
65
|
var projectName = Path.GetFileNameWithoutExtension(projectFilePath);
|
@@ -76,7 +89,7 @@ public abstract class UpdateWorkerTestBase
|
|
76
89
|
""";
|
77
90
|
var testFiles = new[] { (slnName, slnContent), projectFile }.Concat(additionalFiles).ToArray();
|
78
91
|
|
79
|
-
var actualResult = await RunUpdate(testFiles, async
|
92
|
+
var actualResult = await RunUpdate(testFiles, async temporaryDirectory =>
|
80
93
|
{
|
81
94
|
var slnPath = Path.Combine(temporaryDirectory, slnName);
|
82
95
|
var worker = new UpdaterWorker(new Logger(verbose: true));
|
@@ -94,7 +107,7 @@ public abstract class UpdateWorkerTestBase
|
|
94
107
|
using var tempDir = new TemporaryDirectory();
|
95
108
|
foreach (var file in files)
|
96
109
|
{
|
97
|
-
var localPath = file.Path.StartsWith(
|
110
|
+
var localPath = file.Path.StartsWith('/') ? file.Path[1..] : file.Path; // remove path rooting character
|
98
111
|
var filePath = Path.Combine(tempDir.DirectoryPath, localPath);
|
99
112
|
var directoryPath = Path.GetDirectoryName(filePath);
|
100
113
|
Directory.CreateDirectory(directoryPath!);
|