11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4- #nullable disable
5-
64using Microsoft . DotNet . Cli . Commands . Tool ;
75using Microsoft . DotNet . Cli . ToolManifest ;
86using Microsoft . DotNet . Cli . ToolPackage ;
97using Microsoft . DotNet . Cli . Utils ;
108using Microsoft . Extensions . EnvironmentAbstractions ;
11- using NuGet . DependencyResolver ;
129using NuGet . Frameworks ;
1310
1411namespace Microsoft . DotNet . Cli . CommandFactory . CommandResolution ;
1512
1613internal class LocalToolsCommandResolver (
17- ToolManifestFinder toolManifest = null ,
18- ILocalToolsResolverCache localToolsResolverCache = null ,
19- IFileSystem fileSystem = null ,
20- string currentWorkingDirectory = null ) : ICommandResolver
14+ ToolManifestFinder ? toolManifest = null ,
15+ ILocalToolsResolverCache ? localToolsResolverCache = null ,
16+ IFileSystem ? fileSystem = null ,
17+ string ? currentWorkingDirectory = null ) : ICommandResolver
2118{
2219 private readonly ToolManifestFinder _toolManifest = toolManifest ?? new ToolManifestFinder ( new DirectoryPath ( currentWorkingDirectory ?? Directory . GetCurrentDirectory ( ) ) ) ;
2320 private readonly ILocalToolsResolverCache _localToolsResolverCache = localToolsResolverCache ?? new LocalToolsResolverCache ( ) ;
2421 private readonly IFileSystem _fileSystem = fileSystem ?? new FileSystemWrapper ( ) ;
2522 private const string LeadingDotnetPrefix = "dotnet-" ;
2623
27- public CommandSpec ResolveStrict ( CommandResolverArguments arguments , bool allowRollForward = false )
24+ public CommandSpec ? ResolveStrict ( CommandResolverArguments arguments , bool allowRollForward = false )
2825 {
2926 if ( arguments == null || string . IsNullOrWhiteSpace ( arguments . CommandName ) )
3027 {
@@ -42,7 +39,7 @@ public CommandSpec ResolveStrict(CommandResolverArguments arguments, bool allowR
4239 return resolveResult ;
4340 }
4441
45- public CommandSpec Resolve ( CommandResolverArguments arguments )
42+ public CommandSpec ? Resolve ( CommandResolverArguments arguments )
4643 {
4744 if ( arguments == null || string . IsNullOrWhiteSpace ( arguments . CommandName ) )
4845 {
@@ -69,7 +66,7 @@ public CommandSpec Resolve(CommandResolverArguments arguments)
6966 return GetPackageCommandSpecUsingMuxer ( arguments , new ToolCommandName ( arguments . CommandName ) ) ;
7067 }
7168
72- private CommandSpec GetPackageCommandSpecUsingMuxer ( CommandResolverArguments arguments ,
69+ private CommandSpec ? GetPackageCommandSpecUsingMuxer ( CommandResolverArguments arguments ,
7370 ToolCommandName toolCommandName , bool allowRollForward = false )
7471 {
7572 if ( ! _toolManifest . TryFind ( toolCommandName , out var toolManifestPackage ) )
@@ -93,7 +90,7 @@ private CommandSpec GetPackageCommandSpecUsingMuxer(CommandResolverArguments arg
9390 }
9491
9592 return ToolCommandSpecCreator . CreateToolCommandSpec ( toolCommand . Name . Value , toolCommand . Executable . Value , toolCommand . Runner ,
96- toolManifestPackage . RollForward || allowRollForward , arguments . CommandArguments ) ;
93+ toolManifestPackage . RollForward || allowRollForward , arguments . CommandArguments ?? [ ] ) ;
9794 }
9895 else
9996 {
0 commit comments