-
Notifications
You must be signed in to change notification settings - Fork 588
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
2148: Add dotnet nuget push command and arguments #2229
2148: Add dotnet nuget push command and arguments #2229
Conversation
Question is if we can somehow re-use existing code. Similar to how we did in |
Yes, it would be nice to share some code. I can't seem to find what code is shared between |
And some refactoring was done to use a common structure (in order to convert between old and new structure and have a single logic): I'm not sure if this is viable approach for NuGet. Honestly I'm not all to happy with the |
Release 5.12.1
…nn/FAKE into 2148-add.dotnet.nuget.push.delete
I'm trying to figure out if anything can be shared. The NuGet.exe module combines pack and push in the same arguments. However, |
The |
But I guess we could split the pack and push specific parts of the current |
Maybe we need to update DotNet.Cli.PackOptions to hold some that new pack specific record as well then. Like Authors, Tags, Description etc. |
…with DotNetCli nuget push. Add new push function which takes this record instead of NuGetParams.
…li args. Make push function usable from DotNet.Cli module. Remove the old publish function.
@matthid Not sure I'm going in the right direction here, but at least most of the code is shared between the two modules. Another thing, the |
…ommon Options. Rename options in NuGet module to NuGetPushParams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I'm lacking a better approach, I think the one proposed in this PR is fine. I have added some detail comments which we need to address/answer
src/app/Fake.DotNet.NuGet/NuGet.fs
Outdated
@@ -39,6 +39,18 @@ type NugetSymbolPackage = | |||
/// Build a symbol package using the nuspec file | |||
| Nuspec = 2 | |||
|
|||
type ToolOptions = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add short docs for this or mark it internal
/private
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make it internal, since I'm not reusing it in the DotNet module anymore.
src/app/Fake.DotNet.NuGet/NuGet.fs
Outdated
param.Timeout |> Option.map string |> Option.map (sprintf "-Timeout %s") | ||
] | ||
|> List.choose id | ||
|> String.concat " " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the proper APIs for this (Arguments.ofList
for example)?
src/app/Fake.DotNet.NuGet/NuGet.fs
Outdated
|
||
module Private = | ||
/// For internal use | ||
let rec push (options : ToolOptions) (parameters : NuGetPushParams) (toCliArgs : NuGetPushParams -> string) nupkg = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this only currently handles dotnet nuget push
we should think about other commands as well.
- Do we add all operations by adding new functions one by one on demand?
- Should we use a similar model as
dotnet
uses where you have a "low"-levelDotNet.exec
function where others likedotnet test
build on top. - Something different?
Personally I'd lean to something along the second option, but if there are good reasons to do it differently I'm all ears. Note that I'm not proposing to implement all options in this PR, but whatever we decide to release should be extendible later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second option sounds like a good idea so I'll not reuse this in the DotNet
module, but rather use the exec
in there instead. I'll for now make this NuGet.Private.push
internal instead and maybe it could be generalized to be the low level one?
src/app/Fake.DotNet.NuGet/NuGet.fs
Outdated
|
||
try | ||
let result = | ||
let tracing = Process.shouldEnableProcessTracing() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we really want to disable tracing we should use the corresponding CreateProcess
functionality. We should remove this class to Process.shouldEnableProcessTracing
to reduce side effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I just copied some other code in the same module. I can just remove it I guess.
Sorry for the late reply.
I think I have answered this in the comment regarding which API surface we want, we could try a similar approach as
To be honest I don't know. I'm not really using this module myself :) |
Make NuGet.Private.push private Use DotNet.exec for DotNet.nugetPush instead of NuGet.Private.push.
Changes look reasonable, is there anything left as this is still marked WIP? |
Not really, I guess I was to tired to notice 😁 |
How do I edit the title from a phone...hmmm... |
I kind of feel the NuGet module is obsolete now that there is dotnet CLI. But I guess it might be a bit drastic to deprecate it? |
Indeed, but we could do it eventually. Sorry, just one more request, can we add a simple test for this (ie similar to others a single test checking if command line generation is OK)? |
Yes, I can add a test. |
- Add nupkg to arguments - Convert timeout TimeSpan to seconds
Added some tests and fixed some bugs. I also added retry like in the NuGet module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again. One more minor nit (but I can do that myself once I'm ready to merge this in a couple of days, so don't worry):
I think we should add a bit of docs for NuGetPushOptions
and a single example changing some parameters on top of the DotNet.nugetPush
function (just like we have for the DotNet.msbuild
function), because people might not realize how to change nested records in F#.
Add
dotnet nuget push
commandFixes: #2148