dependabot-nuget 0.280.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 +0 -3
- 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 +9 -9
- 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 +3 -3
- 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 +1 -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/Run/RunWorker.cs +2 -2
- 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 +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +11 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +11 -3
- 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 +11 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +1 -1
- 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 +1 -1
- 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 +14 -6
- 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 +144 -8
- 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 +10 -16
- metadata +12 -9
- 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
|
}
|
@@ -34,7 +34,6 @@ public partial class EntryPointTests
|
|
34
34
|
Path.Join(path, "Some.Package.json"),
|
35
35
|
"--analysis-folder-path",
|
36
36
|
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
37
|
-
"--verbose",
|
38
37
|
],
|
39
38
|
packages: [
|
40
39
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0", additionalMetadata: [repositoryXml]),
|
@@ -151,7 +150,6 @@ public partial class EntryPointTests
|
|
151
150
|
Path.Join(path, "some-global-tool.json"),
|
152
151
|
"--analysis-folder-path",
|
153
152
|
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
154
|
-
"--verbose",
|
155
153
|
],
|
156
154
|
packages:
|
157
155
|
[
|
@@ -239,7 +237,6 @@ public partial class EntryPointTests
|
|
239
237
|
Path.Join(path, "Some.MSBuild.Sdk.json"),
|
240
238
|
"--analysis-folder-path",
|
241
239
|
Path.Join(path, AnalyzeWorker.AnalysisDirectoryName),
|
242
|
-
"--verbose",
|
243
240
|
],
|
244
241
|
packages:
|
245
242
|
[
|
@@ -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,7 +24,7 @@ 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
|
}
|
@@ -213,7 +213,7 @@ public partial class AnalyzeWorker
|
|
213
213
|
ImmutableHashSet<string> packageIds,
|
214
214
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
215
215
|
NuGetContext nugetContext,
|
216
|
-
|
216
|
+
ILogger logger,
|
217
217
|
CancellationToken cancellationToken)
|
218
218
|
{
|
219
219
|
var versionResult = await VersionFinder.GetVersionsAsync(
|
@@ -239,7 +239,7 @@ public partial class AnalyzeWorker
|
|
239
239
|
NuGetVersion version,
|
240
240
|
bool findLowestVersion,
|
241
241
|
NuGetContext nugetContext,
|
242
|
-
|
242
|
+
ILogger logger,
|
243
243
|
CancellationToken cancellationToken)
|
244
244
|
{
|
245
245
|
var versionResult = await VersionFinder.GetVersionsAsync(
|
@@ -267,7 +267,7 @@ public partial class AnalyzeWorker
|
|
267
267
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
268
268
|
bool findLowestVersion,
|
269
269
|
NuGetContext nugetContext,
|
270
|
-
|
270
|
+
ILogger logger,
|
271
271
|
CancellationToken cancellationToken)
|
272
272
|
{
|
273
273
|
var versions = versionResult.GetVersions();
|
@@ -299,7 +299,7 @@ public partial class AnalyzeWorker
|
|
299
299
|
IEnumerable<NuGetVersion> orderedVersions,
|
300
300
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
301
301
|
NuGetContext nugetContext,
|
302
|
-
|
302
|
+
ILogger logger,
|
303
303
|
CancellationToken cancellationToken)
|
304
304
|
{
|
305
305
|
if (NuGetVersion.TryParse(versionString, out var currentVersion))
|
@@ -350,7 +350,7 @@ public partial class AnalyzeWorker
|
|
350
350
|
NuGetVersion currentVersion,
|
351
351
|
ImmutableArray<NuGetFramework> projectFrameworks,
|
352
352
|
NuGetContext nugetContext,
|
353
|
-
|
353
|
+
ILogger logger,
|
354
354
|
CancellationToken cancellationToken)
|
355
355
|
{
|
356
356
|
foreach (var packageId in packageIds)
|
@@ -376,7 +376,7 @@ public partial class AnalyzeWorker
|
|
376
376
|
ImmutableHashSet<string> packageIds,
|
377
377
|
NuGetVersion updatedVersion,
|
378
378
|
NuGetContext nugetContext,
|
379
|
-
|
379
|
+
ILogger logger,
|
380
380
|
CancellationToken cancellationToken)
|
381
381
|
{
|
382
382
|
// We need to find all projects which have the given dependency. Even in cases that they
|
@@ -459,7 +459,7 @@ public partial class AnalyzeWorker
|
|
459
459
|
}).ToImmutableArray();
|
460
460
|
}
|
461
461
|
|
462
|
-
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)
|
463
463
|
{
|
464
464
|
if (!Directory.Exists(analysisDirectory))
|
465
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,7 +25,7 @@ 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
|
}
|
@@ -125,7 +125,7 @@ public partial class DiscoveryWorker
|
|
125
125
|
/// Restores MSBuild SDKs from the given dependencies.
|
126
126
|
/// </summary>
|
127
127
|
/// <returns>Returns `true` when SDKs were restored successfully.</returns>
|
128
|
-
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)
|
129
129
|
{
|
130
130
|
var msbuildSdks = dependencies
|
131
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);
|
@@ -12,7 +12,7 @@ namespace NuGetUpdater.Core.Run;
|
|
12
12
|
public class RunWorker
|
13
13
|
{
|
14
14
|
private readonly IApiHandler _apiHandler;
|
15
|
-
private readonly
|
15
|
+
private readonly ILogger _logger;
|
16
16
|
|
17
17
|
internal static readonly JsonSerializerOptions SerializerOptions = new()
|
18
18
|
{
|
@@ -21,7 +21,7 @@ public class RunWorker
|
|
21
21
|
Converters = { new JsonStringEnumConverter() },
|
22
22
|
};
|
23
23
|
|
24
|
-
public RunWorker(IApiHandler apiHandler,
|
24
|
+
public RunWorker(IApiHandler apiHandler, ILogger logger)
|
25
25
|
{
|
26
26
|
_apiHandler = apiHandler;
|
27
27
|
_logger = logger;
|
@@ -116,19 +116,19 @@ internal static class BindingRedirectManager
|
|
116
116
|
return null;
|
117
117
|
}
|
118
118
|
|
119
|
-
var configFilePath = Path.GetFullPath(Path.Combine(directoryPath,
|
119
|
+
var configFilePath = Path.GetFullPath(Path.Combine(directoryPath, GetValue(configFile)));
|
120
120
|
var configFileContents = await File.ReadAllTextAsync(configFilePath);
|
121
121
|
return new ConfigurationFile(configFilePath, configFileContents, false);
|
122
122
|
|
123
|
-
static string
|
123
|
+
static string GetValue(IXmlElementSyntax element)
|
124
124
|
{
|
125
|
-
var content = element.
|
125
|
+
var content = element.GetAttributeValue("Include");
|
126
126
|
if (!string.IsNullOrEmpty(content))
|
127
127
|
{
|
128
128
|
return content;
|
129
129
|
}
|
130
130
|
|
131
|
-
content = element.
|
131
|
+
content = element.GetContentValue();
|
132
132
|
if (!string.IsNullOrEmpty(content))
|
133
133
|
{
|
134
134
|
return content;
|
@@ -139,7 +139,7 @@ internal static class BindingRedirectManager
|
|
139
139
|
|
140
140
|
static bool IsConfigFile(IXmlElementSyntax element)
|
141
141
|
{
|
142
|
-
var content =
|
142
|
+
var content = GetValue(element);
|
143
143
|
if (content is null)
|
144
144
|
{
|
145
145
|
return false;
|
@@ -8,7 +8,7 @@ internal static class DotNetToolsJsonUpdater
|
|
8
8
|
string dependencyName,
|
9
9
|
string previousDependencyVersion,
|
10
10
|
string newDependencyVersion,
|
11
|
-
|
11
|
+
ILogger logger)
|
12
12
|
{
|
13
13
|
if (!MSBuildHelper.TryGetDotNetToolsJsonPath(repoRootPath, workspacePath, out var dotnetToolsJsonPath))
|
14
14
|
{
|
@@ -8,7 +8,7 @@ internal static class GlobalJsonUpdater
|
|
8
8
|
string dependencyName,
|
9
9
|
string previousDependencyVersion,
|
10
10
|
string newDependencyVersion,
|
11
|
-
|
11
|
+
ILogger logger)
|
12
12
|
{
|
13
13
|
if (!MSBuildHelper.TryGetGlobalJsonPath(repoRootPath, workspacePath, out var globalJsonPath))
|
14
14
|
{
|