-
Notifications
You must be signed in to change notification settings - Fork 352
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
Adjust the algorithm in GetVersionForSingleSegment #7769
Adjust the algorithm in GetVersionForSingleSegment #7769
Conversation
GetVersionForSingleSegment assumes that if we find a fully formed major.minor.patch in the name of a file, followed by something that is not part of the version, that is definitely the version of the file. However, there are instances where there are two well formed major.minor.patch versions in the file name. For example: `Microsoft.NET.Workload.Mono.ToolChain.Manifest-6.0.100.Msi.x64.6.0.0-rc.1.21380.2.symbols.nupkg`. Mono puts the Sdk version in the name of their packages, in addition to the version of the package itself. GetVersionForSingleSegment sees the 6.0.100 followed by .Msi, recognizes that .Msi is not part of a major.minor.patch, and returns 6.0.100, without considering that there is considerably more in the file name that should be considered. This change adds a dictionary to track every potential version in a segment, and where in the segment the potential version was found. It then will return the version that occurs the latest in the segment.
src/Microsoft.DotNet.VersionTools/tests/BuildManifest/VersionIdentiferTests.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.VersionTools/lib/src/BuildManifest/VersionIdentifier.cs
Outdated
Show resolved
Hide resolved
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... think this works? It's shockingly complicated code to find some numbers in a string, but I think I understand it. I'm not sure what order things are in, but I feel like the dictionary probably isn't necessary, since it's always just the last one that's been found, so you could record that? But I could be wrong.
I did the dictionary thing because of |
This pulls in the fix made here dotnet/arcade#7769, which is necessary for an internal build, which pushes symbol packages to a nuget feed. The version identification is critical there because the version is a separate element of the azdo download path. This contrasts with public builds, where symbol packages end up in blob storage and no version identification is necessary.
This pulls in the fix made here dotnet/arcade#7769, which is necessary for an internal build, which pushes symbol packages to a nuget feed. The version identification is critical there because the version is a separate element of the azdo download path. This contrasts with public builds, where symbol packages end up in blob storage and no version identification is necessary.
GetVersionForSingleSegment assumes that if we find a fully formed major.minor.patch in the name of a file, followed by something that is not part of the version, that is definitely the version of the file. However, there are instances where there are two well formed major.minor.patch versions in the file name. For example:
Microsoft.NET.Workload.Mono.ToolChain.Manifest-6.0.100.Msi.x64.6.0.0-rc.1.21380.2.symbols.nupkg
. Mono puts the Sdk version in the name of their packages, in addition to the version of the package itself. GetVersionForSingleSegment sees the 6.0.100 followed by .Msi, recognizes that .Msi is not part of a major.minor.patch, and returns 6.0.100, without considering that there is considerably more in the file name that should be considered.This change adds a dictionary to track every potential version in a segment, and where in the segment the potential version was found. It then will return the version that occurs the latest in the segment.
To double check: