Discover plugins installed using Net tools#5990
Discover plugins installed using Net tools#5990Nigusu-Allehu merged 47 commits intodev-feature-dot-net-tool-plugin-supportfrom
Conversation
test/NuGet.Core.Tests/NuGet.Protocol.Tests/Plugins/PluginDiscovererTests.cs
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| [PlatformFact(Platform.Windows)] | ||
| public void GetNetToolsPluginFiles_WithNuGetPluginPaths_ReturnsPluginsInNuGetPluginPathOnly() |
There was a problem hiding this comment.
Test priority of the discovery methods we have. This test makes sure we prioritize the environmental variables.
85141d8 to
3eab1a7
Compare
kartheekp-ms
left a comment
There was a problem hiding this comment.
Great progress. Left few comments on the new changes proposed.
jgonz120
left a comment
There was a problem hiding this comment.
This looks fine to me. There were a couple of instances where you're checking for null results from private/internal methods which don't return null.
test/NuGet.Core.Tests/NuGet.Protocol.Tests/Plugins/PluginDiscovererTests.cs
Outdated
Show resolved
Hide resolved
| File.Create(pluginFilePath); | ||
|
|
||
| // Remove execute permissions | ||
| var process = new Process(); |
There was a problem hiding this comment.
nit: There is an opportunity to refactor here because we set/remove execute permissions for files in all the new tests. I think we can create a private utility method and invoke it from the tests as needed. Please feel free to address it a follow-up issue.
| process.StartInfo.UseShellExecute = false; | ||
| process.StartInfo.RedirectStandardOutput = true; | ||
| process.Start(); | ||
| process.WaitForExit(); |
There was a problem hiding this comment.
Given that Process.WaitForExit waits indefinitely for the process to exit, while addressing this comment you might want to consider this code by changing it to the following:
Assert.True(process.WaitForExit(1000), userMessage: "some string that helps to troubleshoot the issue");With this approach, the test fails gracefully if the process doesn't complete on time for any unknown reason.
Bug
Fixes: NuGet/Home#13740
Description
This PR makes sure NuGet discovers credential providers installed using .NET tools.
dotnet tool install <provider package name> --globalshould install the tool and add its path to thePATHenvironmental varibale. Iterate through all the paths inPATHand all the files in the path to find the plugins. By design, we expect these plugins to be namednuget-plugin*.Plugin discovery method
The discovery is done based on which environmental variable has been specified
NUGET_NETFX_PLUGIN_PATHSorNUGET_NETCORE_PLUGIN_PATHShave been specified, use the old discovery method to look up non dotnet tools plugins in the paths added in the env variable.NUGET_NETFX_PLUGIN_PATHSandNUGET_NETCORE_PLUGIN_PATHShave not been specifiedNUGET_PLUGIN_PATHSspecified,NUGET_PLUGIN_PATHSnot specified,Default discovery method
PATHenv variable, and search for executablenuget-plugin-*filesPR Checklist