dependabot-nuget 0.286.0 → 0.287.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -213,6 +213,256 @@ public class RunWorkerTests
213
213
  );
214
214
  }
215
215
 
216
+ [Fact]
217
+ public async Task UpdateHandlesSemicolonsInPackageReference()
218
+ {
219
+ var repoMetadata = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package" />""");
220
+ var repoMetadata2 = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some-package2" />""");
221
+ await RunAsync(
222
+ packages:
223
+ [
224
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0", additionalMetadata: [repoMetadata]),
225
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.1", "net8.0", additionalMetadata: [repoMetadata]),
226
+ MockNuGetPackage.CreateSimplePackage("Some.Package2", "1.0.0", "net8.0", additionalMetadata: [repoMetadata2]),
227
+ MockNuGetPackage.CreateSimplePackage("Some.Package2", "1.0.1", "net8.0", additionalMetadata: [repoMetadata2]),
228
+ ],
229
+ job: new Job()
230
+ {
231
+ PackageManager = "nuget",
232
+ Source = new()
233
+ {
234
+ Provider = "github",
235
+ Repo = "test/repo",
236
+ Directory = "some-dir",
237
+ },
238
+ AllowedUpdates =
239
+ [
240
+ new() { UpdateType = "all" }
241
+ ]
242
+ },
243
+ files:
244
+ [
245
+ ("some-dir/project.csproj", """
246
+ <Project Sdk="Microsoft.NET.Sdk">
247
+ <PropertyGroup>
248
+ <TargetFramework>net8.0</TargetFramework>
249
+ </PropertyGroup>
250
+ <ItemGroup>
251
+ <PackageReference Include="Some.Package;Some.Package2" Version="1.0.0" />
252
+ </ItemGroup>
253
+ </Project>
254
+ """)
255
+ ],
256
+ discoveryWorker: new TestDiscoveryWorker(_input =>
257
+ {
258
+ return Task.FromResult(new WorkspaceDiscoveryResult()
259
+ {
260
+ Path = "some-dir",
261
+ Projects =
262
+ [
263
+ new()
264
+ {
265
+ FilePath = "project.csproj",
266
+ TargetFrameworks = ["net8.0"],
267
+ Dependencies =
268
+ [
269
+ new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
270
+ new("Some.Package2", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
271
+ ]
272
+ }
273
+ ]
274
+ });
275
+ }),
276
+ analyzeWorker: new TestAnalyzeWorker(input =>
277
+ {
278
+ return Task.FromResult(new AnalysisResult()
279
+ {
280
+ UpdatedVersion = "1.0.1",
281
+ CanUpdate = true,
282
+ UpdatedDependencies =
283
+ [
284
+ new("Some.Package", "1.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package"),
285
+ new("Some.Package2", "1.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package2"),
286
+ ]
287
+ });
288
+ }),
289
+ updaterWorker: new TestUpdaterWorker(async input =>
290
+ {
291
+ Assert.Contains(input.Item3, ["Some.Package", "Some.Package2"]);
292
+ Assert.Equal("1.0.0", input.Item4);
293
+ Assert.Equal("1.0.1", input.Item5);
294
+ var projectPath = input.Item1 + input.Item2;
295
+ await File.WriteAllTextAsync(projectPath, """
296
+ <Project Sdk="Microsoft.NET.Sdk">
297
+ <PropertyGroup>
298
+ <TargetFramework>net8.0</TargetFramework>
299
+ </PropertyGroup>
300
+ <ItemGroup>
301
+ <PackageReference Include="Some.Package;Some.Package2" Version="1.0.1" />
302
+ </ItemGroup>
303
+ </Project>
304
+ """);
305
+ return new UpdateOperationResult();
306
+ }),
307
+ expectedResult: new RunResult()
308
+ {
309
+ Base64DependencyFiles =
310
+ [
311
+ new DependencyFile()
312
+ {
313
+ Directory = "/some-dir",
314
+ Name = "project.csproj",
315
+ Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
316
+ <Project Sdk="Microsoft.NET.Sdk">
317
+ <PropertyGroup>
318
+ <TargetFramework>net8.0</TargetFramework>
319
+ </PropertyGroup>
320
+ <ItemGroup>
321
+ <PackageReference Include="Some.Package;Some.Package2" Version="1.0.0" />
322
+ </ItemGroup>
323
+ </Project>
324
+ """))
325
+ }
326
+ ],
327
+ BaseCommitSha = "TEST-COMMIT-SHA",
328
+ },
329
+ expectedApiMessages:
330
+ [
331
+ new UpdatedDependencyList()
332
+ {
333
+ Dependencies =
334
+ [
335
+ new ReportedDependency()
336
+ {
337
+ Name = "Some.Package",
338
+ Version = "1.0.0",
339
+ Requirements =
340
+ [
341
+ new ReportedRequirement()
342
+ {
343
+ Requirement = "1.0.0",
344
+ File = "/some-dir/project.csproj",
345
+ Groups = ["dependencies"],
346
+ }
347
+ ]
348
+ },
349
+ new ReportedDependency()
350
+ {
351
+ Name = "Some.Package2",
352
+ Version = "1.0.0",
353
+ Requirements =
354
+ [
355
+ new ReportedRequirement()
356
+ {
357
+ Requirement = "1.0.0",
358
+ File = "/some-dir/project.csproj",
359
+ Groups = ["dependencies"],
360
+ }
361
+ ]
362
+ },
363
+ ],
364
+ DependencyFiles = ["/some-dir/project.csproj"],
365
+ },
366
+ new IncrementMetric()
367
+ {
368
+ Metric = "updater.started",
369
+ Tags = new()
370
+ {
371
+ ["operation"] = "group_update_all_versions"
372
+ }
373
+ },
374
+ new CreatePullRequest()
375
+ {
376
+ Dependencies =
377
+ [
378
+ new ReportedDependency()
379
+ {
380
+ Name = "Some.Package",
381
+ Version = "1.0.1",
382
+ Requirements =
383
+ [
384
+ new ReportedRequirement()
385
+ {
386
+ Requirement = "1.0.1",
387
+ File = "/some-dir/project.csproj",
388
+ Groups = ["dependencies"],
389
+ Source = new()
390
+ {
391
+ SourceUrl = "https://nuget.example.com/some-package",
392
+ Type = "nuget_repo",
393
+ }
394
+ }
395
+ ],
396
+ PreviousVersion = "1.0.0",
397
+ PreviousRequirements =
398
+ [
399
+ new ReportedRequirement()
400
+ {
401
+ Requirement = "1.0.0",
402
+ File = "/some-dir/project.csproj",
403
+ Groups = ["dependencies"],
404
+ }
405
+ ],
406
+ },
407
+ new ReportedDependency()
408
+ {
409
+ Name = "Some.Package2",
410
+ Version = "1.0.1",
411
+ Requirements =
412
+ [
413
+ new ReportedRequirement()
414
+ {
415
+ Requirement = "1.0.1",
416
+ File = "/some-dir/project.csproj",
417
+ Groups = ["dependencies"],
418
+ Source = new()
419
+ {
420
+ SourceUrl = "https://nuget.example.com/some-package2",
421
+ Type = "nuget_repo",
422
+ }
423
+ }
424
+ ],
425
+ PreviousVersion = "1.0.0",
426
+ PreviousRequirements =
427
+ [
428
+ new ReportedRequirement()
429
+ {
430
+ Requirement = "1.0.0",
431
+ File = "/some-dir/project.csproj",
432
+ Groups = ["dependencies"],
433
+ }
434
+ ],
435
+ },
436
+ ],
437
+ UpdatedDependencyFiles =
438
+ [
439
+ new DependencyFile()
440
+ {
441
+ Name = "project.csproj",
442
+ Directory = "/some-dir",
443
+ Content = """
444
+ <Project Sdk="Microsoft.NET.Sdk">
445
+ <PropertyGroup>
446
+ <TargetFramework>net8.0</TargetFramework>
447
+ </PropertyGroup>
448
+ <ItemGroup>
449
+ <PackageReference Include="Some.Package;Some.Package2" Version="1.0.1" />
450
+ </ItemGroup>
451
+ </Project>
452
+ """,
453
+ }
454
+
455
+ ],
456
+ BaseCommitSha = "TEST-COMMIT-SHA",
457
+ CommitMessage = "TODO: message",
458
+ PrTitle = "TODO: title",
459
+ PrBody = "TODO: body",
460
+ },
461
+ new MarkAsProcessed("TEST-COMMIT-SHA")
462
+ ]
463
+ );
464
+ }
465
+
216
466
  [Fact]
217
467
  public async Task PrivateSourceAuthenticationFailureIsForwaredToApiHandler()
218
468
  {
@@ -311,7 +311,7 @@ public partial class UpdateWorkerTests
311
311
  MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
312
312
  MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
313
313
  // necessary for the `net8.0-windows10.0.19041.0` TFM
314
- new("Microsoft.Windows.SDK.NET.Ref", "10.0.19041.34", Files:
314
+ new("Microsoft.Windows.SDK.NET.Ref", "10.0.19041.54", Files:
315
315
  [
316
316
  ("data/FrameworkList.xml", Encoding.UTF8.GetBytes("""
317
317
  <FileList Name="Windows SDK .NET 6.0">
@@ -889,6 +889,45 @@ public partial class UpdateWorkerTests
889
889
  );
890
890
  }
891
891
 
892
+ [Fact]
893
+ public async Task UpdateVersionAttribute_InProjectFile_ForPackageReferenceUpdateWithSemicolon()
894
+ {
895
+ // update Some.Package from 9.0.1 to 13.0.1
896
+ await TestUpdateForProject("Some.Package", "9.0.1", "13.0.1",
897
+ packages:
898
+ [
899
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
900
+ MockNuGetPackage.CreateSimplePackage("Some.Package2", "9.0.1", "net8.0"),
901
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
902
+ MockNuGetPackage.CreateSimplePackage("Some.Package2", "13.0.1", "net8.0"),
903
+ ],
904
+ // initial
905
+ projectContents: """
906
+ <Project Sdk="Microsoft.NET.Sdk">
907
+ <PropertyGroup>
908
+ <TargetFramework>net8.0</TargetFramework>
909
+ </PropertyGroup>
910
+
911
+ <ItemGroup>
912
+ <PackageReference Include="Some.Package;Some.Package2" Version="9.0.1" />
913
+ </ItemGroup>
914
+ </Project>
915
+ """,
916
+ // expected
917
+ expectedProjectContents: """
918
+ <Project Sdk="Microsoft.NET.Sdk">
919
+ <PropertyGroup>
920
+ <TargetFramework>net8.0</TargetFramework>
921
+ </PropertyGroup>
922
+
923
+ <ItemGroup>
924
+ <PackageReference Include="Some.Package;Some.Package2" Version="13.0.1" />
925
+ </ItemGroup>
926
+ </Project>
927
+ """
928
+ );
929
+ }
930
+
892
931
  [Fact]
893
932
  public async Task UpdateVersionAttribute_InDirectoryPackages_ForPackageVersion()
894
933
  {
@@ -19,4 +19,18 @@ public class PathHelperTests
19
19
  var actual = input.NormalizeUnixPathParts();
20
20
  Assert.Equal(expected, actual);
21
21
  }
22
+
23
+ [Fact]
24
+ public void VerifyResolveCaseInsensitivePath()
25
+ {
26
+ var temp = new TemporaryDirectory();
27
+ Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "a"));
28
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "a", "packages.config"), "");
29
+
30
+ var repoRootPath = Path.Combine(temp.DirectoryPath, "src");
31
+
32
+ var resolvedPath = PathHelper.ResolveCaseInsensitivePathInsideRepoRoot(Path.Combine(repoRootPath, "A", "PACKAGES.CONFIG"), repoRootPath);
33
+
34
+ Assert.Equal(Path.Combine(temp.DirectoryPath, "src", "a", "packages.config"), resolvedPath);
35
+ }
22
36
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "sdk": {
3
- "version": "9.0.100-rc.1.24452.12",
3
+ "version": "9.0.100",
4
4
  "rollForward": "latestMinor"
5
5
  }
6
6
  }
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.286.0
4
+ version: 0.287.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-11-14 00:00:00.000000000 Z
11
+ date: 2024-11-19 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.286.0
19
+ version: 0.287.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.286.0
26
+ version: 0.287.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -511,7 +511,7 @@ licenses:
511
511
  - MIT
512
512
  metadata:
513
513
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
514
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.286.0
514
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.287.0
515
515
  post_install_message:
516
516
  rdoc_options: []
517
517
  require_paths: