feat(version): single-source semver, ext-state stamp, show-version action

Version "0.9.01" sourced once from CMake via configure_file'd header; pure
app_version module (parse/compare/classify) with CTest. Stamp rides the persist
save seam under "reasampler"/"version"; absent stamp reads as pre-versioning.
On-demand "show version" action, no startup print.
This commit is contained in:
2026-07-26 15:16:55 -04:00
parent 791a9c60eb
commit f6dddbf5a3
8 changed files with 409 additions and 2 deletions
+18
View File
@@ -79,6 +79,7 @@
#include <string>
#include <vector>
#include "app_version.h"
#include "capture_paths.h"
#define REAPERAPI_MINIMAL
@@ -226,6 +227,13 @@ bool ReaSamplerSession::saveToActiveProject() {
SetProjExtState(static_cast<ReaProject*>(proj), kProjExtNamespace,
kProjExtOwnedKey, ownedJson.c_str());
// Phase V (V1): stamp the WRITING version — the build producing this save — under the
// version key, on the SAME seam as the keys above so the stamp and MarkProjectDirty
// stay paired (no drifting ad-hoc SetProjExtState). appVersion() is the one CMake-
// sourced constant; every save records the exact current build into the .rpp.
SetProjExtState(static_cast<ReaProject*>(proj), kProjExtNamespace,
kProjExtVersionKey, appVersion().c_str());
MarkProjectDirty(static_cast<ReaProject*>(proj));
return true;
}
@@ -315,6 +323,16 @@ void ReaSamplerSession::loadFromProject(void* proj, const std::string& projectDi
// (R-B) must re-read the restored manifest so it matches the rolled-back bank state.
owned_ = loadOwnedManifest(static_cast<ReaProject*>(proj));
// Phase V (V1): recover the writing-version stamp on EVERY load path (peer-symmetry
// with tail_/view_ above). An absent stamp classifies as PreVersioning, a malformed
// one as Unknown — both silent, no console warning (a pre-versioning project is not
// an error). getProjExtStateString returns "" for an absent key, which is exactly the
// PreVersioning input classifyWritingVersion expects. proj == nullptr -> "" -> default.
writingVersion_ = classifyWritingVersion(
proj ? getProjExtStateString(static_cast<ReaProject*>(proj), kProjExtNamespace,
kProjExtVersionKey)
: std::string{});
if (!proj) {
book_ = BankBook{};
return;