dependabot-nuget 0.321.3 → 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.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +22 -22
- data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/Program.cs +21 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +19 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/CloneCommand.cs +19 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +21 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +8 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +29 -16
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +20 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +10 -23
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +15 -232
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +1 -154
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +5 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/PrivateSourceTimedOutException.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +4 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PrivateSourceTimedOut.cs +10 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/AzurePackageDetailFinder.cs +30 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/DetailedPullRequestBodyGenerator.cs +237 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/GitHubPackageDetailFinder.cs +101 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/GitLabPackageDetailFinder.cs +107 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/HttpFetcher.cs +32 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IHttpFetcher.cs +30 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IPackageDetailFinder.cs +47 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IPullRequestBodyGenerator.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/SimplePullRequestBodyGenerator.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestTextGenerator.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +3 -525
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/GroupUpdateAllVersionsHandler.cs +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +85 -35
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/XmlFileWriter.cs +27 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +1 -856
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +18 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +16 -200
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +21 -556
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +9 -73
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Clone/CloneWorkerTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolver/MSBuildDependencySolverTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -20
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +3 -62
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +13 -563
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +20 -269
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +131 -131
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/HttpApiHandlerTests.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/JobErrorBaseTests.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MessageReportTests.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +0 -203
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/DetailedPullRequestBodyGeneratorTests.cs +871 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/IPackageDetailFinderTests.cs +28 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/TestHttpFetcher.cs +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestTextTests.cs +24 -24
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +14 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandlerTests.cs +6 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/GroupUpdateAllVersionsHandlerTests.cs +18 -18
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandlerTests.cs +15 -15
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandlerTests.cs +21 -21
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandlerTests.cs +15 -15
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/UpdateHandlersTestsBase.cs +1 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests_MiscellaneousTests.cs +45 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests.cs +111 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackageReferenceUpdaterTests.cs +1 -159
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +26 -660
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- metadata +18 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs +0 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestMessageTests.cs +0 -296
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +0 -3592
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatePermittedAndMessageTests.cs +0 -457
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +0 -378
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +0 -175
@@ -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
|
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
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
using System.Collections.Immutable;
|
1
2
|
using System.Text.Json.Nodes;
|
2
3
|
|
3
4
|
namespace NuGetUpdater.Core;
|
@@ -12,28 +13,19 @@ internal sealed class GlobalJsonBuildFile : JsonBuildFile
|
|
12
13
|
{
|
13
14
|
}
|
14
15
|
|
15
|
-
public JsonObject? Sdk => Node.Value is JsonObject root ? root["sdk"]?.AsObject() : null;
|
16
|
-
|
17
16
|
public JsonObject? MSBuildSdks => Node.Value is JsonObject root ? root["msbuild-sdks"]?.AsObject() : null;
|
18
17
|
|
19
18
|
public IEnumerable<Dependency> GetDependencies()
|
20
19
|
{
|
21
|
-
List<Dependency> dependencies = [];
|
22
|
-
if (Sdk is not null
|
23
|
-
&& Sdk.TryGetPropertyValue("version", out var version))
|
24
|
-
{
|
25
|
-
dependencies.Add(GetSdkDependency("Microsoft.NET.Sdk", version));
|
26
|
-
}
|
27
|
-
|
28
20
|
if (MSBuildSdks is null)
|
29
21
|
{
|
30
|
-
return
|
22
|
+
return [];
|
31
23
|
}
|
32
24
|
|
33
25
|
var msBuildDependencies = MSBuildSdks
|
34
|
-
.Select(t => GetSdkDependency(t.Key, t.Value))
|
35
|
-
|
36
|
-
return
|
26
|
+
.Select(t => GetSdkDependency(t.Key, t.Value))
|
27
|
+
.ToImmutableArray();
|
28
|
+
return msBuildDependencies;
|
37
29
|
}
|
38
30
|
|
39
31
|
private Dependency GetSdkDependency(string name, JsonNode? version)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace NuGetUpdater.Core;
|
2
|
+
|
3
|
+
internal class PrivateSourceTimedOutException : Exception
|
4
|
+
{
|
5
|
+
public string Url { get; }
|
6
|
+
|
7
|
+
public PrivateSourceTimedOutException(string url)
|
8
|
+
: base($"The request to source {url} has timed out.")
|
9
|
+
{
|
10
|
+
Url = url;
|
11
|
+
}
|
12
|
+
}
|
@@ -70,10 +70,14 @@ public abstract record JobErrorBase : MessageBase
|
|
70
70
|
|
71
71
|
return new UnknownError(ex, jobId);
|
72
72
|
}
|
73
|
+
case InvalidDataException invalidData when invalidData.Message == "Central Directory corrupt.":
|
74
|
+
return new PrivateSourceBadResponse(NuGetContext.GetPackageSourceUrls(currentDirectory));
|
73
75
|
case InvalidProjectFileException invalidProjectFile:
|
74
76
|
return new DependencyFileNotParseable(invalidProjectFile.ProjectFile);
|
75
77
|
case MissingFileException missingFile:
|
76
78
|
return new DependencyFileNotFound(missingFile.FilePath, missingFile.Message);
|
79
|
+
case PrivateSourceTimedOutException timeout:
|
80
|
+
return new PrivateSourceTimedOut(timeout.Url);
|
77
81
|
case UnparseableFileException unparseableFile:
|
78
82
|
return new DependencyFileNotParseable(unparseableFile.FilePath, unparseableFile.Message);
|
79
83
|
case UpdateNotPossibleException updateNotPossible:
|
@@ -0,0 +1,30 @@
|
|
1
|
+
using NuGet.Versioning;
|
2
|
+
|
3
|
+
namespace NuGetUpdater.Core.Run.PullRequestBodyGenerator;
|
4
|
+
|
5
|
+
internal class AzurePackageDetailFinder : IPackageDetailFinder
|
6
|
+
{
|
7
|
+
public string GetCompareUrlPath(string? oldTag, string? newTag)
|
8
|
+
{
|
9
|
+
// azure devops doesn't support direct tag listing so both parameters are likely to be null, but just in case, this is the correct url format
|
10
|
+
if (oldTag is not null && newTag is not null)
|
11
|
+
{
|
12
|
+
return $"branchCompare?baseVersion=GT{oldTag}&targetVersion=GT{newTag}";
|
13
|
+
}
|
14
|
+
|
15
|
+
if (newTag is not null)
|
16
|
+
{
|
17
|
+
return $"commits?itemVersion=GT{newTag}";
|
18
|
+
}
|
19
|
+
|
20
|
+
return "commits";
|
21
|
+
}
|
22
|
+
|
23
|
+
public Task<Dictionary<NuGetVersion, (string TagName, string? Details)>> GetReleaseDataForVersionsAsync(string repoName, NuGetVersion oldVersion, NuGetVersion newVersion)
|
24
|
+
{
|
25
|
+
// azure devops doesn't support direct tag listing
|
26
|
+
return Task.FromResult(new Dictionary<NuGetVersion, (string TagName, string? Details)>());
|
27
|
+
}
|
28
|
+
|
29
|
+
public string GetReleasesUrlPath() => "tags";
|
30
|
+
}
|