diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-12 20:24:56 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-12 20:24:56 +0300 |
commit | 16e855071b57dbc86307a7eba4db439047259e70 (patch) | |
tree | 49f83e7debb8b002726d63e8ae9e4df2d20a7ea8 | |
parent | 13b07e3d9d3c1f3e687a719675aabb6b68e3c822 (diff) |
Adapt to standard version API change
-rw-r--r-- | build2/context.cxx | 11 | ||||
-rw-r--r-- | build2/version/init.cxx | 11 |
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 |