From f7390bab27a1c88b936b5da868e85228bc5273ae Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sat, 9 May 2026 05:48:07 +0800 Subject: [PATCH] fix(release): bump hard-coded version strings to 0.0.2 + route through MCPP_VERSION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v0.0.2 release.yml run produced a fully-functional musl-static binary, but the smoke-test step rejected it because `mcpp --version` still printed `mcpp 0.0.1`. The version literal had been hand-coded in four places that the [package].version bump in mcpp.toml didn't reach: - src/toolchain/fingerprint.cppm:21 MCPP_VERSION = "0.0.1" - src/cli.cppm:64 "mcpp v0.0.1 — ..." (print_usage) - src/cli.cppm:2805 "mcpp 0.0.1" (cmd_self_version) - src/cli.cppm:2874 "mcpp 0.0.1" (--version handler) - src/cli.cppm:2947 .version("0.0.1") (cmdline App ctor) Bump the canonical constant in `fingerprint.cppm` to 0.0.2 and refactor all five sites to read `mcpp::toolchain::MCPP_VERSION` so future bumps only need a one-line change. The fingerprint constant already drives the toolchain hash key, so its value matters for cache invalidation anyway — this consolidates "what version am I" into a single authoritative location. Verified locally: $ mcpp --version mcpp 0.0.2 $ mcpp self version mcpp 0.0.2 --- src/cli.cppm | 8 ++++---- src/toolchain/fingerprint.cppm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli.cppm b/src/cli.cppm index d0b78fe..454c824 100644 --- a/src/cli.cppm +++ b/src/cli.cppm @@ -61,7 +61,7 @@ namespace mcpp::cli::detail { // canonical printer here so the docs/CHANGELOG examples don't drift // every time cmdline tweaks its formatting. void print_usage() { - std::println("mcpp v0.0.1 — modern C++23 build tool"); + std::println("mcpp v{} — modern C++23 build tool", mcpp::toolchain::MCPP_VERSION); std::println(""); std::println("Usage:"); std::println("Project commands:"); @@ -2802,7 +2802,7 @@ int cmd_explain(std::string_view code) { // can share `cmd_doctor` / `cmd_env` between top-level and `mcpp self`. int cmd_self_version(const mcpplibs::cmdline::ParsedArgs& /*parsed*/) { - std::println("mcpp 0.0.1"); + std::println("mcpp {}", mcpp::toolchain::MCPP_VERSION); return 0; } @@ -2871,7 +2871,7 @@ int run(int argc, char** argv) { std::string_view a = argv[1]; if (a == "--help" || a == "-h") { print_usage(); return 0; } if (a == "--version" || a == "-V") { - std::println("mcpp 0.0.1"); + std::println("mcpp {}", mcpp::toolchain::MCPP_VERSION); return 0; } } @@ -2944,7 +2944,7 @@ int run(int argc, char** argv) { // ─── Build the top-level App ──────────────────────────────────────── auto app = cl::App("mcpp") - .version("0.0.1") + .version(std::string{mcpp::toolchain::MCPP_VERSION}) .description("modern C++ build tool") .option(cl::Option("quiet").short_name('q') .help("Suppress status output").global()) diff --git a/src/toolchain/fingerprint.cppm b/src/toolchain/fingerprint.cppm index f8913c7..0b9309a 100644 --- a/src/toolchain/fingerprint.cppm +++ b/src/toolchain/fingerprint.cppm @@ -18,7 +18,7 @@ import mcpp.toolchain.detect; export namespace mcpp::toolchain { -inline constexpr std::string_view MCPP_VERSION = "0.0.1"; +inline constexpr std::string_view MCPP_VERSION = "0.0.2"; struct FingerprintInputs { Toolchain toolchain;