dependabot-nuget 0.288.0 → 0.290.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +19 -17
  3. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Packaging/NuGet.Packaging.csproj +0 -1
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +7 -3
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +1 -1
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +29 -2
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +25 -4
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +0 -6
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +33 -16
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +25 -10
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +0 -13
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementArrayConverter.cs +39 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +1 -1
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Clone/ShellGitCommandHandler.cs +1 -1
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +60 -66
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs +2 -2
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscovery.cs +2 -2
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +11 -3
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscoveryResult.cs +1 -0
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +2 -4
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +54 -11
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +0 -1
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +1 -2
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +1 -1
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +2 -2
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Advisory.cs +13 -0
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs +18 -1
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CommitOptions.cs +8 -0
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Condition.cs +19 -0
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs +8 -0
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs +9 -0
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +13 -10
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PullRequest.cs +11 -0
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementsUpdateStrategy.cs +15 -0
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +67 -58
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/VersionConverter.cs +19 -0
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +15 -44
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +4 -4
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +5 -5
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +2 -10
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +38 -33
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +25 -23
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +16 -12
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs +1 -1
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +19 -19
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs +11 -1
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +2 -0
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +18 -17
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -17
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +17 -9
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProjectHelper.cs +96 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +5 -2
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +87 -5
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +2 -5
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +45 -1
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +35 -1
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +16 -0
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +6 -0
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +143 -36
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +184 -48
  61. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +5 -5
  62. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +32 -10
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +85 -0
  64. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +402 -102
  65. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +342 -2
  66. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs +60 -2
  67. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +18 -7
  68. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestLogger.cs +1 -1
  69. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/BindingRedirectsTests.cs +1 -1
  70. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +24 -0
  71. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +4 -14
  72. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +84 -0
  73. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +66 -0
  74. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +95 -0
  75. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1 -7
  76. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/AssertEx.cs +1 -1
  77. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/LinuxOnlyAttribute.cs +12 -0
  78. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +558 -711
  79. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +47 -2
  80. data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +4 -2
  81. data/lib/dependabot/nuget/analysis/dependency_analysis.rb +3 -3
  82. data/lib/dependabot/nuget/discovery/dependency_details.rb +10 -3
  83. data/lib/dependabot/nuget/discovery/dependency_file_discovery.rb +8 -12
  84. data/lib/dependabot/nuget/discovery/discovery_json_reader.rb +214 -29
  85. data/lib/dependabot/nuget/discovery/project_discovery.rb +41 -8
  86. data/lib/dependabot/nuget/discovery/workspace_discovery.rb +14 -19
  87. data/lib/dependabot/nuget/file_fetcher.rb +11 -393
  88. data/lib/dependabot/nuget/file_parser.rb +23 -61
  89. data/lib/dependabot/nuget/file_updater.rb +28 -23
  90. data/lib/dependabot/nuget/native_helpers.rb +14 -5
  91. data/lib/dependabot/nuget/update_checker/requirements_updater.rb +23 -27
  92. data/lib/dependabot/nuget/update_checker.rb +116 -190
  93. metadata +20 -32
  94. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Packages.props +0 -29
  95. data/lib/dependabot/nuget/discovery/directory_packages_props_discovery.rb +0 -43
  96. data/lib/dependabot/nuget/file_fetcher/import_paths_finder.rb +0 -73
  97. data/lib/dependabot/nuget/file_fetcher/sln_project_paths_finder.rb +0 -60
  98. data/lib/dependabot/nuget/http_response_helpers.rb +0 -19
  99. data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +0 -102
  100. data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +0 -129
  101. data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +0 -171
  102. data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +0 -63
  103. data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +0 -82
  104. data/lib/dependabot/nuget/native_discovery/native_property_details.rb +0 -43
  105. data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +0 -68
  106. data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +0 -105
  107. data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +0 -201
  108. data/lib/dependabot/nuget/nuget_client.rb +0 -223
  109. data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +0 -116
  110. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +0 -297
  111. data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +0 -221
  112. data/lib/dependabot/nuget/update_checker/nuspec_fetcher.rb +0 -110
  113. data/lib/dependabot/nuget/update_checker/property_updater.rb +0 -196
  114. data/lib/dependabot/nuget/update_checker/repository_finder.rb +0 -466
  115. data/lib/dependabot/nuget/update_checker/tfm_comparer.rb +0 -34
  116. data/lib/dependabot/nuget/update_checker/tfm_finder.rb +0 -30
  117. data/lib/dependabot/nuget/update_checker/version_finder.rb +0 -449
@@ -30,11 +30,7 @@ public class RunWorkerTests
30
30
  Provider = "github",
31
31
  Repo = "test/repo",
32
32
  Directory = "some-dir",
33
- },
34
- AllowedUpdates =
35
- [
36
- new() { UpdateType = "all" }
37
- ]
33
+ }
38
34
  },
39
35
  files:
40
36
  [
@@ -63,7 +59,10 @@ public class RunWorkerTests
63
59
  Dependencies =
64
60
  [
65
61
  new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
66
- ]
62
+ ],
63
+ ReferencedProjectPaths = [],
64
+ ImportedFiles = [],
65
+ AdditionalFiles = [],
67
66
  }
68
67
  ]
69
68
  });
@@ -234,11 +233,7 @@ public class RunWorkerTests
234
233
  Provider = "github",
235
234
  Repo = "test/repo",
236
235
  Directory = "some-dir",
237
- },
238
- AllowedUpdates =
239
- [
240
- new() { UpdateType = "all" }
241
- ]
236
+ }
242
237
  },
243
238
  files:
244
239
  [
@@ -268,7 +263,10 @@ public class RunWorkerTests
268
263
  [
269
264
  new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
270
265
  new("Some.Package2", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
271
- ]
266
+ ],
267
+ ReferencedProjectPaths = [],
268
+ ImportedFiles = [],
269
+ AdditionalFiles = [],
272
270
  }
273
271
  ]
274
272
  });
@@ -288,7 +286,7 @@ public class RunWorkerTests
288
286
  }),
289
287
  updaterWorker: new TestUpdaterWorker(async input =>
290
288
  {
291
- Assert.Contains(input.Item3, ["Some.Package", "Some.Package2"]);
289
+ Assert.Contains(input.Item3, new List<string> { "Some.Package", "Some.Package2" });
292
290
  Assert.Equal("1.0.0", input.Item4);
293
291
  Assert.Equal("1.0.1", input.Item5);
294
292
  var projectPath = input.Item1 + input.Item2;
@@ -477,11 +475,7 @@ public class RunWorkerTests
477
475
  Provider = "github",
478
476
  Repo = "test/repo",
479
477
  Directory = "/",
480
- },
481
- AllowedUpdates =
482
- [
483
- new() { UpdateType = "all" }
484
- ]
478
+ }
485
479
  },
486
480
  files:
487
481
  [
@@ -544,11 +538,7 @@ public class RunWorkerTests
544
538
  Provider = "github",
545
539
  Repo = "test/repo",
546
540
  Directory = "some-dir",
547
- },
548
- AllowedUpdates =
549
- [
550
- new() { UpdateType = "all" }
551
- ]
541
+ }
552
542
  },
553
543
  files:
554
544
  [
@@ -584,7 +574,10 @@ public class RunWorkerTests
584
574
  [
585
575
  new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
586
576
  new("Some.Package2", "2.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net8.0"]),
587
- ]
577
+ ],
578
+ ReferencedProjectPaths = [],
579
+ ImportedFiles = [],
580
+ AdditionalFiles = ["packages.config"],
588
581
  }
589
582
  ]
590
583
  });
@@ -607,9 +600,9 @@ public class RunWorkerTests
607
600
  CanUpdate = true,
608
601
  UpdatedVersion = "2.0.1",
609
602
  UpdatedDependencies =
610
- [
611
- new("Some.Package2", "2.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package2"),
612
- ]
603
+ [
604
+ new("Some.Package2", "2.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package2"),
605
+ ]
613
606
  },
614
607
  _ => throw new NotSupportedException(),
615
608
  };
@@ -674,6 +667,17 @@ public class RunWorkerTests
674
667
  {
675
668
  Base64DependencyFiles =
676
669
  [
670
+ new DependencyFile()
671
+ {
672
+ Directory = "/some-dir",
673
+ Name = "packages.config",
674
+ Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
675
+ <?xml version="1.0" encoding="utf-8"?>
676
+ <packages>
677
+ <package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
678
+ </packages>
679
+ """))
680
+ },
677
681
  new DependencyFile()
678
682
  {
679
683
  Directory = "/some-dir",
@@ -689,17 +693,6 @@ public class RunWorkerTests
689
693
  </Project>
690
694
  """))
691
695
  },
692
- new DependencyFile()
693
- {
694
- Directory = "/some-dir",
695
- Name = "packages.config",
696
- Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
697
- <?xml version="1.0" encoding="utf-8"?>
698
- <packages>
699
- <package id="Some.Package2" version="2.0.0" targetFramework="net8.0" />
700
- </packages>
701
- """))
702
- }
703
696
  ],
704
697
  BaseCommitSha = "TEST-COMMIT-SHA",
705
698
  },
@@ -732,13 +725,13 @@ public class RunWorkerTests
732
725
  new ReportedRequirement()
733
726
  {
734
727
  Requirement = "2.0.0",
735
- File = "/some-dir/packages.config",
728
+ File = "/some-dir/project.csproj",
736
729
  Groups = ["dependencies"],
737
730
  }
738
731
  ]
739
732
  }
740
733
  ],
741
- DependencyFiles = ["/some-dir/project.csproj", "/some-dir/packages.config"],
734
+ DependencyFiles = ["/some-dir/packages.config", "/some-dir/project.csproj"],
742
735
  },
743
736
  new IncrementMetric()
744
737
  {
@@ -790,7 +783,7 @@ public class RunWorkerTests
790
783
  new ReportedRequirement()
791
784
  {
792
785
  Requirement = "2.0.1",
793
- File = "/some-dir/packages.config",
786
+ File = "/some-dir/project.csproj",
794
787
  Groups = ["dependencies"],
795
788
  Source = new()
796
789
  {
@@ -805,7 +798,7 @@ public class RunWorkerTests
805
798
  new ReportedRequirement()
806
799
  {
807
800
  Requirement = "2.0.0",
808
- File = "/some-dir/packages.config",
801
+ File = "/some-dir/project.csproj",
809
802
  Groups = ["dependencies"],
810
803
  }
811
804
  ],
@@ -813,6 +806,17 @@ public class RunWorkerTests
813
806
  ],
814
807
  UpdatedDependencyFiles =
815
808
  [
809
+ new DependencyFile()
810
+ {
811
+ Name = "packages.config",
812
+ Directory = "/some-dir",
813
+ Content = """
814
+ <?xml version="1.0" encoding="utf-8"?>
815
+ <packages>
816
+ <package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
817
+ </packages>
818
+ """,
819
+ },
816
820
  new DependencyFile()
817
821
  {
818
822
  Name = "project.csproj",
@@ -834,17 +838,6 @@ public class RunWorkerTests
834
838
  </Project>
835
839
  """,
836
840
  },
837
- new DependencyFile()
838
- {
839
- Name = "packages.config",
840
- Directory = "/some-dir",
841
- Content = """
842
- <?xml version="1.0" encoding="utf-8"?>
843
- <packages>
844
- <package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
845
- </packages>
846
- """,
847
- },
848
841
  ],
849
842
  BaseCommitSha = "TEST-COMMIT-SHA",
850
843
  CommitMessage = "TODO: message",
@@ -877,11 +870,7 @@ public class RunWorkerTests
877
870
  Provider = "github",
878
871
  Repo = "test/repo",
879
872
  Directory = "some-dir/ProjectA",
880
- },
881
- AllowedUpdates =
882
- [
883
- new() { UpdateType = "all" }
884
- ]
873
+ }
885
874
  },
886
875
  files:
887
876
  [
@@ -936,7 +925,10 @@ public class RunWorkerTests
936
925
  [
937
926
  new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
938
927
  new("Some.Package2", "2.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net8.0"]),
939
- ]
928
+ ],
929
+ ReferencedProjectPaths = [],
930
+ ImportedFiles = [],
931
+ AdditionalFiles = ["packages.config"],
940
932
  },
941
933
  new()
942
934
  {
@@ -946,7 +938,10 @@ public class RunWorkerTests
946
938
  [
947
939
  new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
948
940
  new("Some.Package2", "2.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net8.0"]),
949
- ]
941
+ ],
942
+ ReferencedProjectPaths = [],
943
+ ImportedFiles = [],
944
+ AdditionalFiles = ["packages.config"],
950
945
  }
951
946
  ]
952
947
  });
@@ -969,9 +964,9 @@ public class RunWorkerTests
969
964
  CanUpdate = true,
970
965
  UpdatedVersion = "2.0.1",
971
966
  UpdatedDependencies =
972
- [
973
- new("Some.Package2", "2.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package2"),
974
- ]
967
+ [
968
+ new("Some.Package2", "2.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some-package2"),
969
+ ]
975
970
  },
976
971
  _ => throw new NotSupportedException(),
977
972
  };
@@ -1081,22 +1076,7 @@ public class RunWorkerTests
1081
1076
  [
1082
1077
  new DependencyFile()
1083
1078
  {
1084
- Directory = "/some-dir/ProjectB",
1085
- Name = "ProjectB.csproj",
1086
- Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1087
- <Project Sdk="Microsoft.NET.Sdk">
1088
- <PropertyGroup>
1089
- <TargetFramework>net8.0</TargetFramework>
1090
- </PropertyGroup>
1091
- <ItemGroup>
1092
- <PackageReference Include="Some.Package" Version="1.0.0" />
1093
- </ItemGroup>
1094
- </Project>
1095
- """))
1096
- },
1097
- new DependencyFile()
1098
- {
1099
- Directory = "/some-dir/ProjectB",
1079
+ Directory = "/some-dir/ProjectA",
1100
1080
  Name = "packages.config",
1101
1081
  Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1102
1082
  <?xml version="1.0" encoding="utf-8"?>
@@ -1125,7 +1105,7 @@ public class RunWorkerTests
1125
1105
  },
1126
1106
  new DependencyFile()
1127
1107
  {
1128
- Directory = "/some-dir/ProjectA",
1108
+ Directory = "/some-dir/ProjectB",
1129
1109
  Name = "packages.config",
1130
1110
  Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1131
1111
  <?xml version="1.0" encoding="utf-8"?>
@@ -1134,6 +1114,21 @@ public class RunWorkerTests
1134
1114
  </packages>
1135
1115
  """))
1136
1116
  },
1117
+ new DependencyFile()
1118
+ {
1119
+ Directory = "/some-dir/ProjectB",
1120
+ Name = "ProjectB.csproj",
1121
+ Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1122
+ <Project Sdk="Microsoft.NET.Sdk">
1123
+ <PropertyGroup>
1124
+ <TargetFramework>net8.0</TargetFramework>
1125
+ </PropertyGroup>
1126
+ <ItemGroup>
1127
+ <PackageReference Include="Some.Package" Version="1.0.0" />
1128
+ </ItemGroup>
1129
+ </Project>
1130
+ """))
1131
+ },
1137
1132
  ],
1138
1133
  BaseCommitSha = "TEST-COMMIT-SHA",
1139
1134
  },
@@ -1166,7 +1161,7 @@ public class RunWorkerTests
1166
1161
  new ReportedRequirement()
1167
1162
  {
1168
1163
  Requirement = "2.0.0",
1169
- File = "/some-dir/ProjectB/packages.config",
1164
+ File = "/some-dir/ProjectB/ProjectB.csproj",
1170
1165
  Groups = ["dependencies"],
1171
1166
  }
1172
1167
  ]
@@ -1194,13 +1189,13 @@ public class RunWorkerTests
1194
1189
  new ReportedRequirement()
1195
1190
  {
1196
1191
  Requirement = "2.0.0",
1197
- File = "/some-dir/ProjectA/packages.config",
1192
+ File = "/some-dir/ProjectA/ProjectA.csproj",
1198
1193
  Groups = ["dependencies"],
1199
1194
  }
1200
1195
  ]
1201
1196
  },
1202
1197
  ],
1203
- DependencyFiles = ["/some-dir/ProjectB/ProjectB.csproj", "/some-dir/ProjectA/ProjectA.csproj", "/some-dir/ProjectB/packages.config", "/some-dir/ProjectA/packages.config"],
1198
+ DependencyFiles = ["/some-dir/ProjectA/packages.config", "/some-dir/ProjectA/ProjectA.csproj", "/some-dir/ProjectB/packages.config", "/some-dir/ProjectB/ProjectB.csproj"],
1204
1199
  },
1205
1200
  new IncrementMetric()
1206
1201
  {
@@ -1252,7 +1247,7 @@ public class RunWorkerTests
1252
1247
  new ReportedRequirement()
1253
1248
  {
1254
1249
  Requirement = "2.0.1",
1255
- File = "/some-dir/ProjectB/packages.config",
1250
+ File = "/some-dir/ProjectB/ProjectB.csproj",
1256
1251
  Groups = ["dependencies"],
1257
1252
  Source = new()
1258
1253
  {
@@ -1267,7 +1262,7 @@ public class RunWorkerTests
1267
1262
  new ReportedRequirement()
1268
1263
  {
1269
1264
  Requirement = "2.0.0",
1270
- File = "/some-dir/ProjectB/packages.config",
1265
+ File = "/some-dir/ProjectB/ProjectB.csproj",
1271
1266
  Groups = ["dependencies"],
1272
1267
  }
1273
1268
  ],
@@ -1310,7 +1305,7 @@ public class RunWorkerTests
1310
1305
  new ReportedRequirement()
1311
1306
  {
1312
1307
  Requirement = "2.0.1",
1313
- File = "/some-dir/ProjectA/packages.config",
1308
+ File = "/some-dir/ProjectA/ProjectA.csproj",
1314
1309
  Groups = ["dependencies"],
1315
1310
  Source = new()
1316
1311
  {
@@ -1325,7 +1320,7 @@ public class RunWorkerTests
1325
1320
  new ReportedRequirement()
1326
1321
  {
1327
1322
  Requirement = "2.0.0",
1328
- File = "/some-dir/ProjectA/packages.config",
1323
+ File = "/some-dir/ProjectA/ProjectA.csproj",
1329
1324
  Groups = ["dependencies"],
1330
1325
  }
1331
1326
  ],
@@ -1335,8 +1330,19 @@ public class RunWorkerTests
1335
1330
  [
1336
1331
  new DependencyFile()
1337
1332
  {
1338
- Name = "ProjectB.csproj",
1339
- Directory = "/some-dir/ProjectB",
1333
+ Name = "packages.config",
1334
+ Directory = "/some-dir/ProjectA",
1335
+ Content = """
1336
+ <?xml version="1.0" encoding="utf-8"?>
1337
+ <packages>
1338
+ <package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
1339
+ </packages>
1340
+ """,
1341
+ },
1342
+ new DependencyFile()
1343
+ {
1344
+ Name = "ProjectA.csproj",
1345
+ Directory = "/some-dir/ProjectA",
1340
1346
  Content = """
1341
1347
  <Project Sdk="Microsoft.NET.Sdk">
1342
1348
  <PropertyGroup>
@@ -1345,6 +1351,9 @@ public class RunWorkerTests
1345
1351
  <ItemGroup>
1346
1352
  <PackageReference Include="Some.Package" Version="1.0.1" />
1347
1353
  </ItemGroup>
1354
+ <ItemGroup>
1355
+ <ProjectReference Include="../ProjectB/ProjectB.csproj" />
1356
+ </ItemGroup>
1348
1357
  <ItemGroup>
1349
1358
  <Reference Include="Some.Package2">
1350
1359
  <HintPath>..\packages\Some.Package2.2.0.1\lib\net8.0\Some.Package2.dll</HintPath>
@@ -1367,8 +1376,8 @@ public class RunWorkerTests
1367
1376
  },
1368
1377
  new DependencyFile()
1369
1378
  {
1370
- Name = "ProjectA.csproj",
1371
- Directory = "/some-dir/ProjectA",
1379
+ Name = "ProjectB.csproj",
1380
+ Directory = "/some-dir/ProjectB",
1372
1381
  Content = """
1373
1382
  <Project Sdk="Microsoft.NET.Sdk">
1374
1383
  <PropertyGroup>
@@ -1377,9 +1386,6 @@ public class RunWorkerTests
1377
1386
  <ItemGroup>
1378
1387
  <PackageReference Include="Some.Package" Version="1.0.1" />
1379
1388
  </ItemGroup>
1380
- <ItemGroup>
1381
- <ProjectReference Include="../ProjectB/ProjectB.csproj" />
1382
- </ItemGroup>
1383
1389
  <ItemGroup>
1384
1390
  <Reference Include="Some.Package2">
1385
1391
  <HintPath>..\packages\Some.Package2.2.0.1\lib\net8.0\Some.Package2.dll</HintPath>
@@ -1389,17 +1395,311 @@ public class RunWorkerTests
1389
1395
  </Project>
1390
1396
  """,
1391
1397
  },
1398
+ ],
1399
+ BaseCommitSha = "TEST-COMMIT-SHA",
1400
+ CommitMessage = "TODO: message",
1401
+ PrTitle = "TODO: title",
1402
+ PrBody = "TODO: body",
1403
+ },
1404
+ new MarkAsProcessed("TEST-COMMIT-SHA")
1405
+ ]
1406
+ );
1407
+ }
1408
+
1409
+ [Fact]
1410
+ public async Task UpdatedFilesAreOnlyReportedOnce()
1411
+ {
1412
+ await RunAsync(
1413
+ job: new()
1414
+ {
1415
+ PackageManager = "nuget",
1416
+ Source = new()
1417
+ {
1418
+ Provider = "github",
1419
+ Repo = "test/repo",
1420
+ Directory = "/",
1421
+ }
1422
+ },
1423
+ packages:
1424
+ [
1425
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0"),
1426
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.1.0", "net8.0"),
1427
+ ],
1428
+ files:
1429
+ [
1430
+ ("dirs.proj", """
1431
+ <Project>
1432
+ <ItemGroup>
1433
+ <ProjectFile Include="project1/project1.csproj" />
1434
+ <ProjectFile Include="project2/project2.csproj" />
1435
+ </ItemGroup>
1436
+ </Project>
1437
+ """),
1438
+ ("Directory.Build.props", """
1439
+ <Project>
1440
+ <PropertyGroup>
1441
+ <SomePackageVersion>1.0.0</SomePackageVersion>
1442
+ </PropertyGroup>
1443
+ </Project>
1444
+ """),
1445
+ ("project1/project1.csproj", """
1446
+ <Project Sdk="Microsoft.NET.Sdk">
1447
+ <PropertyGroup>
1448
+ <TargetFramework>net8.0</TargetFramework>
1449
+ </PropertyGroup>
1450
+ <ItemGroup>
1451
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
1452
+ </ItemGroup>
1453
+ </Project>
1454
+ """),
1455
+ ("project2/project2.csproj", """
1456
+ <Project Sdk="Microsoft.NET.Sdk">
1457
+ <PropertyGroup>
1458
+ <TargetFramework>net8.0</TargetFramework>
1459
+ </PropertyGroup>
1460
+ <ItemGroup>
1461
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
1462
+ </ItemGroup>
1463
+ </Project>
1464
+ """)
1465
+ ],
1466
+ discoveryWorker: new TestDiscoveryWorker(_input =>
1467
+ {
1468
+ return Task.FromResult(new WorkspaceDiscoveryResult()
1469
+ {
1470
+ Path = "",
1471
+ Projects = [
1472
+ new()
1473
+ {
1474
+ FilePath = "project1/project1.csproj",
1475
+ TargetFrameworks = ["net8.0"],
1476
+ Dependencies = [
1477
+ new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
1478
+ ],
1479
+ ReferencedProjectPaths = [],
1480
+ ImportedFiles = [
1481
+ "../Directory.Build.props",
1482
+ ],
1483
+ AdditionalFiles = [],
1484
+ },
1485
+ new()
1486
+ {
1487
+ FilePath = "project2/project2.csproj",
1488
+ TargetFrameworks = ["net8.0"],
1489
+ Dependencies = [
1490
+ new("Some.Package", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"]),
1491
+ ],
1492
+ ReferencedProjectPaths = [],
1493
+ ImportedFiles = [
1494
+ "../Directory.Build.props",
1495
+ ],
1496
+ AdditionalFiles = [],
1497
+ },
1498
+ ]
1499
+ });
1500
+ }),
1501
+ analyzeWorker: new TestAnalyzeWorker(_input =>
1502
+ {
1503
+ return Task.FromResult(new AnalysisResult()
1504
+ {
1505
+ CanUpdate = true,
1506
+ UpdatedVersion = "1.1.0",
1507
+ UpdatedDependencies =
1508
+ [
1509
+ new("Some.Package", "1.1.0", DependencyType.Unknown, TargetFrameworks: ["net8.0"]),
1510
+ ]
1511
+ });
1512
+ }),
1513
+ updaterWorker: new TestUpdaterWorker(async input =>
1514
+ {
1515
+ var repoRootPath = input.Item1;
1516
+ var filePath = input.Item2;
1517
+ var packageName = input.Item3;
1518
+ var previousVersion = input.Item4;
1519
+ var newVersion = input.Item5;
1520
+ var _isTransitive = input.Item6;
1521
+
1522
+ var directoryBuildPropsPath = Path.Join(repoRootPath, "Directory.Build.props");
1523
+ await File.WriteAllTextAsync(directoryBuildPropsPath, """
1524
+ <Project>
1525
+ <PropertyGroup>
1526
+ <SomePackageVersion>1.1.0</SomePackageVersion>
1527
+ </PropertyGroup>
1528
+ </Project>
1529
+ """);
1530
+ return new UpdateOperationResult();
1531
+ }),
1532
+ expectedResult: new RunResult()
1533
+ {
1534
+ Base64DependencyFiles =
1535
+ [
1536
+ new DependencyFile()
1537
+ {
1538
+ Directory = "/",
1539
+ Name = "Directory.Build.props",
1540
+ Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1541
+ <Project>
1542
+ <PropertyGroup>
1543
+ <SomePackageVersion>1.0.0</SomePackageVersion>
1544
+ </PropertyGroup>
1545
+ </Project>
1546
+ """))
1547
+ },
1548
+ new DependencyFile()
1549
+ {
1550
+ Directory = "/project1",
1551
+ Name = "project1.csproj",
1552
+ Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1553
+ <Project Sdk="Microsoft.NET.Sdk">
1554
+ <PropertyGroup>
1555
+ <TargetFramework>net8.0</TargetFramework>
1556
+ </PropertyGroup>
1557
+ <ItemGroup>
1558
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
1559
+ </ItemGroup>
1560
+ </Project>
1561
+ """))
1562
+ },
1563
+ new DependencyFile()
1564
+ {
1565
+ Directory = "/project2",
1566
+ Name = "project2.csproj",
1567
+ Content = Convert.ToBase64String(Encoding.UTF8.GetBytes("""
1568
+ <Project Sdk="Microsoft.NET.Sdk">
1569
+ <PropertyGroup>
1570
+ <TargetFramework>net8.0</TargetFramework>
1571
+ </PropertyGroup>
1572
+ <ItemGroup>
1573
+ <PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
1574
+ </ItemGroup>
1575
+ </Project>
1576
+ """))
1577
+ },
1578
+ ],
1579
+ BaseCommitSha = "TEST-COMMIT-SHA",
1580
+ },
1581
+ expectedApiMessages:
1582
+ [
1583
+ new UpdatedDependencyList()
1584
+ {
1585
+ Dependencies =
1586
+ [
1587
+ new ReportedDependency()
1588
+ {
1589
+ Name = "Some.Package",
1590
+ Version = "1.0.0",
1591
+ Requirements =
1592
+ [
1593
+ new ReportedRequirement()
1594
+ {
1595
+ Requirement = "1.0.0",
1596
+ File = "/project1/project1.csproj",
1597
+ Groups = ["dependencies"],
1598
+ }
1599
+ ]
1600
+ },
1601
+ new ReportedDependency()
1602
+ {
1603
+ Name = "Some.Package",
1604
+ Version = "1.0.0",
1605
+ Requirements =
1606
+ [
1607
+ new ReportedRequirement()
1608
+ {
1609
+ Requirement = "1.0.0",
1610
+ File = "/project2/project2.csproj",
1611
+ Groups = ["dependencies"],
1612
+ }
1613
+ ]
1614
+ }
1615
+ ],
1616
+ DependencyFiles = ["/Directory.Build.props", "/project1/project1.csproj", "/project2/project2.csproj"],
1617
+ },
1618
+ new IncrementMetric()
1619
+ {
1620
+ Metric = "updater.started",
1621
+ Tags = new()
1622
+ {
1623
+ ["operation"] = "group_update_all_versions"
1624
+ }
1625
+ },
1626
+ new CreatePullRequest()
1627
+ {
1628
+ Dependencies =
1629
+ [
1630
+ new ReportedDependency()
1631
+ {
1632
+ Name = "Some.Package",
1633
+ Version = "1.1.0",
1634
+ Requirements =
1635
+ [
1636
+ new ReportedRequirement()
1637
+ {
1638
+ Requirement = "1.1.0",
1639
+ File = "/project1/project1.csproj",
1640
+ Groups = ["dependencies"],
1641
+ Source = new()
1642
+ {
1643
+ SourceUrl = null,
1644
+ Type = "nuget_repo",
1645
+ }
1646
+ }
1647
+ ],
1648
+ PreviousVersion = "1.0.0",
1649
+ PreviousRequirements =
1650
+ [
1651
+ new ReportedRequirement()
1652
+ {
1653
+ Requirement = "1.0.0",
1654
+ File = "/project1/project1.csproj",
1655
+ Groups = ["dependencies"],
1656
+ }
1657
+ ],
1658
+ },
1659
+ new ReportedDependency()
1660
+ {
1661
+ Name = "Some.Package",
1662
+ Version = "1.1.0",
1663
+ Requirements =
1664
+ [
1665
+ new ReportedRequirement()
1666
+ {
1667
+ Requirement = "1.1.0",
1668
+ File = "/project2/project2.csproj",
1669
+ Groups = ["dependencies"],
1670
+ Source = new()
1671
+ {
1672
+ SourceUrl = null,
1673
+ Type = "nuget_repo",
1674
+ }
1675
+ }
1676
+ ],
1677
+ PreviousVersion = "1.0.0",
1678
+ PreviousRequirements =
1679
+ [
1680
+ new ReportedRequirement()
1681
+ {
1682
+ Requirement = "1.0.0",
1683
+ File = "/project2/project2.csproj",
1684
+ Groups = ["dependencies"],
1685
+ }
1686
+ ],
1687
+ },
1688
+ ],
1689
+ UpdatedDependencyFiles =
1690
+ [
1392
1691
  new DependencyFile()
1393
1692
  {
1394
- Name = "packages.config",
1395
- Directory = "/some-dir/ProjectA",
1693
+ Name = "Directory.Build.props",
1694
+ Directory = "/",
1396
1695
  Content = """
1397
- <?xml version="1.0" encoding="utf-8"?>
1398
- <packages>
1399
- <package id="Some.Package2" version="2.0.1" targetFramework="net8.0" />
1400
- </packages>
1696
+ <Project>
1697
+ <PropertyGroup>
1698
+ <SomePackageVersion>1.1.0</SomePackageVersion>
1699
+ </PropertyGroup>
1700
+ </Project>
1401
1701
  """,
1402
- },
1702
+ }
1403
1703
  ],
1404
1704
  BaseCommitSha = "TEST-COMMIT-SHA",
1405
1705
  CommitMessage = "TODO: message",
@@ -1430,7 +1730,7 @@ public class RunWorkerTests
1430
1730
  var testApiHandler = new TestApiHandler();
1431
1731
  var logger = new TestLogger();
1432
1732
  discoveryWorker ??= new DiscoveryWorker(experimentsManager, logger);
1433
- analyzeWorker ??= new AnalyzeWorker(logger);
1733
+ analyzeWorker ??= new AnalyzeWorker(experimentsManager, logger);
1434
1734
  updaterWorker ??= new UpdaterWorker(experimentsManager, logger);
1435
1735
 
1436
1736
  var worker = new RunWorker(testApiHandler, discoveryWorker, analyzeWorker, updaterWorker, logger);