Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools/VersionMain.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-11-14 22:03:45 +0300
committerLeitwolf112026-11-14 22:03:45 +0300
commit2d21d2e0f9c6e0789e9c55d6cba611234dc61a60 (patch)
tree6750468ab3926a4c3cdcaed7a826a730708c6b72 /tools/VersionMain.cpp
parent94a996a3ceafa9f0004ffc28a7de5c543cdb51c2 (diff)
downloadcatch3-2d21d2e0f9c6e0789e9c55d6cba611234dc61a60.tar.gz
Number versions MAJOR.MINOR.PATCH in the version tool
Progmasoft repositories use Semantic Versioning since 2026-11-12, but //tools:version still knew the four-number counters: given 0.4.0 it wrote 0.4.0.0 everywhere, and --next stepped the fourth number. - A Version is three numbers; ParseVersion takes exactly three, without leading zeros, and FormatVersion writes three. - --next is the next patch release. It also follows a four-number version as the rule says: the fourth number goes and the patch rises, so 0.3.0.2 is followed by 0.3.1. - ReleaseNotesOf finds a section by the version it was published as. Its fallback for "D = 0" read the fourth element of what is now a three-element array; it is gone. - Tests for the new parsing, NextPatch and release-note lookup; docs/contributing.md and the tool's usage say what the tool does. Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'tools/VersionMain.cpp')
-rw-r--r--tools/VersionMain.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/VersionMain.cpp b/tools/VersionMain.cpp
index 6f1c13cb..2c9c5456 100644
--- a/tools/VersionMain.cpp
+++ b/tools/VersionMain.cpp
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0
// bazelisk run //tools:version prints the current version
-// bazelisk run //tools:version -- --next moves to the next version
-// bazelisk run //tools:version -- 0.3.1.0 moves to that version
+// bazelisk run //tools:version -- --next moves to the next patch release
+// bazelisk run //tools:version -- 0.4.0 moves to that version
//
// Moving writes every place that states the version, and the amalgamation.
@@ -44,16 +44,19 @@ main(int argc, char **argv)
return 0;
}
const std::string_view argument{ argv[1] };
- const auto parsed = ParseVersion(
- argument == "--next" ? *current : std::string{ argument });
+ const auto parsed
+ = argument == "--next" ? NextPatch(*current) : ParseVersion(argument);
if (!parsed)
{
- std::cerr << "not a version of three or four numbers: " << argument
+ std::cerr << (argument == "--next"
+ ? "the current version is not a release version: "
+ + *current
+ : "not a version MAJOR.MINOR.PATCH: "
+ + std::string{ argument })
<< '\n';
return 2;
}
- const auto version
- = FormatVersion(argument == "--next" ? NextVersion(*parsed) : *parsed);
+ const auto version = FormatVersion(*parsed);
// The sources have to make a distribution before anything is changed.
(void)GenerateAmalgamation(*root, problems);
if (problems.empty())