aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/context.cxx11
-rw-r--r--build2/version/init.cxx11
2 files changed, 14 insertions, 8 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index 142a99d..31e01d7 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -460,11 +460,14 @@ namespace build2
set ("build.version.minor", uint64_t (v.minor ()));
set ("build.version.patch", uint64_t (v.patch ()));
- set ("build.version.alpha", v.alpha ()); // bool
- set ("build.version.beta", v.beta ()); // bool
- set ("build.version.pre_release", v.alpha () || v.beta ());
+ optional<uint16_t> a (v.alpha ());
+ optional<uint16_t> b (v.beta ());
+
+ set ("build.version.alpha", a.has_value ());
+ set ("build.version.beta", b.has_value ());
+ set ("build.version.pre_release", v.pre_release ().has_value ());
set ("build.version.pre_release_string", v.string_pre_release ());
- set ("build.version.pre_release_number", uint64_t (v.pre_release ()));
+ set ("build.version.pre_release_number", uint64_t (a ? *a : b ? *b : 0));
set ("build.version.snapshot", v.snapshot ()); // bool
set ("build.version.snapshot_sn", v.snapshot_sn); // uint64
diff --git a/build2/version/init.cxx b/build2/version/init.cxx
index 4234451..2cd1645 100644
--- a/build2/version/init.cxx
+++ b/build2/version/init.cxx
@@ -224,11 +224,14 @@ namespace build2
set ("version.minor", uint64_t (v.minor ()));
set ("version.patch", uint64_t (v.patch ()));
- set ("version.alpha", v.alpha ()); // bool
- set ("version.beta", v.beta ()); // bool
- set ("version.pre_release", v.alpha () || v.beta ());
+ optional<uint16_t> a (v.alpha ());
+ optional<uint16_t> b (v.beta ());
+
+ set ("version.alpha", a.has_value ());
+ set ("version.beta", b.has_value ());
+ set ("version.pre_release", v.pre_release ().has_value ());
set ("version.pre_release_string", v.string_pre_release ());
- set ("version.pre_release_number", uint64_t (v.pre_release ()));
+ set ("version.pre_release_number", uint64_t (a ? *a : b ? *b : 0));
set ("version.snapshot", v.snapshot ()); // bool
set ("version.snapshot_sn", v.snapshot_sn); // uint64