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,154 @@
|
|
1
|
+
using NuGetUpdater.Core.Discover;
|
2
|
+
using NuGetUpdater.Core.Test.Utilities;
|
3
|
+
using NuGetUpdater.Core.Updater.FileWriters;
|
4
|
+
|
5
|
+
using Xunit;
|
6
|
+
|
7
|
+
namespace NuGetUpdater.Core.Test.Update.FileWriters;
|
8
|
+
|
9
|
+
public class FileWriterWorkerTests_MiscellaneousTests
|
10
|
+
{
|
11
|
+
[Fact]
|
12
|
+
public void GetProjectDiscoveryEvaluationOrder()
|
13
|
+
{
|
14
|
+
// generate an ordered list of project discovery objects from the bottom of the graph to the top
|
15
|
+
|
16
|
+
// arrange
|
17
|
+
var repoContentsPath = new DirectoryInfo("/repo/root");
|
18
|
+
var startingProjectPath = "client/client.csproj";
|
19
|
+
var fullProjectPath = new FileInfo(Path.Join(repoContentsPath.FullName, startingProjectPath));
|
20
|
+
var discoveryResult = new WorkspaceDiscoveryResult()
|
21
|
+
{
|
22
|
+
Path = "client",
|
23
|
+
Projects = [
|
24
|
+
new ProjectDiscoveryResult()
|
25
|
+
{
|
26
|
+
FilePath = "client.csproj",
|
27
|
+
ReferencedProjectPaths = ["../common/common.csproj", "../utils/utils.csproj"],
|
28
|
+
Dependencies = [],
|
29
|
+
ImportedFiles = [],
|
30
|
+
AdditionalFiles = [],
|
31
|
+
},
|
32
|
+
new ProjectDiscoveryResult()
|
33
|
+
{
|
34
|
+
FilePath = "../common/common.csproj",
|
35
|
+
ReferencedProjectPaths = ["../utils/utils.csproj"],
|
36
|
+
Dependencies = [],
|
37
|
+
ImportedFiles = [],
|
38
|
+
AdditionalFiles = [],
|
39
|
+
},
|
40
|
+
new ProjectDiscoveryResult()
|
41
|
+
{
|
42
|
+
FilePath = "../utils/utils.csproj",
|
43
|
+
ReferencedProjectPaths = [],
|
44
|
+
Dependencies = [],
|
45
|
+
ImportedFiles = [],
|
46
|
+
AdditionalFiles = [],
|
47
|
+
},
|
48
|
+
// the server project is a red herring; it's not directly referenced by the client project and should not be in the final list
|
49
|
+
new ProjectDiscoveryResult()
|
50
|
+
{
|
51
|
+
FilePath = "../server/server.csproj",
|
52
|
+
ReferencedProjectPaths = ["../common/common.csproj", "../utils/utils.csproj"],
|
53
|
+
Dependencies = [],
|
54
|
+
ImportedFiles = [],
|
55
|
+
AdditionalFiles = [],
|
56
|
+
},
|
57
|
+
]
|
58
|
+
};
|
59
|
+
|
60
|
+
// act
|
61
|
+
var projectDiscoveryOrder = FileWriterWorker.GetProjectDiscoveryEvaluationOrder(repoContentsPath, discoveryResult, fullProjectPath, new TestLogger());
|
62
|
+
|
63
|
+
// assert
|
64
|
+
var actualProjectPaths = projectDiscoveryOrder
|
65
|
+
.Select(p => Path.Join(repoContentsPath.FullName, discoveryResult.Path, p.FilePath).FullyNormalizedRootedPath())
|
66
|
+
.Select(p => Path.GetRelativePath(repoContentsPath.FullName, p).NormalizePathToUnix())
|
67
|
+
.ToArray();
|
68
|
+
string[] expectedProjectPaths = [
|
69
|
+
"utils/utils.csproj",
|
70
|
+
"common/common.csproj",
|
71
|
+
"client/client.csproj",
|
72
|
+
];
|
73
|
+
AssertEx.Equal(expectedProjectPaths, actualProjectPaths);
|
74
|
+
}
|
75
|
+
|
76
|
+
[Fact]
|
77
|
+
public async Task AllProjectDiscoveryFilesCanBeReadAndRestored()
|
78
|
+
{
|
79
|
+
// arrange
|
80
|
+
var projectDiscoveryResults = new[]
|
81
|
+
{
|
82
|
+
new ProjectDiscoveryResult()
|
83
|
+
{
|
84
|
+
FilePath = "client.csproj",
|
85
|
+
ReferencedProjectPaths = ["../common/common.csproj", "../utils/utils.csproj"],
|
86
|
+
Dependencies = [],
|
87
|
+
ImportedFiles = [],
|
88
|
+
AdditionalFiles = ["packages.config"],
|
89
|
+
},
|
90
|
+
};
|
91
|
+
using var tempDir = await TemporaryDirectory.CreateWithContentsAsync(
|
92
|
+
("client/client.csproj", "initial client content"),
|
93
|
+
("client/packages.config", "initial packages config content")
|
94
|
+
);
|
95
|
+
var repoContentsPath = new DirectoryInfo(tempDir.DirectoryPath);
|
96
|
+
var startingProjectPath = "client/client.csproj";
|
97
|
+
var initialStartingDirectory = new DirectoryInfo(Path.GetDirectoryName(Path.Join(repoContentsPath.FullName, startingProjectPath))!);
|
98
|
+
|
99
|
+
// act - overwrite the files with new content then revert
|
100
|
+
var originalFileContents = await FileWriterWorker.GetOriginalFileContentsAsync(repoContentsPath, initialStartingDirectory, projectDiscoveryResults);
|
101
|
+
await File.WriteAllTextAsync(Path.Join(repoContentsPath.FullName, "client/client.csproj"), "new client content", TestContext.Current.CancellationToken);
|
102
|
+
await File.WriteAllTextAsync(Path.Join(repoContentsPath.FullName, "client/packages.config"), "new packages config content", TestContext.Current.CancellationToken);
|
103
|
+
await FileWriterWorker.RestoreOriginalFileContentsAsync(originalFileContents);
|
104
|
+
|
105
|
+
// assert
|
106
|
+
Assert.Equal("initial client content", await File.ReadAllTextAsync(Path.Join(repoContentsPath.FullName, "client/client.csproj"), TestContext.Current.CancellationToken));
|
107
|
+
Assert.Equal("initial packages config content", await File.ReadAllTextAsync(Path.Join(repoContentsPath.FullName, "client/packages.config"), TestContext.Current.CancellationToken));
|
108
|
+
}
|
109
|
+
|
110
|
+
[Fact]
|
111
|
+
public async Task TryPerformFileWrites_ReportsAppropriateUpdatedFilePaths_WhenStartingFromDifferentProjectDirectory()
|
112
|
+
{
|
113
|
+
// discovery was initiated from the "tests" directory, but we're now evaluating the "client" project for file writes
|
114
|
+
// arrange
|
115
|
+
using var tempDir = await TemporaryDirectory.CreateWithContentsAsync(
|
116
|
+
("tests/tests.csproj", """
|
117
|
+
<Project>
|
118
|
+
<ItemGroup>
|
119
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
120
|
+
</ItemGroup>
|
121
|
+
</Project>
|
122
|
+
"""),
|
123
|
+
("client/client.csproj", """
|
124
|
+
<Project>
|
125
|
+
<ItemGroup>
|
126
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
127
|
+
</ItemGroup>
|
128
|
+
</Project>
|
129
|
+
""")
|
130
|
+
);
|
131
|
+
var logger = new TestLogger();
|
132
|
+
var fileWriter = new XmlFileWriter(logger);
|
133
|
+
var originalDiscoveryDirectory = new DirectoryInfo(Path.Join(tempDir.DirectoryPath, "tests"));
|
134
|
+
var projectDiscovery = new ProjectDiscoveryResult()
|
135
|
+
{
|
136
|
+
FilePath = "../client/client.csproj",
|
137
|
+
Dependencies = [new("Some.Package", "1.0.0", DependencyType.PackageReference)],
|
138
|
+
ImportedFiles = [],
|
139
|
+
AdditionalFiles = [],
|
140
|
+
};
|
141
|
+
|
142
|
+
// act
|
143
|
+
var updatedFilePaths = await FileWriterWorker.TryPerformFileWritesAsync(
|
144
|
+
fileWriter,
|
145
|
+
new DirectoryInfo(tempDir.DirectoryPath),
|
146
|
+
originalDiscoveryDirectory,
|
147
|
+
projectDiscovery,
|
148
|
+
[new("Some.Package", "1.0.1", DependencyType.PackageReference)]
|
149
|
+
);
|
150
|
+
|
151
|
+
// assert
|
152
|
+
AssertEx.Equal(["/client/client.csproj"], updatedFilePaths);
|
153
|
+
}
|
154
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
using System.Collections.Immutable;
|
2
|
+
|
3
|
+
using NuGetUpdater.Core.Updater.FileWriters;
|
4
|
+
|
5
|
+
namespace NuGetUpdater.Core.Test.Update.FileWriters;
|
6
|
+
|
7
|
+
internal class TestFileWriterReturnsConstantResult : IFileWriter
|
8
|
+
{
|
9
|
+
public bool Result { get; }
|
10
|
+
|
11
|
+
public TestFileWriterReturnsConstantResult(bool result)
|
12
|
+
{
|
13
|
+
Result = result;
|
14
|
+
}
|
15
|
+
|
16
|
+
public Task<bool> UpdatePackageVersionsAsync(DirectoryInfo repoContentsPath, ImmutableArray<string> relativeFilePaths, ImmutableArray<Dependency> originalDependencies, ImmutableArray<Dependency> requiredPackageVersions, bool addPackageReferenceElementForPinnedPackages)
|
17
|
+
{
|
18
|
+
return Task.FromResult(Result);
|
19
|
+
}
|
20
|
+
}
|