dependabot-nuget 0.245.0 → 0.246.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.Core/Updater/PackagesConfigUpdater.cs +42 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +164 -90
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +38 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +57 -17
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +115 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/{UpdateWorker.DirsProj.cs → UpdateWorkerTests.DirsProj.cs} +22 -24
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +66 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +355 -83
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +7 -4
- data/lib/dependabot/nuget/file_parser/project_file_parser.rb +0 -4
- data/lib/dependabot/nuget/file_parser.rb +15 -1
- data/lib/dependabot/nuget/http_response_helpers.rb +14 -0
- data/lib/dependabot/nuget/metadata_finder.rb +6 -2
- data/lib/dependabot/nuget/nuget_client.rb +8 -13
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +23 -13
- data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +75 -11
- data/lib/dependabot/nuget/update_checker/repository_finder.rb +4 -10
- data/lib/dependabot/nuget/update_checker.rb +2 -3
- metadata +7 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterTests.cs +0 -317
@@ -1,317 +0,0 @@
|
|
1
|
-
using System.Collections.Generic;
|
2
|
-
using System.IO;
|
3
|
-
using System.Linq;
|
4
|
-
using System.Threading.Tasks;
|
5
|
-
|
6
|
-
using Xunit;
|
7
|
-
|
8
|
-
namespace NuGetUpdater.Core.Test.Utilities;
|
9
|
-
|
10
|
-
public class SdkPackageUpdaterTests
|
11
|
-
{
|
12
|
-
[Theory]
|
13
|
-
[MemberData(nameof(GetDependencyUpdates))]
|
14
|
-
public async Task UpdateDependency_UpdatesDependencies((string Path, string Contents)[] startingContents, (string Path, string Contents)[] expectedContents,
|
15
|
-
string dependencyName, string previousVersion, string newDependencyVersion, bool isTransitive)
|
16
|
-
{
|
17
|
-
// Arrange
|
18
|
-
using var directory = TemporaryDirectory.CreateWithContents(startingContents);
|
19
|
-
var projectPath = Path.Combine(directory.DirectoryPath, startingContents.First().Path);
|
20
|
-
var logger = new Logger(verbose: false);
|
21
|
-
|
22
|
-
// Act
|
23
|
-
await SdkPackageUpdater.UpdateDependencyAsync(directory.DirectoryPath, projectPath, dependencyName, previousVersion, newDependencyVersion, isTransitive, logger);
|
24
|
-
|
25
|
-
// Assert
|
26
|
-
AssertContentsEqual(expectedContents, directory);
|
27
|
-
}
|
28
|
-
|
29
|
-
public static IEnumerable<object[]> GetDependencyUpdates()
|
30
|
-
{
|
31
|
-
// Simple case
|
32
|
-
yield return new object[]
|
33
|
-
{
|
34
|
-
new[]
|
35
|
-
{
|
36
|
-
(Path: "src/Project.csproj", Content: """
|
37
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
38
|
-
<PropertyGroup>
|
39
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
40
|
-
</PropertyGroup>
|
41
|
-
<ItemGroup>
|
42
|
-
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
43
|
-
</ItemGroup>
|
44
|
-
</Project>
|
45
|
-
""")
|
46
|
-
}, // starting contents
|
47
|
-
new[]
|
48
|
-
{
|
49
|
-
(Path: "src/Project.csproj", Content: """
|
50
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
51
|
-
<PropertyGroup>
|
52
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
53
|
-
</PropertyGroup>
|
54
|
-
<ItemGroup>
|
55
|
-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
56
|
-
</ItemGroup>
|
57
|
-
</Project>
|
58
|
-
""")
|
59
|
-
}, // expected contents
|
60
|
-
"Newtonsoft.Json", "12.0.1", "13.0.1", false // isTransitive
|
61
|
-
};
|
62
|
-
|
63
|
-
// Dependency package has version constraint
|
64
|
-
yield return
|
65
|
-
[
|
66
|
-
new[]
|
67
|
-
{
|
68
|
-
(Path: "src/Project/Project.csproj", Content: """
|
69
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
70
|
-
<PropertyGroup>
|
71
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
72
|
-
</PropertyGroup>
|
73
|
-
<ItemGroup>
|
74
|
-
<PackageReference Include="AWSSDK.S3" Version="3.3.17.3" />
|
75
|
-
<PackageReference Include="AWSSDK.Core" Version="3.3.21.19" />
|
76
|
-
</ItemGroup>
|
77
|
-
</Project>
|
78
|
-
"""),
|
79
|
-
}, // starting contents
|
80
|
-
new[]
|
81
|
-
{
|
82
|
-
// If a dependency has a version constraint outside of our new-version, we don't update anything
|
83
|
-
(Path: "src/Project/Project.csproj", Content: """
|
84
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
85
|
-
<PropertyGroup>
|
86
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
87
|
-
</PropertyGroup>
|
88
|
-
<ItemGroup>
|
89
|
-
<PackageReference Include="AWSSDK.S3" Version="3.3.17.3" />
|
90
|
-
<PackageReference Include="AWSSDK.Core" Version="3.3.21.19" />
|
91
|
-
</ItemGroup>
|
92
|
-
</Project>
|
93
|
-
"""),
|
94
|
-
}, // expected contents
|
95
|
-
"AWSSDK.Core",
|
96
|
-
"3.3.21.19",
|
97
|
-
"3.7.300.20",
|
98
|
-
false // isTransitive
|
99
|
-
];
|
100
|
-
|
101
|
-
// Dependency project has version constraint
|
102
|
-
yield return
|
103
|
-
[
|
104
|
-
new[]
|
105
|
-
{
|
106
|
-
(Path: "src/Project2/Project2.csproj", Content: """
|
107
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
108
|
-
<PropertyGroup>
|
109
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
110
|
-
</PropertyGroup>
|
111
|
-
<ItemGroup>
|
112
|
-
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
113
|
-
<ProjectReference Include="../Project/Project.csproj" />
|
114
|
-
</ItemGroup>
|
115
|
-
</Project>
|
116
|
-
"""),
|
117
|
-
(Path: "src/Project/Project.csproj", Content: """
|
118
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
119
|
-
<PropertyGroup>
|
120
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
121
|
-
</PropertyGroup>
|
122
|
-
<ItemGroup>
|
123
|
-
<PackageReference Include="Newtonsoft.Json" Version="[12.0.1, 13.0.0)" />
|
124
|
-
</ItemGroup>
|
125
|
-
</Project>
|
126
|
-
"""),
|
127
|
-
}, // starting contents
|
128
|
-
new[]
|
129
|
-
{
|
130
|
-
(Path: "src/Project2/Project2.csproj", Content: """
|
131
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
132
|
-
<PropertyGroup>
|
133
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
134
|
-
</PropertyGroup>
|
135
|
-
<ItemGroup>
|
136
|
-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
137
|
-
<ProjectReference Include="../Project/Project.csproj" />
|
138
|
-
</ItemGroup>
|
139
|
-
</Project>
|
140
|
-
"""), // starting contents
|
141
|
-
(Path: "src/Project/Project.csproj", Content: """
|
142
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
143
|
-
<PropertyGroup>
|
144
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
145
|
-
</PropertyGroup>
|
146
|
-
<ItemGroup>
|
147
|
-
<PackageReference Include="Newtonsoft.Json" Version="[12.0.1, 13.0.0)" />
|
148
|
-
</ItemGroup>
|
149
|
-
</Project>
|
150
|
-
"""),
|
151
|
-
}, // expected contents
|
152
|
-
"Newtonsoft.Json",
|
153
|
-
"12.0.1",
|
154
|
-
"13.0.1",
|
155
|
-
false // isTransitive
|
156
|
-
];
|
157
|
-
|
158
|
-
// Multiple references
|
159
|
-
yield return
|
160
|
-
[
|
161
|
-
new[]
|
162
|
-
{
|
163
|
-
(Path: "src/Project.csproj", Content: """
|
164
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
165
|
-
<PropertyGroup>
|
166
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
167
|
-
</PropertyGroup>
|
168
|
-
<ItemGroup>
|
169
|
-
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
170
|
-
<PackageReference Include="Newtonsoft.Json">
|
171
|
-
<Version>12.0.1</Version>
|
172
|
-
</PackageReference>
|
173
|
-
</ItemGroup>
|
174
|
-
</Project>
|
175
|
-
""")
|
176
|
-
}, // starting contents
|
177
|
-
new[]
|
178
|
-
{
|
179
|
-
(Path: "src/Project.csproj", Content: """
|
180
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
181
|
-
<PropertyGroup>
|
182
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
183
|
-
</PropertyGroup>
|
184
|
-
<ItemGroup>
|
185
|
-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
186
|
-
<PackageReference Include="Newtonsoft.Json">
|
187
|
-
<Version>13.0.1</Version>
|
188
|
-
</PackageReference>
|
189
|
-
</ItemGroup>
|
190
|
-
</Project>
|
191
|
-
""")
|
192
|
-
}, // expected contents
|
193
|
-
"Newtonsoft.Json",
|
194
|
-
"12.0.1",
|
195
|
-
"13.0.1",
|
196
|
-
false // isTransitive
|
197
|
-
];
|
198
|
-
|
199
|
-
// Make sure we don't update if there are incoherent versions
|
200
|
-
yield return
|
201
|
-
[
|
202
|
-
new[]
|
203
|
-
{
|
204
|
-
(Path: "src/Project.csproj", Content: """
|
205
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
206
|
-
<PropertyGroup>
|
207
|
-
<TargetFramework>netcoreapp2.1</TargetFramework>
|
208
|
-
</PropertyGroup>
|
209
|
-
<ItemGroup>
|
210
|
-
<PackageReference Include="Microsoft.Extensions.Primitives" Version="2.2.0" />
|
211
|
-
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
|
212
|
-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
|
213
|
-
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
214
|
-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
|
215
|
-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
|
216
|
-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.0" />
|
217
|
-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
|
218
|
-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
|
219
|
-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
|
220
|
-
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.2.0" />
|
221
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0" />
|
222
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="2.2.0" />
|
223
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="2.2.0" />
|
224
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
|
225
|
-
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
|
226
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.0" />
|
227
|
-
</ItemGroup>
|
228
|
-
</Project>
|
229
|
-
""")
|
230
|
-
}, // starting contents
|
231
|
-
new[]
|
232
|
-
{
|
233
|
-
(Path: "src/Project.csproj", Content: """
|
234
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
235
|
-
<PropertyGroup>
|
236
|
-
<TargetFramework>netcoreapp2.1</TargetFramework>
|
237
|
-
</PropertyGroup>
|
238
|
-
<ItemGroup>
|
239
|
-
<PackageReference Include="Microsoft.Extensions.Primitives" Version="2.2.0" />
|
240
|
-
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
|
241
|
-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
|
242
|
-
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
243
|
-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
|
244
|
-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
|
245
|
-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.0" />
|
246
|
-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
|
247
|
-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
|
248
|
-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
|
249
|
-
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.2.0" />
|
250
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.0" />
|
251
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="2.2.0" />
|
252
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="2.2.0" />
|
253
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
|
254
|
-
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
|
255
|
-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.0" />
|
256
|
-
</ItemGroup>
|
257
|
-
</Project>
|
258
|
-
""")
|
259
|
-
}, // expected contents
|
260
|
-
"Microsoft.EntityFrameworkCore.SqlServer",
|
261
|
-
"2.1.0",
|
262
|
-
"2.2.0",
|
263
|
-
false // isTransitive
|
264
|
-
];
|
265
|
-
|
266
|
-
// PackageReference with Version as child element
|
267
|
-
yield return
|
268
|
-
[
|
269
|
-
new[]
|
270
|
-
{
|
271
|
-
(Path: "src/Project.csproj", Content: """
|
272
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
273
|
-
<PropertyGroup>
|
274
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
275
|
-
</PropertyGroup>
|
276
|
-
<ItemGroup>
|
277
|
-
<PackageReference Include="Newtonsoft.Json">
|
278
|
-
<Version>12.0.1</Version>
|
279
|
-
</PackageReference>
|
280
|
-
</ItemGroup>
|
281
|
-
</Project>
|
282
|
-
""")
|
283
|
-
}, // starting contents
|
284
|
-
new[]
|
285
|
-
{
|
286
|
-
(Path: "src/Project.csproj", Content: """
|
287
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
288
|
-
<PropertyGroup>
|
289
|
-
<TargetFramework>netstandard2.0</TargetFramework>
|
290
|
-
</PropertyGroup>
|
291
|
-
<ItemGroup>
|
292
|
-
<PackageReference Include="Newtonsoft.Json">
|
293
|
-
<Version>13.0.1</Version>
|
294
|
-
</PackageReference>
|
295
|
-
</ItemGroup>
|
296
|
-
</Project>
|
297
|
-
""")
|
298
|
-
}, // expected contents
|
299
|
-
"Newtonsoft.Json",
|
300
|
-
"12.0.1",
|
301
|
-
"13.0.1",
|
302
|
-
false // isTransitive
|
303
|
-
];
|
304
|
-
}
|
305
|
-
|
306
|
-
private static void AssertContentsEqual((string Path, string Contents)[] expectedContents, TemporaryDirectory directory)
|
307
|
-
{
|
308
|
-
var actualFiles = Directory.GetFiles(directory.DirectoryPath, "*", SearchOption.AllDirectories);
|
309
|
-
Assert.Equal(expectedContents.Length, actualFiles.Length);
|
310
|
-
foreach (var (path, contents) in expectedContents)
|
311
|
-
{
|
312
|
-
var fullPath = Path.Combine(directory.DirectoryPath, path);
|
313
|
-
Assert.True(File.Exists(fullPath));
|
314
|
-
Assert.Equal(contents, File.ReadAllText(fullPath));
|
315
|
-
}
|
316
|
-
}
|
317
|
-
}
|