aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-20 09:14:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-20 09:14:19 +0200
commitd7b5f03a761714f6ea6c4b1891e8a1f3824d4979 (patch)
tree63e7504c41cf5b6791cbd7c619744e6137590dc8 /libbuild2/context.cxx
parent7d2d419820912e54cda370c97829af573d9f62ae (diff)
Add build.version.interface
This build system interface version should be embedded into build system modules as load_suffix.
Diffstat (limited to 'libbuild2/context.cxx')
-rw-r--r--libbuild2/context.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx
index 815a556..e7f9751 100644
--- a/libbuild2/context.cxx
+++ b/libbuild2/context.cxx
@@ -432,6 +432,9 @@ namespace build2
gs.assign (variable_pool::instance.insert<T> (var)) = move (val);
};
+ // Note: here we assume epoch will always be 1 and therefore omit the
+ // project_ prefix in a few places.
+ //
set ("build.version", v.string_project ());
set ("build.version.number", v.version);
@@ -455,6 +458,14 @@ namespace build2
set ("build.version.snapshot_id", v.snapshot_id); // string
set ("build.version.snapshot_string", v.string_snapshot ());
+ // Build system interface version. In particular, it is embedded into
+ // build system modules as load_suffix.
+ //
+ set ("build.version.interface",
+ v.pre_release ()
+ ? v.string_project_id ()
+ : to_string (v.major ()) + '.' + to_string (v.minor ()));
+
// Allow detection (for example, in tests) whether this is a staged
// toolchain.
//