Added extract_regex_match function and updated NuGetProvider#1418
Added extract_regex_match function and updated NuGetProvider#1418kazssym wants to merge 2 commits intomicrosoft:mainfrom
extract_regex_match function and updated NuGetProvider#1418Conversation
|
I tested locally with the Japanese localization. Please confirm it is OK. |
b967d9e to
461e478
Compare
A new function `extract_regex_match` has been added to the `vcpkg` namespace in `tools.cpp`. This function performs a regex search on an output string and returns the first match or a formatted error message. The `NuGetProvider` struct has been updated to replace the `extract_prefixed_nonwhitespace` function call with the new `extract_regex_match` function. This change enhances the flexibility and robustness of version extraction by using a regex match instead of a fixed prefix.
461e478 to
54e563b
Compare
BillyONeal
left a comment
There was a problem hiding this comment.
The whole reason extract_prefixed_nonwhitespace exists is that we are trying to break the dependency on std::regex because all major implementations of that are awful. Only the 'fake XML parsing' thing still uses it, and that entire component's days are numbered as there is no longer any reason to have a separate vcpkgTools.xml now that the bash bootstrap script no longer looks at it.
Can you write code that implements this instead and a comment with the example non-English output with which it is expected to work?
Alternately, should we be telling NuGet we want locale-independent output for this test somehow?
Thank you. The issue this pull request tries to resolve is nuget.exe's output is now locale-dependent and no longer has a fixed prefix. A sample is Possible alternatives would be either
Which one is better? |
|
I found the |
|
Setting the |
|
It works for me:
|
Hmm, you used the |
|
Rewrote this PR in #1451. |
|
Thanks! |
A new function
extract_regex_matchhas been added to thevcpkgnamespace intools.cpp. This function performs a regex search on an output string and returns the first match or a formatted error message.The
NuGetProviderstruct has been updated to replace theextract_prefixed_nonwhitespacefunction call with the newextract_regex_matchfunction. This change enhances the flexibility and robustness of version extraction by using a regex match instead of a fixed prefix.Fixes microsoft/vcpkg#38940