dependabot-nuget 0.279.0 → 0.281.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +4 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +4 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +4 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +4 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +3 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +3 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +17 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +5 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +10 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NativeResult.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdateNotPossible.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +9 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/UpdateNotPossibleException.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +5 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +4 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +12 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +29 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +14 -16
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +22 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +6 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs +7 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestLogger.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/ExpectedUpdateOperationResult.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +15 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +223 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +16 -16
- data/lib/dependabot/nuget/file_updater.rb +1 -0
- data/lib/dependabot/nuget/native_helpers.rb +15 -19
- metadata +13 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3afe0ac22f324c8dacf2c16437998a6b22ad23ae21092f3889d3973eb4a59ddb
|
4
|
+
data.tar.gz: e3aca7ae87df62bb56d264c5eb88e6f14fc9077e3c3c853cd769e34488d95cfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25c4209f6aab5ae958a092b34c9ab9a5d1473e1322646dcd7f1a7d0e753e681b975516fe5b416ca62c7ba7be219590f17c4541f4635bbe3355b9213e3ff587d
|
7
|
+
data.tar.gz: e058837c6034711c21fd672774b3c37940f0f286af89fbd1e4cdefa9af415647f926bd626f13356bae3304f1e18b98cfcc67390f492ce0d8b06fa4bbf301356b
|
@@ -11,7 +11,6 @@ internal static class AnalyzeCommand
|
|
11
11
|
internal static readonly Option<FileInfo> DependencyFilePathOption = new("--dependency-file-path") { IsRequired = true };
|
12
12
|
internal static readonly Option<FileInfo> DiscoveryFilePathOption = new("--discovery-file-path") { IsRequired = true };
|
13
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
14
|
|
16
15
|
internal static Command GetCommand(Action<int> setExitCode)
|
17
16
|
{
|
@@ -20,17 +19,16 @@ internal static class AnalyzeCommand
|
|
20
19
|
RepoRootOption,
|
21
20
|
DependencyFilePathOption,
|
22
21
|
DiscoveryFilePathOption,
|
23
|
-
AnalysisFolderOption
|
24
|
-
VerboseOption
|
22
|
+
AnalysisFolderOption
|
25
23
|
};
|
26
24
|
|
27
25
|
command.TreatUnmatchedTokensAsErrors = true;
|
28
26
|
|
29
|
-
command.SetHandler(async (repoRoot, discoveryPath, dependencyPath, analysisDirectory
|
27
|
+
command.SetHandler(async (repoRoot, discoveryPath, dependencyPath, analysisDirectory) =>
|
30
28
|
{
|
31
|
-
var worker = new AnalyzeWorker(new
|
29
|
+
var worker = new AnalyzeWorker(new ConsoleLogger());
|
32
30
|
await worker.RunAsync(repoRoot.FullName, discoveryPath.FullName, dependencyPath.FullName, analysisDirectory.FullName);
|
33
|
-
}, RepoRootOption, DiscoveryFilePathOption, DependencyFilePathOption, AnalysisFolderOption
|
31
|
+
}, RepoRootOption, DiscoveryFilePathOption, DependencyFilePathOption, AnalysisFolderOption);
|
34
32
|
|
35
33
|
return command;
|
36
34
|
}
|
@@ -10,7 +10,6 @@ internal static class DiscoverCommand
|
|
10
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
12
|
internal static readonly Option<FileInfo> OutputOption = new("--output") { IsRequired = true };
|
13
|
-
internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
|
14
13
|
|
15
14
|
internal static Command GetCommand(Action<int> setExitCode)
|
16
15
|
{
|
@@ -18,17 +17,16 @@ internal static class DiscoverCommand
|
|
18
17
|
{
|
19
18
|
RepoRootOption,
|
20
19
|
WorkspaceOption,
|
21
|
-
OutputOption
|
22
|
-
VerboseOption
|
20
|
+
OutputOption
|
23
21
|
};
|
24
22
|
|
25
23
|
command.TreatUnmatchedTokensAsErrors = true;
|
26
24
|
|
27
|
-
command.SetHandler(async (repoRoot, workspace, outputPath
|
25
|
+
command.SetHandler(async (repoRoot, workspace, outputPath) =>
|
28
26
|
{
|
29
|
-
var worker = new DiscoveryWorker(new
|
27
|
+
var worker = new DiscoveryWorker(new ConsoleLogger());
|
30
28
|
await worker.RunAsync(repoRoot.FullName, workspace, outputPath.FullName);
|
31
|
-
}, RepoRootOption, WorkspaceOption, OutputOption
|
29
|
+
}, RepoRootOption, WorkspaceOption, OutputOption);
|
32
30
|
|
33
31
|
return command;
|
34
32
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
using System;
|
2
1
|
using System.CommandLine;
|
3
2
|
|
4
3
|
using NuGetUpdater.Core;
|
@@ -10,25 +9,23 @@ internal static class FrameworkCheckCommand
|
|
10
9
|
{
|
11
10
|
internal static readonly Option<string[]> ProjectTfmsOption = new("--project-tfms") { IsRequired = true, AllowMultipleArgumentsPerToken = true };
|
12
11
|
internal static readonly Option<string[]> PackageTfmsOption = new("--package-tfms") { IsRequired = true, AllowMultipleArgumentsPerToken = true };
|
13
|
-
internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
|
14
12
|
|
15
13
|
internal static Command GetCommand(Action<int> setExitCode)
|
16
14
|
{
|
17
15
|
Command command = new("framework-check", "Checks that a project's target frameworks are satisfied by the target frameworks supported by a package.")
|
18
16
|
{
|
19
17
|
ProjectTfmsOption,
|
20
|
-
PackageTfmsOption
|
21
|
-
VerboseOption
|
18
|
+
PackageTfmsOption
|
22
19
|
};
|
23
20
|
|
24
21
|
command.TreatUnmatchedTokensAsErrors = true;
|
25
22
|
|
26
|
-
command.SetHandler((projectTfms, packageTfms
|
23
|
+
command.SetHandler((projectTfms, packageTfms) =>
|
27
24
|
{
|
28
|
-
setExitCode(CompatibilityChecker.IsCompatible(projectTfms, packageTfms, new
|
25
|
+
setExitCode(CompatibilityChecker.IsCompatible(projectTfms, packageTfms, new ConsoleLogger())
|
29
26
|
? 0
|
30
27
|
: 1);
|
31
|
-
}, ProjectTfmsOption, PackageTfmsOption
|
28
|
+
}, ProjectTfmsOption, PackageTfmsOption);
|
32
29
|
|
33
30
|
return command;
|
34
31
|
}
|
@@ -13,7 +13,6 @@ internal static class RunCommand
|
|
13
13
|
internal static readonly Option<string> JobIdOption = new("--job-id") { IsRequired = true };
|
14
14
|
internal static readonly Option<FileInfo> OutputPathOption = new("--output-path") { IsRequired = true };
|
15
15
|
internal static readonly Option<string> BaseCommitShaOption = new("--base-commit-sha") { IsRequired = true };
|
16
|
-
internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
|
17
16
|
|
18
17
|
internal static Command GetCommand(Action<int> setExitCode)
|
19
18
|
{
|
@@ -24,18 +23,17 @@ internal static class RunCommand
|
|
24
23
|
ApiUrlOption,
|
25
24
|
JobIdOption,
|
26
25
|
OutputPathOption,
|
27
|
-
BaseCommitShaOption
|
28
|
-
VerboseOption
|
26
|
+
BaseCommitShaOption
|
29
27
|
};
|
30
28
|
|
31
29
|
command.TreatUnmatchedTokensAsErrors = true;
|
32
30
|
|
33
|
-
command.SetHandler(async (jobPath, repoContentsPath, apiUrl, jobId, outputPath, baseCommitSha
|
31
|
+
command.SetHandler(async (jobPath, repoContentsPath, apiUrl, jobId, outputPath, baseCommitSha) =>
|
34
32
|
{
|
35
33
|
var apiHandler = new HttpApiHandler(apiUrl.ToString(), jobId);
|
36
|
-
var worker = new RunWorker(apiHandler, new
|
34
|
+
var worker = new RunWorker(apiHandler, new ConsoleLogger());
|
37
35
|
await worker.RunAsync(jobPath, repoContentsPath, baseCommitSha, outputPath);
|
38
|
-
}, JobPathOption, RepoContentsPathOption, ApiUrlOption, JobIdOption, OutputPathOption, BaseCommitShaOption
|
36
|
+
}, JobPathOption, RepoContentsPathOption, ApiUrlOption, JobIdOption, OutputPathOption, BaseCommitShaOption);
|
39
37
|
|
40
38
|
return command;
|
41
39
|
}
|
@@ -12,7 +12,6 @@ internal static class UpdateCommand
|
|
12
12
|
internal static readonly Option<string> NewVersionOption = new("--new-version") { IsRequired = true };
|
13
13
|
internal static readonly Option<string> PreviousVersionOption = new("--previous-version") { IsRequired = true };
|
14
14
|
internal static readonly Option<bool> IsTransitiveOption = new("--transitive", getDefaultValue: () => false);
|
15
|
-
internal static readonly Option<bool> VerboseOption = new("--verbose", getDefaultValue: () => false);
|
16
15
|
internal static readonly Option<string?> ResultOutputPathOption = new("--result-output-path", getDefaultValue: () => null);
|
17
16
|
|
18
17
|
internal static Command GetCommand(Action<int> setExitCode)
|
@@ -25,18 +24,17 @@ internal static class UpdateCommand
|
|
25
24
|
NewVersionOption,
|
26
25
|
PreviousVersionOption,
|
27
26
|
IsTransitiveOption,
|
28
|
-
VerboseOption,
|
29
27
|
ResultOutputPathOption
|
30
28
|
};
|
31
29
|
|
32
30
|
command.TreatUnmatchedTokensAsErrors = true;
|
33
31
|
|
34
|
-
command.SetHandler(async (repoRoot, solutionOrProjectFile, dependencyName, newVersion, previousVersion, isTransitive,
|
32
|
+
command.SetHandler(async (repoRoot, solutionOrProjectFile, dependencyName, newVersion, previousVersion, isTransitive, resultOutputPath) =>
|
35
33
|
{
|
36
|
-
var worker = new UpdaterWorker(new
|
34
|
+
var worker = new UpdaterWorker(new ConsoleLogger());
|
37
35
|
await worker.RunAsync(repoRoot.FullName, solutionOrProjectFile.FullName, dependencyName, previousVersion, newVersion, isTransitive, resultOutputPath);
|
38
36
|
setExitCode(0);
|
39
|
-
}, RepoRootOption, SolutionOrProjectFileOption, DependencyNameOption, NewVersionOption, PreviousVersionOption, IsTransitiveOption,
|
37
|
+
}, RepoRootOption, SolutionOrProjectFileOption, DependencyNameOption, NewVersionOption, PreviousVersionOption, IsTransitiveOption, ResultOutputPathOption);
|
40
38
|
|
41
39
|
return command;
|
42
40
|
}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
using System.Text;
|
2
|
+
using System.Text.Json;
|
2
3
|
using System.Xml.Linq;
|
3
4
|
|
4
5
|
using NuGetUpdater.Core;
|
5
6
|
using NuGetUpdater.Core.Analyze;
|
7
|
+
using NuGetUpdater.Core.Discover;
|
6
8
|
using NuGetUpdater.Core.Test;
|
7
9
|
using NuGetUpdater.Core.Test.Analyze;
|
8
10
|
using NuGetUpdater.Core.Test.Update;
|
@@ -32,7 +34,6 @@ public partial class EntryPointTests
|
|
32
34
|
Path.Join(path, "Some.Package.json"),
|
33
35
|
"--analysis-folder-path",
|
34
36
|
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
35
|
-
"--verbose",
|
36
37
|
],
|
37
38
|
packages: [
|
38
39
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0", additionalMetadata: [repositoryXml]),
|
@@ -149,7 +150,6 @@ public partial class EntryPointTests
|
|
149
150
|
Path.Join(path, "some-global-tool.json"),
|
150
151
|
"--analysis-folder-path",
|
151
152
|
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
152
|
-
"--verbose",
|
153
153
|
],
|
154
154
|
packages:
|
155
155
|
[
|
@@ -237,7 +237,6 @@ public partial class EntryPointTests
|
|
237
237
|
Path.Join(path, "Some.MSBuild.Sdk.json"),
|
238
238
|
"--analysis-folder-path",
|
239
239
|
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
240
|
-
"--verbose",
|
241
240
|
],
|
242
241
|
packages:
|
243
242
|
[
|
@@ -334,6 +333,11 @@ public partial class EntryPointTests
|
|
334
333
|
Console.SetOut(originalOut);
|
335
334
|
Console.SetError(originalErr);
|
336
335
|
}
|
336
|
+
|
337
|
+
var resultPath = Path.Join(path, AnalyzeWorker.AnalysisDirectoryName, $"{dependencyName}.json");
|
338
|
+
var resultJson = await File.ReadAllTextAsync(resultPath);
|
339
|
+
var resultObject = JsonSerializer.Deserialize<AnalysisResult>(resultJson, DiscoveryWorker.SerializerOptions);
|
340
|
+
return resultObject!;
|
337
341
|
});
|
338
342
|
|
339
343
|
ValidateAnalysisResult(expectedResult, actualResult);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
using System.Text;
|
2
|
+
using System.Text.Json;
|
2
3
|
|
3
4
|
using NuGetUpdater.Core;
|
4
5
|
using NuGetUpdater.Core.Discover;
|
@@ -390,6 +391,11 @@ public partial class EntryPointTests
|
|
390
391
|
Console.SetOut(originalOut);
|
391
392
|
Console.SetError(originalErr);
|
392
393
|
}
|
394
|
+
|
395
|
+
var resultPath = Path.Join(path, DiscoveryWorker.DiscoveryResultFileName);
|
396
|
+
var resultJson = await File.ReadAllTextAsync(resultPath);
|
397
|
+
var resultObject = JsonSerializer.Deserialize<WorkspaceDiscoveryResult>(resultJson, DiscoveryWorker.SerializerOptions);
|
398
|
+
return resultObject!;
|
393
399
|
});
|
394
400
|
|
395
401
|
ValidateWorkspaceResult(expectedResult, actualResult);
|
@@ -28,7 +28,6 @@ public partial class EntryPointTests
|
|
28
28
|
args.AddRange(projectTfms.Split(' ', StringSplitOptions.TrimEntries));
|
29
29
|
args.Add("--package-tfms");
|
30
30
|
args.AddRange(packageTfms.Split(' ', StringSplitOptions.TrimEntries));
|
31
|
-
args.Add("--verbose");
|
32
31
|
|
33
32
|
var actual = await Program.Main(args.ToArray());
|
34
33
|
|
@@ -105,8 +105,7 @@ public partial class EntryPointTests
|
|
105
105
|
"--output-path",
|
106
106
|
Path.Combine(tempDirectory.DirectoryPath, "output.json"),
|
107
107
|
"--base-commit-sha",
|
108
|
-
"BASE-COMMIT-SHA"
|
109
|
-
"--verbose"
|
108
|
+
"BASE-COMMIT-SHA"
|
110
109
|
};
|
111
110
|
|
112
111
|
var output = new StringBuilder();
|
@@ -128,8 +128,7 @@ public partial class EntryPointTests
|
|
128
128
|
"--new-version",
|
129
129
|
"13.0.1",
|
130
130
|
"--previous-version",
|
131
|
-
"7.0.1"
|
132
|
-
"--verbose"
|
131
|
+
"7.0.1"
|
133
132
|
],
|
134
133
|
packages:
|
135
134
|
[
|
@@ -207,8 +206,7 @@ public partial class EntryPointTests
|
|
207
206
|
"--new-version",
|
208
207
|
"6.6.1",
|
209
208
|
"--previous-version",
|
210
|
-
"6.1.0"
|
211
|
-
"--verbose"
|
209
|
+
"6.1.0"
|
212
210
|
],
|
213
211
|
packages:
|
214
212
|
[
|
@@ -364,8 +362,7 @@ public partial class EntryPointTests
|
|
364
362
|
"--new-version",
|
365
363
|
"13.0.1",
|
366
364
|
"--previous-version",
|
367
|
-
"7.0.1"
|
368
|
-
"--verbose"
|
365
|
+
"7.0.1"
|
369
366
|
];
|
370
367
|
|
371
368
|
// verify base run
|
@@ -16,7 +16,7 @@ public partial class AnalyzeWorker
|
|
16
16
|
{
|
17
17
|
public const string AnalysisDirectoryName = "./.dependabot/analysis";
|
18
18
|
|
19
|
-
private readonly
|
19
|
+
private readonly ILogger _logger;
|
20
20
|
|
21
21
|
internal static readonly JsonSerializerOptions SerializerOptions = new()
|
22
22
|
{
|
@@ -24,12 +24,19 @@ public partial class AnalyzeWorker
|
|
24
24
|
Converters = { new JsonStringEnumConverter(), new RequirementConverter() },
|
25
25
|
};
|
26
26
|
|
27
|
-
public AnalyzeWorker(
|
27
|
+
public AnalyzeWorker(ILogger logger)
|
28
28
|
{
|
29
29
|
_logger = logger;
|
30
30
|
}
|
31
31
|
|
32
32
|
public async Task RunAsync(string repoRoot, string discoveryPath, string dependencyPath, string analysisDirectory)
|
33
|
+
{
|
34
|
+
var analysisResult = await RunWithErrorHandlingAsync(repoRoot, discoveryPath, dependencyPath);
|
35
|
+
var dependencyInfo = await DeserializeJsonFileAsync<DependencyInfo>(dependencyPath, nameof(DependencyInfo));
|
36
|
+
await WriteResultsAsync(analysisDirectory, dependencyInfo.Name, analysisResult, _logger);
|
37
|
+
}
|
38
|
+
|
39
|
+
internal async Task<AnalysisResult> RunWithErrorHandlingAsync(string repoRoot, string discoveryPath, string dependencyPath)
|
33
40
|
{
|
34
41
|
AnalysisResult analysisResult;
|
35
42
|
var discovery = await DeserializeJsonFileAsync<WorkspaceDiscoveryResult>(discoveryPath, nameof(WorkspaceDiscoveryResult));
|
@@ -54,7 +61,7 @@ public partial class AnalyzeWorker
|
|
54
61
|
};
|
55
62
|
}
|
56
63
|
|
57
|
-
|
64
|
+
return analysisResult;
|
58
65
|
}
|
59
66
|
|
60
67
|
public async Task<AnalysisResult> RunAsync(string repoRoot, WorkspaceDiscoveryResult discovery, DependencyInfo dependencyInfo)
|
@@ -206,7 +213,7 @@ public partial class AnalyzeWorker
|
|
206
213
|
ImmutableHashSet<string> packageIds,
|
207
214
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
208
215
|
NuGetContext nugetContext,
|
209
|
-
|
216
|
+
ILogger logger,
|
210
217
|
CancellationToken cancellationToken)
|
211
218
|
{
|
212
219
|
var versionResult = await VersionFinder.GetVersionsAsync(
|
@@ -232,7 +239,7 @@ public partial class AnalyzeWorker
|
|
232
239
|
NuGetVersion version,
|
233
240
|
bool findLowestVersion,
|
234
241
|
NuGetContext nugetContext,
|
235
|
-
|
242
|
+
ILogger logger,
|
236
243
|
CancellationToken cancellationToken)
|
237
244
|
{
|
238
245
|
var versionResult = await VersionFinder.GetVersionsAsync(
|
@@ -260,7 +267,7 @@ public partial class AnalyzeWorker
|
|
260
267
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
261
268
|
bool findLowestVersion,
|
262
269
|
NuGetContext nugetContext,
|
263
|
-
|
270
|
+
ILogger logger,
|
264
271
|
CancellationToken cancellationToken)
|
265
272
|
{
|
266
273
|
var versions = versionResult.GetVersions();
|
@@ -292,7 +299,7 @@ public partial class AnalyzeWorker
|
|
292
299
|
IEnumerable<NuGetVersion> orderedVersions,
|
293
300
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
294
301
|
NuGetContext nugetContext,
|
295
|
-
|
302
|
+
ILogger logger,
|
296
303
|
CancellationToken cancellationToken)
|
297
304
|
{
|
298
305
|
if (NuGetVersion.TryParse(versionString, out var currentVersion))
|
@@ -343,7 +350,7 @@ public partial class AnalyzeWorker
|
|
343
350
|
NuGetVersion currentVersion,
|
344
351
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
345
352
|
NuGetContext nugetContext,
|
346
|
-
|
353
|
+
ILogger logger,
|
347
354
|
CancellationToken cancellationToken)
|
348
355
|
{
|
349
356
|
foreach (var packageId in packageIds)
|
@@ -369,7 +376,7 @@ public partial class AnalyzeWorker
|
|
369
376
|
ImmutableHashSet<string> packageIds,
|
370
377
|
NuGetVersion updatedVersion,
|
371
378
|
NuGetContext nugetContext,
|
372
|
-
|
379
|
+
ILogger logger,
|
373
380
|
CancellationToken cancellationToken)
|
374
381
|
{
|
375
382
|
// We need to find all projects which have the given dependency. Even in cases that they
|
@@ -452,7 +459,7 @@ public partial class AnalyzeWorker
|
|
452
459
|
}).ToImmutableArray();
|
453
460
|
}
|
454
461
|
|
455
|
-
internal static async Task WriteResultsAsync(string analysisDirectory, string dependencyName, AnalysisResult result,
|
462
|
+
internal static async Task WriteResultsAsync(string analysisDirectory, string dependencyName, AnalysisResult result, ILogger logger)
|
456
463
|
{
|
457
464
|
if (!Directory.Exists(analysisDirectory))
|
458
465
|
{
|
@@ -21,7 +21,7 @@ internal static class CompatibilityChecker
|
|
21
21
|
PackageIdentity package,
|
22
22
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
23
23
|
NuGetContext nugetContext,
|
24
|
-
|
24
|
+
ILogger logger,
|
25
25
|
CancellationToken cancellationToken)
|
26
26
|
{
|
27
27
|
var (isDevDependency, packageFrameworks) = await GetPackageInfoAsync(
|
@@ -37,7 +37,7 @@ internal static class CompatibilityChecker
|
|
37
37
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
38
38
|
bool isDevDependency,
|
39
39
|
ImmutableArray<NuGetFramework> packageFrameworks,
|
40
|
-
|
40
|
+
ILogger logger)
|
41
41
|
{
|
42
42
|
// development dependencies are packages such as analyzers which need to be compatible with the compiler not the
|
43
43
|
// project itself, but some packages that report themselves as development dependencies still contain target
|
@@ -14,7 +14,7 @@ internal static class DependencyFinder
|
|
14
14
|
ImmutableHashSet<string> packageIds,
|
15
15
|
NuGetVersion version,
|
16
16
|
NuGetContext nugetContext,
|
17
|
-
|
17
|
+
ILogger logger,
|
18
18
|
CancellationToken cancellationToken)
|
19
19
|
{
|
20
20
|
var versionString = version.ToNormalizedString();
|
@@ -19,10 +19,10 @@ internal record NuGetContext : IDisposable
|
|
19
19
|
public ISettings Settings { get; }
|
20
20
|
public IMachineWideSettings MachineWideSettings { get; }
|
21
21
|
public ImmutableArray<PackageSource> PackageSources { get; }
|
22
|
-
public ILogger Logger { get; }
|
22
|
+
public NuGet.Common.ILogger Logger { get; }
|
23
23
|
public string TempPackageDirectory { get; }
|
24
24
|
|
25
|
-
public NuGetContext(string? currentDirectory = null, ILogger? logger = null)
|
25
|
+
public NuGetContext(string? currentDirectory = null, NuGet.Common.ILogger? logger = null)
|
26
26
|
{
|
27
27
|
SourceCacheContext = new SourceCacheContext();
|
28
28
|
PackageDownloadContext = new PackageDownloadContext(SourceCacheContext);
|
@@ -15,7 +15,7 @@ internal static class VersionFinder
|
|
15
15
|
string packageId,
|
16
16
|
NuGetVersion currentVersion,
|
17
17
|
NuGetContext nugetContext,
|
18
|
-
|
18
|
+
ILogger logger,
|
19
19
|
CancellationToken cancellationToken)
|
20
20
|
{
|
21
21
|
var versionFilter = CreateVersionFilter(currentVersion);
|
@@ -26,7 +26,7 @@ internal static class VersionFinder
|
|
26
26
|
public static Task<VersionResult> GetVersionsAsync(
|
27
27
|
DependencyInfo dependencyInfo,
|
28
28
|
NuGetContext nugetContext,
|
29
|
-
|
29
|
+
ILogger logger,
|
30
30
|
CancellationToken cancellationToken)
|
31
31
|
{
|
32
32
|
var packageId = dependencyInfo.Name;
|
@@ -42,7 +42,7 @@ internal static class VersionFinder
|
|
42
42
|
NuGetVersion currentVersion,
|
43
43
|
Func<NuGetVersion, bool> versionFilter,
|
44
44
|
NuGetContext nugetContext,
|
45
|
-
|
45
|
+
ILogger logger,
|
46
46
|
CancellationToken cancellationToken)
|
47
47
|
{
|
48
48
|
var includePrerelease = currentVersion.IsPrerelease;
|
@@ -130,7 +130,7 @@ internal static class VersionFinder
|
|
130
130
|
IEnumerable<string> packageIds,
|
131
131
|
NuGetVersion version,
|
132
132
|
NuGetContext nugetContext,
|
133
|
-
|
133
|
+
ILogger logger,
|
134
134
|
CancellationToken cancellationToken)
|
135
135
|
{
|
136
136
|
foreach (var packageId in packageIds)
|
@@ -148,7 +148,7 @@ internal static class VersionFinder
|
|
148
148
|
string packageId,
|
149
149
|
NuGetVersion version,
|
150
150
|
NuGetContext nugetContext,
|
151
|
-
|
151
|
+
ILogger logger,
|
152
152
|
CancellationToken cancellationToken)
|
153
153
|
{
|
154
154
|
var includePrerelease = version.IsPrerelease;
|
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
|
|
4
4
|
|
5
5
|
internal static class DirectoryPackagesPropsDiscovery
|
6
6
|
{
|
7
|
-
public static DirectoryPackagesPropsDiscoveryResult? Discover(string repoRootPath, string workspacePath, ImmutableArray<ProjectDiscoveryResult> projectResults,
|
7
|
+
public static DirectoryPackagesPropsDiscoveryResult? Discover(string repoRootPath, string workspacePath, ImmutableArray<ProjectDiscoveryResult> projectResults, ILogger logger)
|
8
8
|
{
|
9
9
|
var projectResult = projectResults.FirstOrDefault(
|
10
10
|
p => p.Properties.FirstOrDefault(prop => prop.Name.Equals("ManagePackageVersionsCentrally", StringComparison.OrdinalIgnoreCase)) is Property property
|
@@ -16,7 +16,7 @@ public partial class DiscoveryWorker
|
|
16
16
|
{
|
17
17
|
public const string DiscoveryResultFileName = "./.dependabot/discovery.json";
|
18
18
|
|
19
|
-
private readonly
|
19
|
+
private readonly ILogger _logger;
|
20
20
|
private readonly HashSet<string> _processedProjectPaths = new(StringComparer.OrdinalIgnoreCase); private readonly HashSet<string> _restoredMSBuildSdks = new(StringComparer.OrdinalIgnoreCase);
|
21
21
|
|
22
22
|
internal static readonly JsonSerializerOptions SerializerOptions = new()
|
@@ -25,12 +25,18 @@ public partial class DiscoveryWorker
|
|
25
25
|
Converters = { new JsonStringEnumConverter() },
|
26
26
|
};
|
27
27
|
|
28
|
-
public DiscoveryWorker(
|
28
|
+
public DiscoveryWorker(ILogger logger)
|
29
29
|
{
|
30
30
|
_logger = logger;
|
31
31
|
}
|
32
32
|
|
33
33
|
public async Task RunAsync(string repoRootPath, string workspacePath, string outputPath)
|
34
|
+
{
|
35
|
+
var result = await RunWithErrorHandlingAsync(repoRootPath, workspacePath);
|
36
|
+
await WriteResultsAsync(repoRootPath, outputPath, result);
|
37
|
+
}
|
38
|
+
|
39
|
+
internal async Task<WorkspaceDiscoveryResult> RunWithErrorHandlingAsync(string repoRootPath, string workspacePath)
|
34
40
|
{
|
35
41
|
WorkspaceDiscoveryResult result;
|
36
42
|
try
|
@@ -49,7 +55,7 @@ public partial class DiscoveryWorker
|
|
49
55
|
};
|
50
56
|
}
|
51
57
|
|
52
|
-
|
58
|
+
return result;
|
53
59
|
}
|
54
60
|
|
55
61
|
internal async Task<WorkspaceDiscoveryResult> RunAsync(string repoRootPath, string workspacePath)
|
@@ -119,7 +125,7 @@ public partial class DiscoveryWorker
|
|
119
125
|
/// Restores MSBuild SDKs from the given dependencies.
|
120
126
|
/// </summary>
|
121
127
|
/// <returns>Returns `true` when SDKs were restored successfully.</returns>
|
122
|
-
private async Task<bool> TryRestoreMSBuildSdksAsync(string repoRootPath, string workspacePath, ImmutableArray<Dependency> dependencies,
|
128
|
+
private async Task<bool> TryRestoreMSBuildSdksAsync(string repoRootPath, string workspacePath, ImmutableArray<Dependency> dependencies, ILogger logger)
|
123
129
|
{
|
124
130
|
var msbuildSdks = dependencies
|
125
131
|
.Where(d => d.Type == DependencyType.MSBuildSdk && !string.IsNullOrEmpty(d.Version))
|
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
|
|
4
4
|
|
5
5
|
internal static class DotNetToolsJsonDiscovery
|
6
6
|
{
|
7
|
-
public static DotNetToolsJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath,
|
7
|
+
public static DotNetToolsJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath, ILogger logger)
|
8
8
|
{
|
9
9
|
if (!MSBuildHelper.TryGetDotNetToolsJsonPath(repoRootPath, workspacePath, out var dotnetToolsJsonPath))
|
10
10
|
{
|
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
|
|
4
4
|
|
5
5
|
internal static class GlobalJsonDiscovery
|
6
6
|
{
|
7
|
-
public static GlobalJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath,
|
7
|
+
public static GlobalJsonDiscoveryResult? Discover(string repoRootPath, string workspacePath, ILogger logger)
|
8
8
|
{
|
9
9
|
if (!MSBuildHelper.TryGetGlobalJsonPath(repoRootPath, workspacePath, out var globalJsonPath))
|
10
10
|
{
|
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.Discover;
|
|
4
4
|
|
5
5
|
internal static class PackagesConfigDiscovery
|
6
6
|
{
|
7
|
-
public static PackagesConfigDiscoveryResult? Discover(string workspacePath, string projectPath,
|
7
|
+
public static PackagesConfigDiscoveryResult? Discover(string workspacePath, string projectPath, ILogger logger)
|
8
8
|
{
|
9
9
|
if (!NuGetHelper.TryGetPackagesConfigFile(projectPath, out var packagesConfigPath))
|
10
10
|
{
|
@@ -6,7 +6,7 @@ namespace NuGetUpdater.Core.Discover;
|
|
6
6
|
|
7
7
|
internal static class SdkProjectDiscovery
|
8
8
|
{
|
9
|
-
public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverAsync(string repoRootPath, string workspacePath, string projectPath,
|
9
|
+
public static async Task<ImmutableArray<ProjectDiscoveryResult>> DiscoverAsync(string repoRootPath, string workspacePath, string projectPath, ILogger logger)
|
10
10
|
{
|
11
11
|
// Determine which targets and props files contribute to the build.
|
12
12
|
var (buildFiles, projectTargetFrameworks) = await MSBuildHelper.LoadBuildFilesAndTargetFrameworksAsync(repoRootPath, projectPath);
|
@@ -97,7 +97,7 @@ internal static class SdkProjectDiscovery
|
|
97
97
|
return results.ToImmutable();
|
98
98
|
}
|
99
99
|
|
100
|
-
private static async Task<ImmutableArray<Dependency>> GetTransitiveDependencies(string repoRootPath, string projectPath, ImmutableArray<string> tfms, ImmutableArray<Dependency> directDependencies,
|
100
|
+
private static async Task<ImmutableArray<Dependency>> GetTransitiveDependencies(string repoRootPath, string projectPath, ImmutableArray<string> tfms, ImmutableArray<Dependency> directDependencies, ILogger logger)
|
101
101
|
{
|
102
102
|
Dictionary<string, Dependency> transitiveDependencies = new(StringComparer.OrdinalIgnoreCase);
|
103
103
|
foreach (var tfm in tfms)
|
@@ -4,10 +4,10 @@ namespace NuGetUpdater.Core;
|
|
4
4
|
|
5
5
|
internal sealed class DotNetToolsJsonBuildFile : JsonBuildFile
|
6
6
|
{
|
7
|
-
public static DotNetToolsJsonBuildFile Open(string basePath, string path,
|
7
|
+
public static DotNetToolsJsonBuildFile Open(string basePath, string path, ILogger logger)
|
8
8
|
=> new(basePath, path, File.ReadAllText(path), logger);
|
9
9
|
|
10
|
-
public DotNetToolsJsonBuildFile(string basePath, string path, string contents,
|
10
|
+
public DotNetToolsJsonBuildFile(string basePath, string path, string contents, ILogger logger)
|
11
11
|
: base(basePath, path, contents, logger)
|
12
12
|
{
|
13
13
|
}
|
@@ -4,10 +4,10 @@ namespace NuGetUpdater.Core;
|
|
4
4
|
|
5
5
|
internal sealed class GlobalJsonBuildFile : JsonBuildFile
|
6
6
|
{
|
7
|
-
public static GlobalJsonBuildFile Open(string basePath, string path,
|
7
|
+
public static GlobalJsonBuildFile Open(string basePath, string path, ILogger logger)
|
8
8
|
=> new(basePath, path, File.ReadAllText(path), logger);
|
9
9
|
|
10
|
-
public GlobalJsonBuildFile(string basePath, string path, string contents,
|
10
|
+
public GlobalJsonBuildFile(string basePath, string path, string contents, ILogger logger)
|
11
11
|
: base(basePath, path, contents, logger)
|
12
12
|
{
|
13
13
|
}
|
@@ -8,9 +8,9 @@ namespace NuGetUpdater.Core;
|
|
8
8
|
internal abstract class JsonBuildFile : BuildFile<string>
|
9
9
|
{
|
10
10
|
protected Lazy<JsonNode?> Node;
|
11
|
-
private readonly
|
11
|
+
private readonly ILogger logger;
|
12
12
|
|
13
|
-
public JsonBuildFile(string repoRootPath, string path, string contents,
|
13
|
+
public JsonBuildFile(string repoRootPath, string path, string contents, ILogger logger)
|
14
14
|
: base(repoRootPath, path, contents)
|
15
15
|
{
|
16
16
|
Node = new Lazy<JsonNode?>(() => null);
|
@@ -4,7 +4,7 @@ namespace NuGetUpdater.Core.FrameworkChecker;
|
|
4
4
|
|
5
5
|
public class CompatibilityChecker
|
6
6
|
{
|
7
|
-
public static bool IsCompatible(string[] projectTfms, string[] packageTfms,
|
7
|
+
public static bool IsCompatible(string[] projectTfms, string[] packageTfms, ILogger logger)
|
8
8
|
{
|
9
9
|
var projectFrameworks = projectTfms.Select(ParseFramework);
|
10
10
|
var packageFrameworks = packageTfms.Select(ParseFramework);
|