dependabot-nuget 0.321.2 → 0.322.0
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/Model/PackageMapper.cs +9 -0
- 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.Core/DependencyDiscoveryTargetingPacks.props +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencySolver/IDependencySolver.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencySolver/MSBuildDependencySolver.cs +32 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +10 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -0
- 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/PullRequestTextGenerator.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/GroupUpdateAllVersionsHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +6 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +376 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/IFileWriter.cs +14 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/XmlFileWriter.cs +477 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +9 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +18 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +26 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolver/MSBuildDependencySolverTests.cs +633 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +49 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +484 -0
- 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/PullRequestTextTests.cs +21 -22
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/DotNetToolsJsonUpdaterTests.cs +181 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterTestsBase.cs +61 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests.cs +917 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests_MiscellaneousTests.cs +154 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/TestFileWriterReturnsConstantResult.cs +20 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests.cs +1620 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests_CreateUpdatedVersionRangeTests.cs +25 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/GlobalJsonUpdaterTests.cs +139 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +1961 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateOperationResultTests.cs +116 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +16 -1043
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- metadata +21 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +0 -375
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +0 -296
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.LockFile.cs +0 -251
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +0 -201
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +0 -3821
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +0 -2706
@@ -0,0 +1,25 @@
|
|
1
|
+
using NuGet.Versioning;
|
2
|
+
|
3
|
+
using NuGetUpdater.Core.Updater.FileWriters;
|
4
|
+
|
5
|
+
using Xunit;
|
6
|
+
|
7
|
+
namespace NuGetUpdater.Core.Test.Update.FileWriters;
|
8
|
+
|
9
|
+
public class XmlFileWriterTests_CreateUpdatedVersionRangeTests
|
10
|
+
{
|
11
|
+
[Theory]
|
12
|
+
[InlineData("[1.0.0]", "1.0.0", "2.0.0", "[2.0.0]")] // single exact version
|
13
|
+
[InlineData("[1.0.0, 3.0.0)", "1.0.0", "2.0.0", "[2.0.0, 3.0.0)")] // narrowing of range
|
14
|
+
[InlineData("[1.0.0, 2.0.0)", "1.0.0", "2.0.0", "2.0.0")] // narrowing of range to simple version string
|
15
|
+
public void CreateUpdatedVersionRange(string existingRangeString, string existingVersionString, string newVersionString, string expectedNewRangeString)
|
16
|
+
{
|
17
|
+
var existingRange = VersionRange.Parse(existingRangeString);
|
18
|
+
var existingVersion = NuGetVersion.Parse(existingVersionString);
|
19
|
+
var newVersion = NuGetVersion.Parse(newVersionString);
|
20
|
+
|
21
|
+
var actualNewRangeString = XmlFileWriter.CreateUpdatedVersionRangeString(existingRange, existingVersion, newVersion);
|
22
|
+
|
23
|
+
Assert.Equal(expectedNewRangeString, actualNewRangeString);
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,139 @@
|
|
1
|
+
using Xunit;
|
2
|
+
|
3
|
+
namespace NuGetUpdater.Core.Test.Update;
|
4
|
+
|
5
|
+
public class GlobalJsonUpdaterTests
|
6
|
+
{
|
7
|
+
[Fact]
|
8
|
+
public async Task UpdateDependency_MaintainComments()
|
9
|
+
{
|
10
|
+
await TestAsync(
|
11
|
+
globalJsonContent: """
|
12
|
+
{
|
13
|
+
// this is a comment
|
14
|
+
"sdk": {
|
15
|
+
"version": "6.0.405",
|
16
|
+
"rollForward": "latestPatch"
|
17
|
+
},
|
18
|
+
"msbuild-sdks": {
|
19
|
+
// this is a deep comment
|
20
|
+
"Some.MSBuild.Sdk": "3.2.0"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
""",
|
24
|
+
dependencyName: "Some.MSBuild.Sdk",
|
25
|
+
previousDependencyVersion: "3.2.0",
|
26
|
+
newDependencyVersion: "4.1.0",
|
27
|
+
expectedUpdatedGlobalJsonContent: """
|
28
|
+
{
|
29
|
+
// this is a comment
|
30
|
+
"sdk": {
|
31
|
+
"version": "6.0.405",
|
32
|
+
"rollForward": "latestPatch"
|
33
|
+
},
|
34
|
+
"msbuild-sdks": {
|
35
|
+
// this is a deep comment
|
36
|
+
"Some.MSBuild.Sdk": "4.1.0"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
"""
|
40
|
+
);
|
41
|
+
}
|
42
|
+
|
43
|
+
[Fact]
|
44
|
+
public async Task UpdateDependency_TrailingCommaInOriginal()
|
45
|
+
{
|
46
|
+
await TestAsync(
|
47
|
+
globalJsonContent: """
|
48
|
+
{
|
49
|
+
"sdk": {
|
50
|
+
"version": "6.0.405",
|
51
|
+
"rollForward": "latestPatch"
|
52
|
+
},
|
53
|
+
"msbuild-sdks": {
|
54
|
+
"Some.MSBuild.Sdk": "3.2.0"
|
55
|
+
},
|
56
|
+
}
|
57
|
+
""",
|
58
|
+
dependencyName: "Some.MSBuild.Sdk",
|
59
|
+
previousDependencyVersion: "3.2.0",
|
60
|
+
newDependencyVersion: "4.1.0",
|
61
|
+
expectedUpdatedGlobalJsonContent: """
|
62
|
+
{
|
63
|
+
"sdk": {
|
64
|
+
"version": "6.0.405",
|
65
|
+
"rollForward": "latestPatch"
|
66
|
+
},
|
67
|
+
"msbuild-sdks": {
|
68
|
+
"Some.MSBuild.Sdk": "4.1.0"
|
69
|
+
}
|
70
|
+
}
|
71
|
+
"""
|
72
|
+
);
|
73
|
+
}
|
74
|
+
|
75
|
+
[Fact]
|
76
|
+
public async Task MissingDependency_NoUpdatePerformed()
|
77
|
+
{
|
78
|
+
await TestAsync(
|
79
|
+
globalJsonContent: """
|
80
|
+
{
|
81
|
+
"sdk": {
|
82
|
+
"version": "6.0.405",
|
83
|
+
"rollForward": "latestPatch"
|
84
|
+
},
|
85
|
+
"msbuild-sdks": {
|
86
|
+
"Some.MSBuild.Sdk": "3.2.0"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
""",
|
90
|
+
dependencyName: "Some.Unrelated.MSBuild.Sdk",
|
91
|
+
previousDependencyVersion: "1.0.0",
|
92
|
+
newDependencyVersion: "2.0.0",
|
93
|
+
expectedUpdatedGlobalJsonContent: """
|
94
|
+
{
|
95
|
+
"sdk": {
|
96
|
+
"version": "6.0.405",
|
97
|
+
"rollForward": "latestPatch"
|
98
|
+
},
|
99
|
+
"msbuild-sdks": {
|
100
|
+
"Some.MSBuild.Sdk": "3.2.0"
|
101
|
+
}
|
102
|
+
}
|
103
|
+
"""
|
104
|
+
);
|
105
|
+
}
|
106
|
+
|
107
|
+
private async Task TestAsync(
|
108
|
+
string globalJsonContent,
|
109
|
+
string dependencyName,
|
110
|
+
string previousDependencyVersion,
|
111
|
+
string newDependencyVersion,
|
112
|
+
string expectedUpdatedGlobalJsonContent,
|
113
|
+
string workspaceDirectory = "/",
|
114
|
+
string globalJsonPath = "global.json"
|
115
|
+
)
|
116
|
+
{
|
117
|
+
// arrange
|
118
|
+
using var tempDir = await TemporaryDirectory.CreateWithContentsAsync(
|
119
|
+
(globalJsonPath, globalJsonContent)
|
120
|
+
);
|
121
|
+
var logger = new TestLogger();
|
122
|
+
|
123
|
+
// act
|
124
|
+
var updatedFilePath = await GlobalJsonUpdater.UpdateDependencyAsync(tempDir.DirectoryPath, workspaceDirectory, dependencyName, previousDependencyVersion, newDependencyVersion, logger);
|
125
|
+
|
126
|
+
// assert
|
127
|
+
var expectedUpdateToHappen = globalJsonContent.Replace("\r", "") != expectedUpdatedGlobalJsonContent.Replace("\r", "");
|
128
|
+
if (expectedUpdateToHappen)
|
129
|
+
{
|
130
|
+
Assert.NotNull(updatedFilePath);
|
131
|
+
var relativeUpdatedFilePath = Path.GetRelativePath(tempDir.DirectoryPath, updatedFilePath).NormalizePathToUnix();
|
132
|
+
Assert.Equal(globalJsonPath, relativeUpdatedFilePath);
|
133
|
+
}
|
134
|
+
|
135
|
+
var actualFileContents = await tempDir.ReadFileContentsAsync([globalJsonPath]);
|
136
|
+
var actualContent = actualFileContents.Single().Contents.Replace("\r", "");
|
137
|
+
Assert.Equal(expectedUpdatedGlobalJsonContent.Replace("\r", ""), actualContent);
|
138
|
+
}
|
139
|
+
}
|