-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of dotnet nuget add|remove|list|etc... source
#3206
Conversation
…ndline.xplat.dll sources
…M and non BuildRTM
…py technique back (mac tests?)
… as expected in outerbuild.
Does this PR fix NuGet/Home#6051 as well? |
doesn't fix it...but starts laying the foundation. added comment into #6051 |
All checks have passed! Will merge once approved. (@dominoFire & @dtivel have been re-reviewing) |
Changed some error strings to remove Please, per guidelines. Updating docs to use string without "please" too. (from feedback NuGet/NuGet.Client#3206 (comment))
Did some follow up on this feedback in this PR: #3244 |
…ource` commit (#3244) Fixes: NuGet/Home#9143 As part of #3206, there was feedback that came that was good to consider, but not before commiting to 5.5 codebase.
Bug
Fixes: NuGet/Home#4126
Regression: No
Spec link: https://github.com/NuGet/Home/blob/dev/designs/DotNet-Sources-Support.md
Fix
Breaking Changes
Move and rename type : NuGet.CommandLine!NuGet.CommandLine.CommandLineException --> NuGet.Commands!NuGet.Commands.CommandException
(discussed this change with Nikolche…NuGet.CommandLine is not a library. Ok to move types from there…)
NuGet.CommandLine\Commands\SourcesCommand.cs
Use new SourceArgs type, in common with NuGet.CommandLine.Xplat usage too.
NuGetCommandLine.csproj
Changed ILMergeNuGetExe Target to:
Merge in each languages NuGet.Commands.resources.dll into NuGet.exe so that localization still works.
It used to be that NuGet.exe strings were all localized in the .resx file directly. (each string had ~13 different languages directly in the string table. NuGet localization process has not been able to deal with that since at least Feb 2016.
Since we are moving some code and strings from NuGet.CommandLine to NuGet.Commands, we opted to go through normal localization process (build .resources.dll) and then add them to the ILMerged nuget.exe
NuGet.CommandLine\NuGetResources.resx
Delete a bunch of strings… the english ones are moving to NuGet.Commands.dll
The other language ones are no longer necessary. See ILMerge note above.
Commands.xml
A data format to define verbs/commands args/options.
(a verb has a noun after it. A command doesn't.)
This code change only uses verbs.
CommandParsers.tt/.cs
Codegen engine to parse commands.xml and create a Parser for each command.
Verbs.cs/.tt
CodeGen engine to create the code for help/command parsing for all the Verbs. Based on data in commands.cs
CommandOutputLogger.cs
On dotnet.exe codepaths, we want to use the logger, but don't like the prefixes outputed in standard scenarios.�So, we've made this class support both modes.
Using console.writeline was another option considered and discussed with nikolche.
NuGet.CommandLine.Xplat\Program.cs
Verbosity wasn't functional before - tracked by dotnet-nuget doesn't support verbosity #6374
RegisterCommands() is now done as part of InitializeApp()
NuGet.Commands\CommandArgs\VerbArgs.cs/.tt - via CodeGen
AddSourceArgs/RemoveSourcesArgs/etc…
SourcesCommands\SourceRunners.cs --> Main logic to run all the commands. Used to be in NuGet.CommandLine\Commands\SourcesCommands.cs
NuGet.Configuration\PackageSource\PackageSourceProvider.cs
In order to support creating a default sourceName when you call "dotnet nuget add source https://foo.com", I added a new API to find all named sources that match a prefix pattern. (called from sourceRunners.cs)
Testing/Validation
Tests Added: Yes