Skip to content
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

Merged
merged 62 commits into from
Feb 6, 2020

Conversation

rrelyea
Copy link
Contributor

@rrelyea rrelyea commented Jan 24, 2020

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

Rob Relyea added 30 commits January 24, 2020 12:08
@nkolev92
Copy link
Member

nkolev92 commented Feb 5, 2020

Does this PR fix NuGet/Home#6051 as well?
If so, please add a fixes: NuGet/Home#6051 comment in the body of the PR.

@rrelyea
Copy link
Contributor Author

rrelyea commented Feb 5, 2020

Does this PR fix NuGet/Home#6051 as well?
If so, please add a fixes: NuGet/Home#6051 comment in the body of the PR.

doesn't fix it...but starts laying the foundation. added comment into #6051

@rrelyea
Copy link
Contributor Author

rrelyea commented Feb 5, 2020

All checks have passed! Will merge once approved. (@dominoFire & @dtivel have been re-reviewing)

@rrelyea rrelyea merged commit a746cd6 into dev Feb 6, 2020
rrelyea pushed a commit to NuGet/docs.microsoft.com-nuget that referenced this pull request Feb 18, 2020
Changed some error strings to remove Please, per guidelines.
Updating docs to use string without "please" too.
(from feedback NuGet/NuGet.Client#3206 (comment))
@rrelyea rrelyea deleted the dev-rrelyea-sourcesStepByStep2 branch February 18, 2020 23:33
@rrelyea
Copy link
Contributor Author

rrelyea commented Feb 19, 2020

Did some follow up on this feedback in this PR: #3244

rrelyea pushed a commit that referenced this pull request Feb 20, 2020
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add dotnet nuget <add|remove|update|disable|enable|list> source command
5 participants