-
Notifications
You must be signed in to change notification settings - Fork 290
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
[vcpkg] Add semantic handling for nuget_version with two-segment versions #1549
base: main
Are you sure you want to change the base?
Conversation
Did NuGet emit a warning or something that we are suppressing that we should be reporting instead rather than trying to guess what the resulting file name will be? Do we know we are resolving the situation in the same way NuGet does? |
Warnings and behavior with NuGet: This change is not intended to suppress any warnings or errors emitted by Consistency with NuGet: The logic implemented here mimics NuGet's expected behavior by appending .0 to versions with only a period (e.g. 1.2 → 1.2.0). To confirm consistency, I have manually tested the results against |
So the existing behavior is "if the user enters 1.2 that fails when we try to invoke NuGet?"
NuGet's command line appends the .0? |
No, vcpkg will not fail if you pass |
This looks fine to me, but will consult the team. |
But would it fail for a user trying to use nuget.exe directly? I guess what I'm saying is that I think we should match nuget.exe's behavior here. If nuget.exe fails, then we should turn this into an error rather than trying to fix it. If nuget.exe fixes it up somehow, we need to make sure that the fixup we apply exactly matches what nuget.exe does. If we are fixing it up somewhere else in the tool, then we should move that fixup out here rather than implementing a different version of it again.
OK, so the console output is incorrect. What if the user enters something like "1", do they get "1.0.0"?
I guess, what I want to see before we make a change like this is an understanding of where the extra .0 came from. Did nuget.exe do that? Did we? |
To be clear, is nuget doing that, or is somewhere else in vcpkg doing that? |
According to the NuGet package version reference, NuGet supports four version segments (Major.Minor.Patch.Revision), and only requires the definition of the Major segment, while the other segments are optional and default to zero. Therefore, version numbers 1, 1.0, 1.0.0, and 1.0.0.0 are all considered equal.
Yes, according to the above NuGet version processing rules, the user input
According to the Semantic Versioning specification (SemVer), the standard version number format is |
This behavior is the norm for For some other norms of Nuget, such as pre-release version identification(like: |
Description:
This PR introduces a minor enhancement to handle the
nuget_version
field more effectively when exporting NuGet packages. Specifically:Reason for Change:
Changes Made:
Testing:
Impact:
This change ensures better alignment with NuGet's versioning requirements and reduces common user errors when specifying a version.
Fix vcpkg issue: microsoft/vcpkg#18543
@GreyCat Could you please test this PR? :)
cc @BillyONeal