Skip to content

Commit f85f664

Browse files
committed
[FIX] tool-update: Use config options
1 parent 2cf5317 commit f85f664

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateGlobalOrToolPathCommand.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.Extensions.EnvironmentAbstractions;
1313
using NuGet.Versioning;
1414
using Microsoft.DotNet.Cli.ToolPackage;
15+
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
1516

1617
namespace Microsoft.DotNet.Tools.Tool.Update
1718
{
@@ -38,6 +39,8 @@ internal class ToolUpdateGlobalOrToolPathCommand : CommandBase
3839
private readonly IEnumerable<string> _forwardRestoreArguments;
3940
private readonly string _packageVersion;
4041

42+
internal readonly RestoreActionConfig _restoreActionConfig;
43+
4144
public ToolUpdateGlobalOrToolPathCommand(ParseResult parseResult,
4245
CreateToolPackageStoresAndDownloaderAndUninstaller createToolPackageStoreDownloaderUninstaller = null,
4346
CreateShellShimRepository createShellShimRepository = null,
@@ -60,6 +63,11 @@ public ToolUpdateGlobalOrToolPathCommand(ParseResult parseResult,
6063
_createShellShimRepository =
6164
createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository;
6265

66+
_restoreActionConfig = new RestoreActionConfig(DisableParallel: parseResult.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption),
67+
NoCache: parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption),
68+
IgnoreFailedSources: parseResult.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
69+
Interactive: parseResult.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
70+
6371
_reporter = (reporter ?? Reporter.Output);
6472
_errorReporter = (reporter ?? Reporter.Error);
6573
}
@@ -111,7 +119,8 @@ public override int Execute()
111119
versionRange: versionRange,
112120
targetFramework: _framework,
113121
verbosity: _verbosity,
114-
isGlobalTool: true
122+
isGlobalTool: true,
123+
restoreActionConfig: _restoreActionConfig
115124
);
116125

117126
EnsureVersionIsHigher(oldPackageNullable, newInstalledPackage);

src/Cli/dotnet/commands/dotnet-tool/update/ToolUpdateLocalCommand.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.CommandLine;
55
using Microsoft.DotNet.Cli;
6+
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
67
using Microsoft.DotNet.Cli.ToolPackage;
78
using Microsoft.DotNet.Cli.Utils;
89
using Microsoft.DotNet.ToolManifest;
@@ -26,6 +27,8 @@ internal class ToolUpdateLocalCommand : CommandBase
2627
private readonly PackageId _packageId;
2728
private readonly string _explicitManifestFile;
2829

30+
internal readonly RestoreActionConfig _restoreActionConfig;
31+
2932
public ToolUpdateLocalCommand(
3033
ParseResult parseResult,
3134
IToolPackageDownloader toolPackageDownloader = null,
@@ -59,7 +62,12 @@ public ToolUpdateLocalCommand(
5962
_toolManifestEditor = toolManifestEditor ?? new ToolManifestEditor();
6063
_localToolsResolverCache = localToolsResolverCache ?? new LocalToolsResolverCache();
6164

62-
_toolLocalPackageInstaller = new ToolInstallLocalInstaller(parseResult, toolPackageDownloader);
65+
_restoreActionConfig = new RestoreActionConfig(DisableParallel: parseResult.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption),
66+
NoCache: parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption),
67+
IgnoreFailedSources: parseResult.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
68+
Interactive: parseResult.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
69+
70+
_toolLocalPackageInstaller = new ToolInstallLocalInstaller(parseResult, toolPackageDownloader, _restoreActionConfig);
6371
_toolInstallLocalCommand = new Lazy<ToolInstallLocalCommand>(
6472
() => new ToolInstallLocalCommand(
6573
parseResult,

0 commit comments

Comments
 (0)