dependabot-nuget 0.263.0 → 0.264.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/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +37 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +169 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +79 -67
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +10 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalysisResult.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +441 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +177 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +47 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyInfo.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Extensions.cs +36 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +128 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Requirement.cs +105 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs +17 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerability.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerabilityExtensions.cs +36 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +179 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionResult.cs +54 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +5 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +0 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +7 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +90 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +304 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs +145 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/ExpectedAnalysisResult.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/RequirementTests.cs +69 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/SecurityVulnerabilityExtensionsTests.cs +78 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/VersionFinderTests.cs +193 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +102 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +8 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +8 -7
- data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +63 -0
- data/lib/dependabot/nuget/analysis/dependency_analysis.rb +63 -0
- data/lib/dependabot/nuget/file_fetcher.rb +7 -6
- data/lib/dependabot/nuget/file_parser.rb +28 -21
- data/lib/dependabot/nuget/file_updater.rb +22 -25
- data/lib/dependabot/nuget/metadata_finder.rb +2 -160
- data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +102 -0
- data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +129 -0
- data/lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb +44 -0
- data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +174 -0
- data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +63 -0
- data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +82 -0
- data/lib/dependabot/nuget/native_discovery/native_property_details.rb +43 -0
- data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +68 -0
- data/lib/dependabot/nuget/native_helpers.rb +59 -0
- data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +105 -0
- data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +200 -0
- data/lib/dependabot/nuget/nuget_config_credential_helpers.rb +3 -2
- data/lib/dependabot/nuget/update_checker.rb +47 -0
- metadata +39 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 374eac378d18521cbfed963fc5319709e1ca86c07a2b5db887e6e7fcd89b5fb4
|
|
4
|
+
data.tar.gz: b1c6b74d727ccdd8d7de8e4626bdbfc74caae7f3d0368b997518b71ee21b1b6d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9e72f43e70e24dceedd5474b802af066aafa8df6516e65878a11d8b50b1364fe56d694f7457e04e5a3205018c93257719e8895dd8f35e2ee75a098ec59e2fc9
|
|
7
|
+
data.tar.gz: 2ca5feb309686d3eea541b38143dce03354d7d468bc7ffa8864d9b83efd15f3ef65ce8a99d0c5d1fb7fba0c8b4be18747b13adac3d3a7979415d01cc11f308d2
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
using System.CommandLine;
|
|
2
|
+
|
|
3
|
+
using NuGetUpdater.Core;
|
|
4
|
+
using NuGetUpdater.Core.Analyze;
|
|
5
|
+
|
|
6
|
+
namespace NuGetUpdater.Cli.Commands;
|
|
7
|
+
|
|
8
|
+
internal static class AnalyzeCommand
|
|
9
|
+
{
|
|
10
|
+
internal static readonly Option<DirectoryInfo> RepoRootOption = new("--repo-root") { IsRequired = true };
|
|
11
|
+
internal static readonly Option<FileInfo> DependencyFilePathOption = new("--dependency-file-path") { IsRequired = true };
|
|
12
|
+
internal static readonly Option<FileInfo> DiscoveryFilePathOption = new("--discovery-file-path") { IsRequired = true };
|
|
13
|
+
internal static readonly Option<DirectoryInfo> AnalysisFolderOption = new("--analysis-folder-path") { IsRequired = true };
|
|
14
|
+
internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
|
|
15
|
+
|
|
16
|
+
internal static Command GetCommand(Action<int> setExitCode)
|
|
17
|
+
{
|
|
18
|
+
Command command = new("analyze", "Determines how to update a dependency based on the workspace discovery information.")
|
|
19
|
+
{
|
|
20
|
+
RepoRootOption,
|
|
21
|
+
DependencyFilePathOption,
|
|
22
|
+
DiscoveryFilePathOption,
|
|
23
|
+
AnalysisFolderOption,
|
|
24
|
+
VerboseOption
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
command.TreatUnmatchedTokensAsErrors = true;
|
|
28
|
+
|
|
29
|
+
command.SetHandler(async (repoRoot, discoveryPath, dependencyPath, analysisDirectory, verbose) =>
|
|
30
|
+
{
|
|
31
|
+
var worker = new AnalyzeWorker(new Logger(verbose));
|
|
32
|
+
await worker.RunAsync(repoRoot.FullName, discoveryPath.FullName, dependencyPath.FullName, analysisDirectory.FullName);
|
|
33
|
+
}, RepoRootOption, DiscoveryFilePathOption, DependencyFilePathOption, AnalysisFolderOption, VerboseOption);
|
|
34
|
+
|
|
35
|
+
return command;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -7,9 +7,9 @@ namespace NuGetUpdater.Cli.Commands;
|
|
|
7
7
|
|
|
8
8
|
internal static class DiscoverCommand
|
|
9
9
|
{
|
|
10
|
-
internal static readonly Option<DirectoryInfo> RepoRootOption = new("--repo-root"
|
|
10
|
+
internal static readonly Option<DirectoryInfo> RepoRootOption = new("--repo-root") { IsRequired = true };
|
|
11
11
|
internal static readonly Option<string> WorkspaceOption = new("--workspace") { IsRequired = true };
|
|
12
|
-
internal static readonly Option<
|
|
12
|
+
internal static readonly Option<FileInfo> OutputOption = new("--output") { IsRequired = true };
|
|
13
13
|
internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
|
|
14
14
|
|
|
15
15
|
internal static Command GetCommand(Action<int> setExitCode)
|
|
@@ -27,7 +27,7 @@ internal static class DiscoverCommand
|
|
|
27
27
|
command.SetHandler(async (repoRoot, workspace, outputPath, verbose) =>
|
|
28
28
|
{
|
|
29
29
|
var worker = new DiscoveryWorker(new Logger(verbose));
|
|
30
|
-
await worker.RunAsync(repoRoot.FullName, workspace, outputPath);
|
|
30
|
+
await worker.RunAsync(repoRoot.FullName, workspace, outputPath.FullName);
|
|
31
31
|
}, RepoRootOption, WorkspaceOption, OutputOption, VerboseOption);
|
|
32
32
|
|
|
33
33
|
return command;
|
|
@@ -15,6 +15,7 @@ internal sealed class Program
|
|
|
15
15
|
{
|
|
16
16
|
FrameworkCheckCommand.GetCommand(setExitCode),
|
|
17
17
|
DiscoverCommand.GetCommand(setExitCode),
|
|
18
|
+
AnalyzeCommand.GetCommand(setExitCode),
|
|
18
19
|
UpdateCommand.GetCommand(setExitCode),
|
|
19
20
|
};
|
|
20
21
|
command.TreatUnmatchedTokensAsErrors = true;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
using System.Text;
|
|
2
|
+
using System.Xml.Linq;
|
|
3
|
+
|
|
4
|
+
using NuGetUpdater.Core;
|
|
5
|
+
using NuGetUpdater.Core.Analyze;
|
|
6
|
+
using NuGetUpdater.Core.Test;
|
|
7
|
+
using NuGetUpdater.Core.Test.Analyze;
|
|
8
|
+
using NuGetUpdater.Core.Test.Update;
|
|
9
|
+
|
|
10
|
+
using Xunit;
|
|
11
|
+
|
|
12
|
+
namespace NuGetUpdater.Cli.Test;
|
|
13
|
+
|
|
14
|
+
using TestFile = (string Path, string Content);
|
|
15
|
+
|
|
16
|
+
public partial class EntryPointTests
|
|
17
|
+
{
|
|
18
|
+
public class Analyze : AnalyzeWorkerTestBase
|
|
19
|
+
{
|
|
20
|
+
[Fact]
|
|
21
|
+
public async Task FindsUpdatedPackageAndReturnsTheCorrectData()
|
|
22
|
+
{
|
|
23
|
+
var repositoryXml = XElement.Parse("""<repository type="git" url="https://nuget.example.com/some.package" />""");
|
|
24
|
+
await RunAsync(path =>
|
|
25
|
+
[
|
|
26
|
+
"analyze",
|
|
27
|
+
"--repo-root",
|
|
28
|
+
path,
|
|
29
|
+
"--discovery-file-path",
|
|
30
|
+
Path.Join(path, "discovery.json"),
|
|
31
|
+
"--dependency-file-path",
|
|
32
|
+
Path.Join(path, "Some.Package.json"),
|
|
33
|
+
"--analysis-folder-path",
|
|
34
|
+
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
|
35
|
+
"--verbose",
|
|
36
|
+
],
|
|
37
|
+
packages: [
|
|
38
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0", additionalMetadata: [repositoryXml]),
|
|
39
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.1", "net8.0", additionalMetadata: [repositoryXml]),
|
|
40
|
+
],
|
|
41
|
+
dependencyName: "Some.Package",
|
|
42
|
+
initialFiles:
|
|
43
|
+
[
|
|
44
|
+
("discovery.json", """
|
|
45
|
+
{
|
|
46
|
+
"Path": "",
|
|
47
|
+
"IsSuccess": true,
|
|
48
|
+
"Projects": [
|
|
49
|
+
{
|
|
50
|
+
"FilePath": "project.csproj",
|
|
51
|
+
"Dependencies": [
|
|
52
|
+
{
|
|
53
|
+
"Name": "Microsoft.NET.Sdk",
|
|
54
|
+
"Version": null,
|
|
55
|
+
"Type": "MSBuildSdk",
|
|
56
|
+
"EvaluationResult": null,
|
|
57
|
+
"TargetFrameworks": null,
|
|
58
|
+
"IsDevDependency": false,
|
|
59
|
+
"IsDirect": false,
|
|
60
|
+
"IsTransitive": false,
|
|
61
|
+
"IsOverride": false,
|
|
62
|
+
"IsUpdate": false
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"Name": "Some.Package",
|
|
66
|
+
"Version": "1.0.0",
|
|
67
|
+
"Type": "PackageReference",
|
|
68
|
+
"EvaluationResult": {
|
|
69
|
+
"ResultType": "Success",
|
|
70
|
+
"OriginalValue": "1.0.0",
|
|
71
|
+
"EvaluatedValue": "1.0.0",
|
|
72
|
+
"RootPropertyName": null,
|
|
73
|
+
"ErrorMessage": null
|
|
74
|
+
},
|
|
75
|
+
"TargetFrameworks": [
|
|
76
|
+
"net8.0"
|
|
77
|
+
],
|
|
78
|
+
"IsDevDependency": false,
|
|
79
|
+
"IsDirect": true,
|
|
80
|
+
"IsTransitive": false,
|
|
81
|
+
"IsOverride": false,
|
|
82
|
+
"IsUpdate": false
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"IsSuccess": true,
|
|
86
|
+
"Properties": [
|
|
87
|
+
{
|
|
88
|
+
"Name": "TargetFramework",
|
|
89
|
+
"Value": "net8.0",
|
|
90
|
+
"SourceFilePath": "project.csproj"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"TargetFrameworks": [
|
|
94
|
+
"net8.0"
|
|
95
|
+
],
|
|
96
|
+
"ReferencedProjectPaths": []
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"DirectoryPackagesProps": null,
|
|
100
|
+
"GlobalJson": null,
|
|
101
|
+
"DotNetToolsJson": null
|
|
102
|
+
}
|
|
103
|
+
"""),
|
|
104
|
+
("Some.Package.json", """
|
|
105
|
+
{
|
|
106
|
+
"Name": "Some.Package",
|
|
107
|
+
"Version": "1.0.0",
|
|
108
|
+
"IsVulnerable": false,
|
|
109
|
+
"IgnoredVersions": [],
|
|
110
|
+
"Vulnerabilities": []
|
|
111
|
+
}
|
|
112
|
+
"""),
|
|
113
|
+
("project.csproj", """
|
|
114
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
115
|
+
<PropertyGroup>
|
|
116
|
+
<TargetFramework>net8.0</TargetFramework>
|
|
117
|
+
</PropertyGroup>
|
|
118
|
+
<ItemGroup>
|
|
119
|
+
<PackageReference Include="Some.Package" Version="1.0.0" />
|
|
120
|
+
</ItemGroup>
|
|
121
|
+
</Project>
|
|
122
|
+
"""),
|
|
123
|
+
],
|
|
124
|
+
expectedResult: new()
|
|
125
|
+
{
|
|
126
|
+
UpdatedVersion = "1.0.1",
|
|
127
|
+
CanUpdate = true,
|
|
128
|
+
VersionComesFromMultiDependencyProperty = false,
|
|
129
|
+
UpdatedDependencies =
|
|
130
|
+
[
|
|
131
|
+
new Dependency("Some.Package", "1.0.1", DependencyType.Unknown, TargetFrameworks: ["net8.0"], InfoUrl: "https://nuget.example.com/some.package")
|
|
132
|
+
],
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private static async Task RunAsync(Func<string, string[]> getArgs, string dependencyName, TestFile[] initialFiles, ExpectedAnalysisResult expectedResult, MockNuGetPackage[]? packages = null)
|
|
138
|
+
{
|
|
139
|
+
var actualResult = await RunAnalyzerAsync(dependencyName, initialFiles, async path =>
|
|
140
|
+
{
|
|
141
|
+
var sb = new StringBuilder();
|
|
142
|
+
var writer = new StringWriter(sb);
|
|
143
|
+
|
|
144
|
+
var originalOut = Console.Out;
|
|
145
|
+
var originalErr = Console.Error;
|
|
146
|
+
Console.SetOut(writer);
|
|
147
|
+
Console.SetError(writer);
|
|
148
|
+
|
|
149
|
+
try
|
|
150
|
+
{
|
|
151
|
+
await UpdateWorkerTestBase.MockNuGetPackagesInDirectory(packages, path);
|
|
152
|
+
var args = getArgs(path);
|
|
153
|
+
var result = await Program.Main(args);
|
|
154
|
+
if (result != 0)
|
|
155
|
+
{
|
|
156
|
+
throw new Exception($"Program exited with code {result}.\nOutput:\n\n{sb}");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
finally
|
|
160
|
+
{
|
|
161
|
+
Console.SetOut(originalOut);
|
|
162
|
+
Console.SetError(originalErr);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
ValidateAnalysisResult(expectedResult, actualResult);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using System.Text;
|
|
2
2
|
|
|
3
3
|
using NuGetUpdater.Core;
|
|
4
|
+
using NuGetUpdater.Core.Discover;
|
|
4
5
|
using NuGetUpdater.Core.Test;
|
|
5
6
|
using NuGetUpdater.Core.Test.Discover;
|
|
6
7
|
using NuGetUpdater.Core.Test.Update;
|
|
@@ -25,6 +26,8 @@ public partial class EntryPointTests
|
|
|
25
26
|
path,
|
|
26
27
|
"--workspace",
|
|
27
28
|
"path/to/some directory with spaces",
|
|
29
|
+
"--output",
|
|
30
|
+
Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
|
|
28
31
|
],
|
|
29
32
|
packages: [],
|
|
30
33
|
initialFiles:
|
|
@@ -42,7 +45,7 @@ public partial class EntryPointTests
|
|
|
42
45
|
],
|
|
43
46
|
expectedResult: new()
|
|
44
47
|
{
|
|
45
|
-
|
|
48
|
+
Path = "path/to/some directory with spaces",
|
|
46
49
|
Projects = [
|
|
47
50
|
new()
|
|
48
51
|
{
|
|
@@ -72,6 +75,8 @@ public partial class EntryPointTests
|
|
|
72
75
|
path,
|
|
73
76
|
"--workspace",
|
|
74
77
|
"/",
|
|
78
|
+
"--output",
|
|
79
|
+
Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
|
|
75
80
|
],
|
|
76
81
|
packages:
|
|
77
82
|
[
|
|
@@ -129,7 +134,7 @@ public partial class EntryPointTests
|
|
|
129
134
|
},
|
|
130
135
|
expectedResult: new()
|
|
131
136
|
{
|
|
132
|
-
|
|
137
|
+
Path = "",
|
|
133
138
|
Projects = [
|
|
134
139
|
new()
|
|
135
140
|
{
|
|
@@ -159,6 +164,8 @@ public partial class EntryPointTests
|
|
|
159
164
|
path,
|
|
160
165
|
"--workspace",
|
|
161
166
|
"path/to",
|
|
167
|
+
"--output",
|
|
168
|
+
Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
|
|
162
169
|
],
|
|
163
170
|
packages:
|
|
164
171
|
[
|
|
@@ -193,7 +200,7 @@ public partial class EntryPointTests
|
|
|
193
200
|
},
|
|
194
201
|
expectedResult: new()
|
|
195
202
|
{
|
|
196
|
-
|
|
203
|
+
Path = "path/to",
|
|
197
204
|
Projects = [
|
|
198
205
|
new()
|
|
199
206
|
{
|
|
@@ -224,6 +231,8 @@ public partial class EntryPointTests
|
|
|
224
231
|
path,
|
|
225
232
|
"--workspace",
|
|
226
233
|
workspacePath,
|
|
234
|
+
"--output",
|
|
235
|
+
Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName),
|
|
227
236
|
],
|
|
228
237
|
packages:
|
|
229
238
|
[
|
|
@@ -258,7 +267,7 @@ public partial class EntryPointTests
|
|
|
258
267
|
},
|
|
259
268
|
expectedResult: new()
|
|
260
269
|
{
|
|
261
|
-
|
|
270
|
+
Path = workspacePath,
|
|
262
271
|
Projects = [
|
|
263
272
|
new()
|
|
264
273
|
{
|
|
@@ -282,69 +291,72 @@ public partial class EntryPointTests
|
|
|
282
291
|
public async Task WithDuplicateDependenciesOfDifferentTypes()
|
|
283
292
|
{
|
|
284
293
|
await RunAsync(path =>
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
294
|
+
[
|
|
295
|
+
"discover",
|
|
296
|
+
"--repo-root",
|
|
297
|
+
path,
|
|
298
|
+
"--workspace",
|
|
299
|
+
"path/to",
|
|
300
|
+
"--output",
|
|
301
|
+
Path.Combine(path, DiscoveryWorker.DiscoveryResultFileName)
|
|
302
|
+
],
|
|
303
|
+
new[]
|
|
304
|
+
{
|
|
305
|
+
("path/to/my.csproj", """
|
|
306
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
307
|
+
<PropertyGroup>
|
|
308
|
+
<TargetFramework>net8.0</TargetFramework>
|
|
309
|
+
</PropertyGroup>
|
|
310
|
+
<ItemGroup>
|
|
311
|
+
<PackageReference Include="Newtonsoft.Json" Version="7.0.1" />
|
|
312
|
+
</ItemGroup>
|
|
313
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
314
|
+
</Project>
|
|
315
|
+
"""),
|
|
316
|
+
("path/Directory.Build.props", """
|
|
317
|
+
<Project>
|
|
318
|
+
<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' == 'true'">
|
|
319
|
+
<GlobalPackageReference Include="System.Text.Json" Version="8.0.3" />
|
|
320
|
+
</ItemGroup>
|
|
321
|
+
<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' != 'true'">
|
|
322
|
+
<PackageReference Include="System.Text.Json" Version="8.0.3" />
|
|
323
|
+
</ItemGroup>
|
|
324
|
+
</Project>
|
|
325
|
+
""")
|
|
326
|
+
},
|
|
327
|
+
expectedResult: new()
|
|
328
|
+
{
|
|
329
|
+
Path = "path/to",
|
|
330
|
+
Projects = [
|
|
331
|
+
new()
|
|
332
|
+
{
|
|
333
|
+
FilePath = "my.csproj",
|
|
334
|
+
TargetFrameworks = ["net8.0"],
|
|
335
|
+
ReferencedProjectPaths = [],
|
|
336
|
+
ExpectedDependencyCount = 2,
|
|
337
|
+
Dependencies = [
|
|
338
|
+
new("Newtonsoft.Json", "7.0.1", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
|
|
339
|
+
// $(ManagePackageVersionsCentrally) evaluates false by default, we only get a PackageReference
|
|
340
|
+
new("System.Text.Json", "8.0.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"])
|
|
341
|
+
],
|
|
342
|
+
Properties = [
|
|
343
|
+
new("TargetFramework", "net8.0", "path/to/my.csproj"),
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
new()
|
|
347
|
+
{
|
|
348
|
+
FilePath = "../Directory.Build.props",
|
|
349
|
+
ReferencedProjectPaths = [],
|
|
350
|
+
ExpectedDependencyCount = 2,
|
|
351
|
+
Dependencies = [
|
|
352
|
+
new("System.Text.Json", "8.0.3", DependencyType.PackageReference, IsDirect: true),
|
|
353
|
+
new("System.Text.Json", "8.0.3", DependencyType.GlobalPackageReference, IsDirect: true)
|
|
354
|
+
],
|
|
355
|
+
Properties = [],
|
|
356
|
+
}
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
);
|
|
348
360
|
}
|
|
349
361
|
|
|
350
362
|
private static async Task RunAsync(
|
|
@@ -44,19 +44,19 @@ public partial class EntryPointTests
|
|
|
44
44
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "my", "my.csproj", "{782E0C0A-10D3-444D-9640-263D03D2B20C}"
|
|
45
45
|
EndProject
|
|
46
46
|
Global
|
|
47
|
-
|
|
47
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
48
48
|
Debug|Any CPU = Debug|Any CPU
|
|
49
49
|
Release|Any CPU = Release|Any CPU
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
EndGlobalSection
|
|
51
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
52
52
|
{782E0C0A-10D3-444D-9640-263D03D2B20C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
53
53
|
{782E0C0A-10D3-444D-9640-263D03D2B20C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
54
54
|
{782E0C0A-10D3-444D-9640-263D03D2B20C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
55
55
|
{782E0C0A-10D3-444D-9640-263D03D2B20C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
EndGlobalSection
|
|
57
|
+
GlobalSection(SolutionProperties) = preSolution
|
|
58
58
|
HideSolutionNode = FALSE
|
|
59
|
-
|
|
59
|
+
EndGlobalSection
|
|
60
60
|
EndGlobal
|
|
61
61
|
"""),
|
|
62
62
|
("path/to/my.csproj", """
|
|
@@ -82,7 +82,7 @@ public partial class EntryPointTests
|
|
|
82
82
|
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
|
83
83
|
</packages>
|
|
84
84
|
""")
|
|
85
|
-
|
|
85
|
+
],
|
|
86
86
|
expectedFiles:
|
|
87
87
|
[
|
|
88
88
|
("path/to/my.csproj", """
|
|
@@ -253,7 +253,7 @@ public partial class EntryPointTests
|
|
|
253
253
|
"""),
|
|
254
254
|
("other-dir/Directory.Build.props", """
|
|
255
255
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
256
|
-
|
|
256
|
+
|
|
257
257
|
<ItemGroup>
|
|
258
258
|
<PackageReference Include="Some.Package" Version="6.1.0" />
|
|
259
259
|
</ItemGroup>
|
|
@@ -271,8 +271,7 @@ public partial class EntryPointTests
|
|
|
271
271
|
</ItemGroup>
|
|
272
272
|
</Project>
|
|
273
273
|
"""),
|
|
274
|
-
("some-dir/project1/project.csproj",
|
|
275
|
-
"""
|
|
274
|
+
("some-dir/project1/project.csproj", """
|
|
276
275
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
277
276
|
<PropertyGroup>
|
|
278
277
|
<OutputType>Exe</OutputType>
|
|
@@ -300,7 +299,7 @@ public partial class EntryPointTests
|
|
|
300
299
|
"""),
|
|
301
300
|
("other-dir/Directory.Build.props", """
|
|
302
301
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
303
|
-
|
|
302
|
+
|
|
304
303
|
<ItemGroup>
|
|
305
304
|
<PackageReference Include="Some.Package" Version="6.1.0" />
|
|
306
305
|
</ItemGroup>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
using System.Collections.Immutable;
|
|
2
|
+
|
|
3
|
+
namespace NuGetUpdater.Core.Analyze;
|
|
4
|
+
|
|
5
|
+
public record AnalysisResult
|
|
6
|
+
{
|
|
7
|
+
public required string UpdatedVersion { get; init; }
|
|
8
|
+
public bool CanUpdate { get; init; }
|
|
9
|
+
public bool VersionComesFromMultiDependencyProperty { get; init; }
|
|
10
|
+
public required ImmutableArray<Dependency> UpdatedDependencies { get; init; }
|
|
11
|
+
}
|