diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-20 09:14:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-20 09:14:19 +0200 |
commit | d7b5f03a761714f6ea6c4b1891e8a1f3824d4979 (patch) | |
tree | 63e7504c41cf5b6791cbd7c619744e6137590dc8 | |
parent | 7d2d419820912e54cda370c97829af573d9f62ae (diff) |
Add build.version.interface
This build system interface version should be embedded into build system
modules as load_suffix.
-rw-r--r-- | libbuild2/bash/buildfile | 6 | ||||
-rw-r--r-- | libbuild2/context.cxx | 11 | ||||
-rw-r--r-- | libbuild2/in/buildfile | 6 | ||||
-rw-r--r-- | libbuild2/version/buildfile | 6 |
4 files changed, 23 insertions, 6 deletions
diff --git a/libbuild2/bash/buildfile b/libbuild2/bash/buildfile index ed95998..e30f379 100644 --- a/libbuild2/bash/buildfile +++ b/libbuild2/bash/buildfile @@ -50,8 +50,10 @@ libs{build2-bash}: cxx.export.poptions += -DLIBBUILD2_BASH_SHARED # in place of another pre-release or the final version. See the version module # for details on the version.* variable values. # -# And seeing that this is a build system module, we also embed the same -# version as the build system core version. +# And because this is a build system module, we also embed the same value as +# the interface version (note that we cannot use build.version.interface for +# bundled modules because we could be built with a different version of the +# build system). # ver = ($version.pre_release \ ? "$version.project_id" \ 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. // diff --git a/libbuild2/in/buildfile b/libbuild2/in/buildfile index aa5af87..b67ee00 100644 --- a/libbuild2/in/buildfile +++ b/libbuild2/in/buildfile @@ -47,8 +47,10 @@ libs{build2-in}: cxx.export.poptions += -DLIBBUILD2_IN_SHARED # in place of another pre-release or the final version. See the version module # for details on the version.* variable values. # -# And seeing that this is a build system module, we also embed the same -# version as the build system core version. +# And because this is a build system module, we also embed the same value as +# the interface version (note that we cannot use build.version.interface for +# bundled modules because we could be built with a different version of the +# build system). # ver = ($version.pre_release \ ? "$version.project_id" \ diff --git a/libbuild2/version/buildfile b/libbuild2/version/buildfile index 7477815..96f55ad 100644 --- a/libbuild2/version/buildfile +++ b/libbuild2/version/buildfile @@ -51,8 +51,10 @@ libs{build2-version}: cxx.export.poptions += -DLIBBUILD2_VERSION_SHARED # in place of another pre-release or the final version. See the version module # for details on the version.* variable values. # -# And seeing that this is a build system module, we also embed the same -# version as the build system core version. +# And because this is a build system module, we also embed the same value as +# the interface version (note that we cannot use build.version.interface for +# bundled modules because we could be built with a different version of the +# build system). # ver = ($version.pre_release \ ? "$version.project_id" \ |