dependabot-nuget 0.322.0 → 0.322.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +1 -1
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +10 -23
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +9 -0
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +15 -232
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +1 -154
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -12
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/AzurePackageDetailFinder.cs +30 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/DetailedPullRequestBodyGenerator.cs +237 -0
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/GitHubPackageDetailFinder.cs +101 -0
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/GitLabPackageDetailFinder.cs +107 -0
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/HttpFetcher.cs +32 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IHttpFetcher.cs +30 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IPackageDetailFinder.cs +47 -0
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IPullRequestBodyGenerator.cs +11 -0
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/SimplePullRequestBodyGenerator.cs +15 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestTextGenerator.cs +7 -3
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +3 -525
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandler.cs +1 -1
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/GroupUpdateAllVersionsHandler.cs +2 -2
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandler.cs +1 -1
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandler.cs +1 -1
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandler.cs +1 -1
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +1 -1
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/XmlFileWriter.cs +10 -3
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +1 -856
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +16 -200
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +6 -556
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +9 -73
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Clone/CloneWorkerTests.cs +2 -2
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolver/MSBuildDependencySolverTests.cs +1 -1
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -20
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +3 -62
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +13 -563
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +20 -267
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +2 -2
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +131 -131
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +0 -203
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/DetailedPullRequestBodyGeneratorTests.cs +871 -0
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/IPackageDetailFinderTests.cs +28 -0
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/TestHttpFetcher.cs +23 -0
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestTextTests.cs +3 -2
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +6 -12
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandlerTests.cs +6 -6
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/GroupUpdateAllVersionsHandlerTests.cs +18 -18
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandlerTests.cs +15 -15
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandlerTests.cs +21 -21
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandlerTests.cs +15 -15
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/UpdateHandlersTestsBase.cs +1 -8
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests.cs +1 -1
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests.cs +85 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackageReferenceUpdaterTests.cs +1 -159
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +10 -660
  54. metadata +16 -10
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs +0 -13
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestMessageTests.cs +0 -296
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +0 -3592
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatePermittedAndMessageTests.cs +0 -457
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +0 -378
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +0 -175
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3960b8e460b0caef38e1a302c8245e51708c19e3070be3dcd6de9ac708174c48
4
- data.tar.gz: 9de84a12311aa75b8f838e1413052d4c37a06e74887c3e9d16d050e7e463f096
3
+ metadata.gz: 608db6312847c8b17ba8d4487ad0959d2c600965ac9a6125d747c220b53b54b2
4
+ data.tar.gz: b60ee9bb959e0fd7f28cee03715ae92e44c95628ced1c0995031cc251cdf2248
5
5
  SHA512:
6
- metadata.gz: 390a5e049399bf2d135915b3aa37c9c3977139193f3a46c41b09ea20568a7b417a96235fd32751f9d0b14efa8ad56c54187a0096d760676a728d8c61166225a3
7
- data.tar.gz: bc2cabf452264a3df4f02e8531bfc8905c379072982f8ff31048d1fb3dbb4ededd221112eb3914bc0a6b56e87c0eff739ef5cebad1d12e7564264714463f94ec
6
+ metadata.gz: ab0e8f7d5004717780eb170d7400c5cb5a8d3754bc5048f763c55a5c41e22883467c64a3b8ceae5d44141d9879abc83245e0af023f24d0720fa83f2d78ce5076
7
+ data.tar.gz: aaa8de59bd6a7741139c095f62527bdb64d76e23e64f1ab224ef8548d9847e72edf34e1dd6089ec7a0042798bcc1e51f63deb05b065267c96f4678aca6bdf8ab
@@ -135,7 +135,7 @@ public partial class EntryPointTests
135
135
  VersionComesFromMultiDependencyProperty = false,
136
136
  UpdatedDependencies =
137
137
  [
138
- new Dependency("Some.Package", "1.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some.package")
138
+ new Dependency("Some.Package", "1.0.1", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true, InfoUrl: "https://nuget.example.com/some.package")
139
139
  ],
140
140
  }
141
141
  );
@@ -18,10 +18,8 @@ public partial class EntryPointTests
18
18
  {
19
19
  public class Discover : DiscoveryWorkerTestBase
20
20
  {
21
- [Theory]
22
- [InlineData(true)]
23
- [InlineData(false)]
24
- public async Task PathWithSpaces(bool useDirectDiscovery)
21
+ [Fact]
22
+ public async Task PathWithSpaces()
25
23
  {
26
24
  await RunAsync(path =>
27
25
  [
@@ -37,7 +35,6 @@ public partial class EntryPointTests
37
35
  "--output",
38
36
  Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
39
37
  ],
40
- experimentsManager: new ExperimentsManager() { UseDirectDiscovery = useDirectDiscovery },
41
38
  packages:
42
39
  [
43
40
  MockNuGetPackage.CreateSimplePackage("Some.Package", "1.2.3", "net8.0"),
@@ -78,10 +75,8 @@ public partial class EntryPointTests
78
75
  );
79
76
  }
80
77
 
81
- [Theory]
82
- [InlineData(true)]
83
- [InlineData(false)]
84
- public async Task WithSolution(bool useDirectDiscovery)
78
+ [Fact]
79
+ public async Task WithSolution()
85
80
  {
86
81
  await RunAsync(path =>
87
82
  [
@@ -97,7 +92,6 @@ public partial class EntryPointTests
97
92
  "--output",
98
93
  Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
99
94
  ],
100
- experimentsManager: new ExperimentsManager() { UseDirectDiscovery = useDirectDiscovery },
101
95
  packages:
102
96
  [
103
97
  MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
@@ -175,10 +169,8 @@ public partial class EntryPointTests
175
169
  );
176
170
  }
177
171
 
178
- [Theory]
179
- [InlineData(true)]
180
- [InlineData(false)]
181
- public async Task WithProject(bool useDirectDiscovery)
172
+ [Fact]
173
+ public async Task WithProject()
182
174
  {
183
175
  await RunAsync(path =>
184
176
  [
@@ -194,7 +186,6 @@ public partial class EntryPointTests
194
186
  "--output",
195
187
  Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
196
188
  ],
197
- experimentsManager: new ExperimentsManager() { UseDirectDiscovery = useDirectDiscovery },
198
189
  packages:
199
190
  [
200
191
  MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
@@ -249,10 +240,8 @@ public partial class EntryPointTests
249
240
  );
250
241
  }
251
242
 
252
- [Theory]
253
- [InlineData(true)]
254
- [InlineData(false)]
255
- public async Task WithDirectory(bool useDirectDiscovery)
243
+ [Fact]
244
+ public async Task WithDirectory()
256
245
  {
257
246
  var workspacePath = "path/to/";
258
247
  await RunAsync(path =>
@@ -269,7 +258,6 @@ public partial class EntryPointTests
269
258
  "--output",
270
259
  Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
271
260
  ],
272
- experimentsManager: new ExperimentsManager() { UseDirectDiscovery = useDirectDiscovery },
273
261
  packages:
274
262
  [
275
263
  MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
@@ -365,7 +353,6 @@ public partial class EntryPointTests
365
353
  </Project>
366
354
  """)
367
355
  },
368
- experimentsManager: new ExperimentsManager() { UseDirectDiscovery = true },
369
356
  packages:
370
357
  [
371
358
  MockNuGetPackage.CreateSimplePackage("Package.A", "1.2.3", "net8.0"),
@@ -405,7 +392,7 @@ public partial class EntryPointTests
405
392
  using var testDirectory = new TemporaryDirectory();
406
393
  var jobFilePath = Path.Combine(testDirectory.DirectoryPath, "job.json");
407
394
  var resultFilePath = Path.Combine(testDirectory.DirectoryPath, DiscoveryWorker.DiscoveryResultFileName);
408
- await File.WriteAllTextAsync(jobFilePath, "not json");
395
+ await File.WriteAllTextAsync(jobFilePath, "not json", TestContext.Current.CancellationToken);
409
396
  await RunAsync(path =>
410
397
  [
411
398
  "discover",
@@ -453,7 +440,7 @@ public partial class EntryPointTests
453
440
  ]
454
441
  }
455
442
  }
456
- """);
443
+ """, TestContext.Current.CancellationToken);
457
444
  await RunAsync(path =>
458
445
  [
459
446
  "discover",
@@ -28,6 +28,15 @@ public partial class EntryPointTests
28
28
  ],
29
29
  files:
30
30
  [
31
+ ("Directory.Build.props", "<Project />"),
32
+ ("Directory.Build.targets", "<Project />"),
33
+ ("Directory.Packages.props", """
34
+ <Project>
35
+ <PropertyGroup>
36
+ <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
37
+ </PropertyGroup>
38
+ </Project>
39
+ """),
31
40
  ("src/project.csproj", """
32
41
  <Project Sdk="Microsoft.NET.Sdk">
33
42
  <PropertyGroup>
@@ -13,111 +13,6 @@ public partial class EntryPointTests
13
13
  {
14
14
  public class Update : UpdateWorkerTestBase
15
15
  {
16
- [Fact]
17
- public async Task WithSolution()
18
- {
19
- await Run(path =>
20
- [
21
- "update",
22
- "--job-id",
23
- "TEST-JOB-ID",
24
- "--job-path",
25
- Path.Combine(path, "job.json"),
26
- "--repo-root",
27
- path,
28
- "--solution-or-project",
29
- Path.Combine(path, "path/to/solution.sln"),
30
- "--dependency",
31
- "Some.package",
32
- "--new-version",
33
- "13.0.1",
34
- "--previous-version",
35
- "7.0.1",
36
- ],
37
- packages:
38
- [
39
- MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
40
- MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
41
- ],
42
- initialFiles:
43
- [
44
- ("path/to/solution.sln", """
45
- Microsoft Visual Studio Solution File, Format Version 12.00
46
- # Visual Studio 14
47
- VisualStudioVersion = 14.0.22705.0
48
- MinimumVisualStudioVersion = 10.0.40219.1
49
- Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "my", "my.csproj", "{782E0C0A-10D3-444D-9640-263D03D2B20C}"
50
- EndProject
51
- Global
52
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
53
- Debug|Any CPU = Debug|Any CPU
54
- Release|Any CPU = Release|Any CPU
55
- EndGlobalSection
56
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
57
- {782E0C0A-10D3-444D-9640-263D03D2B20C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58
- {782E0C0A-10D3-444D-9640-263D03D2B20C}.Debug|Any CPU.Build.0 = Debug|Any CPU
59
- {782E0C0A-10D3-444D-9640-263D03D2B20C}.Release|Any CPU.ActiveCfg = Release|Any CPU
60
- {782E0C0A-10D3-444D-9640-263D03D2B20C}.Release|Any CPU.Build.0 = Release|Any CPU
61
- EndGlobalSection
62
- GlobalSection(SolutionProperties) = preSolution
63
- HideSolutionNode = FALSE
64
- EndGlobalSection
65
- EndGlobal
66
- """),
67
- ("path/to/my.csproj", """
68
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
69
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
70
- <PropertyGroup>
71
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
72
- </PropertyGroup>
73
- <ItemGroup>
74
- <None Include="packages.config" />
75
- </ItemGroup>
76
- <ItemGroup>
77
- <Reference Include="Some.Package">
78
- <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
79
- <Private>True</Private>
80
- </Reference>
81
- </ItemGroup>
82
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
83
- </Project>
84
- """),
85
- ("path/to/packages.config", """
86
- <packages>
87
- <package id="Some.Package" version="7.0.1" targetFramework="net45" />
88
- </packages>
89
- """)
90
- ],
91
- expectedFiles:
92
- [
93
- ("path/to/my.csproj", """
94
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
95
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
96
- <PropertyGroup>
97
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
98
- </PropertyGroup>
99
- <ItemGroup>
100
- <None Include="packages.config" />
101
- </ItemGroup>
102
- <ItemGroup>
103
- <Reference Include="Some.Package">
104
- <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
105
- <Private>True</Private>
106
- </Reference>
107
- </ItemGroup>
108
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
109
- </Project>
110
- """),
111
- ("path/to/packages.config", """
112
- <?xml version="1.0" encoding="utf-8"?>
113
- <packages>
114
- <package id="Some.Package" version="13.0.1" targetFramework="net45" />
115
- </packages>
116
- """)
117
- ]
118
- );
119
- }
120
-
121
16
  [Fact]
122
17
  public async Task WithProject()
123
18
  {
@@ -200,127 +95,6 @@ public partial class EntryPointTests
200
95
  );
201
96
  }
202
97
 
203
- [Fact]
204
- public async Task WithDirsProjAndDirectoryBuildPropsThatIsOutOfDirectoryButStillMatchingThePackage()
205
- {
206
- await Run(path =>
207
- [
208
- "update",
209
- "--job-id",
210
- "TEST-JOB-ID",
211
- "--job-path",
212
- Path.Combine(path, "job.json"),
213
- "--repo-root",
214
- path,
215
- "--solution-or-project",
216
- $"{path}/some-dir/dirs.proj",
217
- "--dependency",
218
- "Some.Package",
219
- "--new-version",
220
- "6.6.1",
221
- "--previous-version",
222
- "6.1.0"
223
- ],
224
- packages:
225
- [
226
- MockNuGetPackage.CreateSimplePackage("Some.Package", "6.1.0", "net8.0"),
227
- MockNuGetPackage.CreateSimplePackage("Some.Package", "6.6.1", "net8.0"),
228
- ],
229
- initialFiles:
230
- [
231
- ("some-dir/dirs.proj", """
232
- <Project Sdk="Microsoft.Build.Traversal">
233
- <ItemGroup>
234
- <ProjectFile Include="project1/project.csproj" />
235
- <ProjectReference Include="project2/project.csproj" />
236
- </ItemGroup>
237
- </Project>
238
- """),
239
- ("some-dir/project1/project.csproj", """
240
- <Project Sdk="Microsoft.NET.Sdk">
241
- <PropertyGroup>
242
- <OutputType>Exe</OutputType>
243
- <TargetFramework>net8.0</TargetFramework>
244
- <ImplicitUsings>enable</ImplicitUsings>
245
- <Nullable>enable</Nullable>
246
- </PropertyGroup>
247
- <ItemGroup>
248
- <PackageReference Include="Some.Package" Version="6.1.0" />
249
- </ItemGroup>
250
- </Project>
251
- """),
252
- ("some-dir/project2/project.csproj", """
253
- <Project Sdk="Microsoft.NET.Sdk">
254
- <PropertyGroup>
255
- <OutputType>Exe</OutputType>
256
- <TargetFramework>net8.0</TargetFramework>
257
- <ImplicitUsings>enable</ImplicitUsings>
258
- <Nullable>enable</Nullable>
259
- </PropertyGroup>
260
- <ItemGroup>
261
- <PackageReference Include="Some.Package" Version="6.1.0" />
262
- </ItemGroup>
263
- </Project>
264
- """),
265
- ("other-dir/Directory.Build.props", """
266
- <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
267
-
268
- <ItemGroup>
269
- <PackageReference Include="Some.Package" Version="6.1.0" />
270
- </ItemGroup>
271
-
272
- </Project>
273
- """)
274
- ],
275
- expectedFiles:
276
- [
277
- ("some-dir/dirs.proj", """
278
- <Project Sdk="Microsoft.Build.Traversal">
279
- <ItemGroup>
280
- <ProjectFile Include="project1/project.csproj" />
281
- <ProjectReference Include="project2/project.csproj" />
282
- </ItemGroup>
283
- </Project>
284
- """),
285
- ("some-dir/project1/project.csproj", """
286
- <Project Sdk="Microsoft.NET.Sdk">
287
- <PropertyGroup>
288
- <OutputType>Exe</OutputType>
289
- <TargetFramework>net8.0</TargetFramework>
290
- <ImplicitUsings>enable</ImplicitUsings>
291
- <Nullable>enable</Nullable>
292
- </PropertyGroup>
293
- <ItemGroup>
294
- <PackageReference Include="Some.Package" Version="6.6.1" />
295
- </ItemGroup>
296
- </Project>
297
- """),
298
- ("some-dir/project2/project.csproj", """
299
- <Project Sdk="Microsoft.NET.Sdk">
300
- <PropertyGroup>
301
- <OutputType>Exe</OutputType>
302
- <TargetFramework>net8.0</TargetFramework>
303
- <ImplicitUsings>enable</ImplicitUsings>
304
- <Nullable>enable</Nullable>
305
- </PropertyGroup>
306
- <ItemGroup>
307
- <PackageReference Include="Some.Package" Version="6.6.1" />
308
- </ItemGroup>
309
- </Project>
310
- """),
311
- ("other-dir/Directory.Build.props", """
312
- <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
313
-
314
- <ItemGroup>
315
- <PackageReference Include="Some.Package" Version="6.1.0" />
316
- </ItemGroup>
317
-
318
- </Project>
319
- """)
320
- ]
321
- );
322
- }
323
-
324
98
  [Theory]
325
99
  [InlineData(null)]
326
100
  [InlineData("src")]
@@ -349,9 +123,9 @@ public partial class EntryPointTests
349
123
  }
350
124
  }
351
125
  """;
352
- await File.WriteAllTextAsync(globalJsonPath, globalJsonContent);
126
+ await File.WriteAllTextAsync(globalJsonPath, globalJsonContent, TestContext.Current.CancellationToken);
353
127
  Directory.CreateDirectory(Path.Join(tempDir.DirectoryPath, "src"));
354
- await File.WriteAllTextAsync(srcGlobalJsonPath, globalJsonContent);
128
+ await File.WriteAllTextAsync(srcGlobalJsonPath, globalJsonContent, TestContext.Current.CancellationToken);
355
129
  var projectPath = Path.Join(tempDir.DirectoryPath, "src", "project.csproj");
356
130
  await File.WriteAllTextAsync(projectPath, """
357
131
  <Project Sdk="Microsoft.NET.Sdk">
@@ -362,7 +136,16 @@ public partial class EntryPointTests
362
136
  <PackageReference Include="Some.Package" Version="7.0.1" />
363
137
  </ItemGroup>
364
138
  </Project>
365
- """);
139
+ """, TestContext.Current.CancellationToken);
140
+ await File.WriteAllTextAsync(Path.Join(Path.GetDirectoryName(projectPath)!, "Directory.Build.props"), "<Project />", TestContext.Current.CancellationToken);
141
+ await File.WriteAllTextAsync(Path.Join(Path.GetDirectoryName(projectPath)!, "Directory.Build.targets"), "<Project />", TestContext.Current.CancellationToken);
142
+ await File.WriteAllTextAsync(Path.Join(Path.GetDirectoryName(projectPath)!, "Directory.Packages.props"), """
143
+ <Project>
144
+ <PropertyGroup>
145
+ <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
146
+ </PropertyGroup>
147
+ </Project>
148
+ """, TestContext.Current.CancellationToken);
366
149
  var executableName = Path.Join(Path.GetDirectoryName(GetType().Assembly.Location), "NuGetUpdater.Cli.dll");
367
150
  IEnumerable<string> executableArgs = [
368
151
  executableName,
@@ -394,15 +177,15 @@ public partial class EntryPointTests
394
177
  Assert.True(exitCode == 0, $"Error running update on unsupported SDK.\nSTDOUT:\n{output}\nSTDERR:\n{error}");
395
178
 
396
179
  // verify project update
397
- var updatedProjectContents = await File.ReadAllTextAsync(projectPath);
180
+ var updatedProjectContents = await File.ReadAllTextAsync(projectPath, TestContext.Current.CancellationToken);
398
181
  Assert.Contains("13.0.1", updatedProjectContents);
399
182
 
400
183
  // verify `global.json` untouched
401
- var updatedGlobalJsonContents = await File.ReadAllTextAsync(globalJsonPath);
184
+ var updatedGlobalJsonContents = await File.ReadAllTextAsync(globalJsonPath, TestContext.Current.CancellationToken);
402
185
  Assert.Contains("99.99.99", updatedGlobalJsonContents);
403
186
 
404
187
  // verify `src/global.json` untouched
405
- var updatedSrcGlobalJsonContents = await File.ReadAllTextAsync(srcGlobalJsonPath);
188
+ var updatedSrcGlobalJsonContents = await File.ReadAllTextAsync(srcGlobalJsonPath, TestContext.Current.CancellationToken);
406
189
  Assert.Contains("99.99.99", updatedGlobalJsonContents);
407
190
  }
408
191
 
@@ -6,7 +6,6 @@ using System.Xml.XPath;
6
6
  using Microsoft.Build.Logging.StructuredLogger;
7
7
 
8
8
  using NuGet.Frameworks;
9
- using NuGet.Versioning;
10
9
 
11
10
  using NuGetUpdater.Core.Utilities;
12
11
 
@@ -55,18 +54,6 @@ internal static class SdkProjectDiscovery
55
54
  };
56
55
 
57
56
  public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverAsync(string repoRootPath, string workspacePath, string startingProjectPath, ExperimentsManager experimentsManager, ILogger logger)
58
- {
59
- if (experimentsManager.UseDirectDiscovery)
60
- {
61
- return await DiscoverWithBinLogAsync(repoRootPath, workspacePath, startingProjectPath, experimentsManager, logger);
62
- }
63
- else
64
- {
65
- return await DiscoverWithTempProjectAsync(repoRootPath, workspacePath, startingProjectPath, experimentsManager, logger);
66
- }
67
- }
68
-
69
- public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverWithBinLogAsync(string repoRootPath, string workspacePath, string startingProjectPath, ExperimentsManager experimentsManager, ILogger logger)
70
57
  {
71
58
  // N.b., there are many paths used in this function. The MSBuild binary log always reports fully qualified paths, so that's what will be used
72
59
  // throughout until the very end when the appropriate kind of relative path is returned.
@@ -595,7 +582,7 @@ internal static class SdkProjectDiscovery
595
582
 
596
583
  var tempProjectPath = await MSBuildHelper.CreateTempProjectAsync(tempDirectory, repoRootPath, projectPath, targetFrameworks, topLevelDependencies, experimentsManager, logger);
597
584
  var tempProjectDirectory = Path.GetDirectoryName(tempProjectPath)!;
598
- var rediscoveredDependencies = await DiscoverWithBinLogAsync(tempProjectDirectory, tempProjectDirectory, tempProjectPath, experimentsManager, logger);
585
+ var rediscoveredDependencies = await DiscoverAsync(tempProjectDirectory, tempProjectDirectory, tempProjectPath, experimentsManager, logger);
599
586
  var rediscoveredDependenciesForThisProject = rediscoveredDependencies.Single(); // we started with a single temp project, this will be the only result
600
587
 
601
588
  // re-build packagesPerProject
@@ -798,144 +785,4 @@ internal static class SdkProjectDiscovery
798
785
 
799
786
  return property.Value;
800
787
  }
801
-
802
- public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverWithTempProjectAsync(string repoRootPath, string workspacePath, string projectPath, ExperimentsManager experimentsManager, ILogger logger)
803
- {
804
- // Determine which targets and props files contribute to the build.
805
- var (buildFiles, projectTargetFrameworks) = await MSBuildHelper.LoadBuildFilesAndTargetFrameworksAsync(repoRootPath, projectPath);
806
- var tfms = projectTargetFrameworks.Order().ToImmutableArray();
807
-
808
- // Get all the dependencies which are directly referenced from the project file or indirectly referenced from
809
- // targets and props files.
810
- var topLevelDependencies = MSBuildHelper.GetTopLevelPackageDependencyInfos(buildFiles);
811
-
812
- var results = ImmutableArray.CreateBuilder<ProjectDiscoveryResult>();
813
- if (tfms.Length > 0)
814
- {
815
- foreach (var buildFile in buildFiles)
816
- {
817
- // Only include build files that exist beneath the RepoRootPath.
818
- if (buildFile.IsOutsideBasePath)
819
- {
820
- continue;
821
- }
822
-
823
- // The build file dependencies have the correct DependencyType and the TopLevelDependencies have the evaluated version.
824
- // Combine them to have the set of dependencies that are directly referenced from the build file.
825
- var fileDependencies = BuildFile.GetDependencies(buildFile).ToImmutableArray();
826
-
827
- // this is new-ish behavior; don't ever report this dependency because there's no meaningful way to update it
828
- fileDependencies = fileDependencies.Where(d => !d.Name.Equals("Microsoft.NET.Sdk", StringComparison.OrdinalIgnoreCase)).ToImmutableArray();
829
-
830
- var fileDependencyLookup = fileDependencies
831
- .ToLookup(d => d.Name, StringComparer.OrdinalIgnoreCase);
832
- var sdkDependencies = fileDependencies
833
- .Where(d => d.Type == DependencyType.MSBuildSdk)
834
- .ToImmutableArray();
835
- var indirectDependencies = topLevelDependencies
836
- .Where(d => !fileDependencyLookup.Contains(d.Name))
837
- .ToImmutableArray();
838
- var directDependencies = topLevelDependencies
839
- .Where(d => fileDependencyLookup.Contains(d.Name))
840
- .SelectMany(d =>
841
- {
842
- var dependencies = fileDependencyLookup[d.Name];
843
- return dependencies.Select(fileDependency => d with
844
- {
845
- Type = fileDependency.Type,
846
- IsDirect = true
847
- });
848
- }).ToImmutableArray();
849
-
850
- if (buildFile.GetFileType() == ProjectBuildFileType.Project)
851
- {
852
- // Collect information that is specific to the project file.
853
- var properties = MSBuildHelper.GetProperties(buildFiles).Values
854
- .Where(p => !p.SourceFilePath.StartsWith(".."))
855
- .OrderBy(p => p.Name)
856
- .ToImmutableArray();
857
- var referencedProjectPaths = MSBuildHelper.GetProjectPathsFromProject(projectPath)
858
- .Select(path => Path.GetRelativePath(workspacePath, path).NormalizePathToUnix())
859
- .OrderBy(p => p)
860
- .ToImmutableArray();
861
-
862
- // Get the complete set of dependencies including transitive dependencies.
863
- var dependencies = indirectDependencies.Concat(directDependencies).ToImmutableArray();
864
- dependencies = dependencies
865
- .Select(d => d with { TargetFrameworks = tfms })
866
- .ToImmutableArray();
867
- var transitiveDependencies = await GetTransitiveDependencies(repoRootPath, projectPath, tfms, dependencies, experimentsManager, logger);
868
- ImmutableArray<Dependency> allDependencies = dependencies.Concat(transitiveDependencies).Concat(sdkDependencies)
869
- .OrderBy(d => d.Name)
870
- .ToImmutableArray();
871
-
872
- // for the temporary project, these directories correspond to $(OutputPath) and $(IntermediateOutputPath) and files from
873
- // these directories should not be reported
874
- var intermediateDirectories = new string[]
875
- {
876
- Path.Join(Path.GetDirectoryName(buildFile.Path), "bin"),
877
- Path.Join(Path.GetDirectoryName(buildFile.Path), "obj"),
878
- };
879
- var projectDirectory = Path.GetDirectoryName(buildFile.Path)!;
880
- var additionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(buildFile.Path, ProjectHelper.PathFormat.Relative);
881
- results.Add(new()
882
- {
883
- FilePath = Path.GetRelativePath(workspacePath, buildFile.Path).NormalizePathToUnix(),
884
- Properties = properties,
885
- TargetFrameworks = tfms,
886
- ReferencedProjectPaths = referencedProjectPaths,
887
- Dependencies = allDependencies,
888
- ImportedFiles = buildFiles.Where(b =>
889
- {
890
- var fileType = b.GetFileType();
891
- return fileType == ProjectBuildFileType.Props || fileType == ProjectBuildFileType.Targets;
892
- })
893
- .Where(b => !intermediateDirectories.Any(i => PathHelper.IsFileUnderDirectory(new DirectoryInfo(i), new FileInfo(b.Path))))
894
- .Select(b => Path.GetRelativePath(projectDirectory, b.Path).NormalizePathToUnix())
895
- .ToImmutableArray(),
896
- AdditionalFiles = additionalFiles,
897
- });
898
- }
899
- }
900
- }
901
-
902
- return results.ToImmutable();
903
- }
904
-
905
- private static async Task<ImmutableArray<Dependency>> GetTransitiveDependencies(
906
- string repoRootPath,
907
- string projectPath,
908
- ImmutableArray<string> tfms,
909
- ImmutableArray<Dependency> directDependencies,
910
- ExperimentsManager experimentsManager,
911
- ILogger logger
912
- )
913
- {
914
- Dictionary<string, Dependency> transitiveDependencies = new(StringComparer.OrdinalIgnoreCase);
915
- foreach (var tfm in tfms)
916
- {
917
- var tfmDependencies = await MSBuildHelper.GetAllPackageDependenciesAsync(repoRootPath, projectPath, tfm, directDependencies, experimentsManager, logger);
918
- foreach (var dependency in tfmDependencies.Where(d => d.IsTransitive))
919
- {
920
- if (!transitiveDependencies.TryGetValue(dependency.Name, out var existingDependency))
921
- {
922
- transitiveDependencies[dependency.Name] = dependency;
923
- continue;
924
- }
925
-
926
- transitiveDependencies[dependency.Name] = existingDependency with
927
- {
928
- // Revisit this logic. We may want to return each dependency instead of merging them.
929
- Version = NuGetVersion.Parse(existingDependency.Version!) > NuGetVersion.Parse(dependency.Version!)
930
- ? existingDependency.Version
931
- : dependency.Version,
932
- TargetFrameworks = existingDependency.TargetFrameworks is not null && dependency.TargetFrameworks is not null
933
- ? existingDependency.TargetFrameworks.Value.AddRange(dependency.TargetFrameworks)
934
- : existingDependency.TargetFrameworks ?? dependency.TargetFrameworks,
935
- };
936
- }
937
- }
938
-
939
- return [.. transitiveDependencies.Values];
940
- }
941
788
  }
@@ -7,23 +7,17 @@ namespace NuGetUpdater.Core;
7
7
 
8
8
  public record ExperimentsManager
9
9
  {
10
+ public bool GenerateSimplePrBody { get; init; } = false;
10
11
  public bool InstallDotnetSdks { get; init; } = false;
11
12
  public bool NativeUpdater { get; init; } = false;
12
- public bool UseLegacyDependencySolver { get; init; } = false;
13
- public bool UseLegacyUpdateHandler { get; init; } = false;
14
- public bool UseDirectDiscovery { get; init; } = false;
15
- public bool UseNewFileUpdater { get; init; } = false;
16
13
 
17
14
  public Dictionary<string, object> ToDictionary()
18
15
  {
19
16
  return new()
20
17
  {
18
+ ["nuget_generate_simple_pr_body"] = GenerateSimplePrBody,
21
19
  ["nuget_install_dotnet_sdks"] = InstallDotnetSdks,
22
20
  ["nuget_native_updater"] = NativeUpdater,
23
- ["nuget_legacy_dependency_solver"] = UseLegacyDependencySolver,
24
- ["nuget_use_legacy_update_handler"] = UseLegacyUpdateHandler,
25
- ["nuget_use_direct_discovery"] = UseDirectDiscovery,
26
- ["nuget_use_new_file_updater"] = UseNewFileUpdater,
27
21
  };
28
22
  }
29
23
 
@@ -31,12 +25,9 @@ public record ExperimentsManager
31
25
  {
32
26
  return new ExperimentsManager()
33
27
  {
28
+ GenerateSimplePrBody = IsEnabled(experiments, "nuget_generate_simple_pr_body"),
34
29
  InstallDotnetSdks = IsEnabled(experiments, "nuget_install_dotnet_sdks"),
35
30
  NativeUpdater = IsEnabled(experiments, "nuget_native_updater"),
36
- UseLegacyDependencySolver = IsEnabled(experiments, "nuget_legacy_dependency_solver"),
37
- UseLegacyUpdateHandler = IsEnabled(experiments, "nuget_use_legacy_update_handler"),
38
- UseDirectDiscovery = IsEnabled(experiments, "nuget_use_direct_discovery"),
39
- UseNewFileUpdater = IsEnabled(experiments, "nuget_use_new_file_updater"),
40
31
  };
41
32
  }
42
33