diff options
| author | Victor Romero <romerosanchezv@gmail.com> | 2020-12-07 09:10:23 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-07 09:10:23 -0800 |
| commit | 53e6588e9d4529033092c9adb43e317968b23712 (patch) | |
| tree | bc5a9147306095438899c88aee48b43c5ffde539 /toolsrc/include | |
| parent | 066c6fd712a3b7015388de644e44faf9774f3641 (diff) | |
| download | vcpkg-53e6588e9d4529033092c9adb43e317968b23712.tar.gz vcpkg-53e6588e9d4529033092c9adb43e317968b23712.zip | |
[vcpkg] Add SemVer and Date versioning schemes (#14889)
* [vcpkg] Add semver versioning scheme
* Remove unnecessary code
* Fix SemVer comparison and add sorting test
* Add date scheme
* PR comments
* Use a different column for date and semver schemes.
* Use locale agnostic conversion to long
* Add tests for version scheme change
* Validate version strings before parsing
* Format
* Improve error messages
* PR comments
* PR comments pt. 2
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/versions.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg/versions.h b/toolsrc/include/vcpkg/versions.h index 09df15366..19b5546ea 100644 --- a/toolsrc/include/vcpkg/versions.h +++ b/toolsrc/include/vcpkg/versions.h @@ -6,6 +6,14 @@ namespace vcpkg::Versions { using Version = VersionT; + enum class VerComp + { + unk, + lt, + eq, + gt, + }; + enum class Scheme { Relaxed, @@ -32,6 +40,42 @@ namespace vcpkg::Versions std::size_t operator()(const VersionSpec& key) const; }; + struct RelaxedVersion + { + std::string original_string; + std::vector<uint64_t> version; + + static ExpectedS<RelaxedVersion> from_string(const std::string& str); + }; + + struct SemanticVersion + { + std::string original_string; + std::string version_string; + std::string prerelease_string; + + std::vector<uint64_t> version; + std::vector<std::string> identifiers; + + static ExpectedS<SemanticVersion> from_string(const std::string& str); + }; + + struct DateVersion + { + std::string original_string; + std::string version_string; + std::string identifiers_string; + + std::vector<uint64_t> identifiers; + + static ExpectedS<DateVersion> from_string(const std::string& str); + }; + + VerComp compare(const std::string& a, const std::string& b, Scheme scheme); + VerComp compare(const RelaxedVersion& a, const RelaxedVersion& b); + VerComp compare(const SemanticVersion& a, const SemanticVersion& b); + VerComp compare(const DateVersion& a, const DateVersion& b); + struct Constraint { enum class Type |
