summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/cli/buildfile3
-rw-r--r--cli/cli/cli.cxx10
-rw-r--r--cli/cli/options.cli3
-rw-r--r--cli/cli/options.cxx11
-rw-r--r--cli/cli/options.hxx17
-rw-r--r--cli/cli/options.ixx18
-rw-r--r--cli/cli/version.hxx.in2
7 files changed, 49 insertions, 15 deletions
diff --git a/cli/cli/buildfile b/cli/cli/buildfile
index ff562c2..b468ab4 100644
--- a/cli/cli/buildfile
+++ b/cli/cli/buildfile
@@ -9,7 +9,8 @@ import libs = libcutl%lib{cutl}
#
exe{cli}:
{
- cli.version = $version.project_id
+ export.metadata = 1
+ cli.version = $version
cli.checksum = $version
}
diff --git a/cli/cli/cli.cxx b/cli/cli/cli.cxx
index c57caee..6c51aae 100644
--- a/cli/cli/cli.cxx
+++ b/cli/cli/cli.cxx
@@ -34,13 +34,17 @@ main (int argc, char* argv[])
// Handle --build2-metadata (see also buildfile).
//
- if (ops.build2_metadata ())
+ if (ops.build2_metadata_specified ())
{
ostream& o (cout);
+ // Note that the export.metadata variable should be the first non-
+ // blank/comment line.
+ //
o << "# build2 buildfile cli" << endl
- << "cli.version = '" << CLI_VERSION_ID << '\'' << endl
- << "cli.checksum = '" << CLI_CHECKSUM << '\'' << endl;
+ << "export.metadata = 1" << endl
+ << "cli.version = [string] '" << CLI_VERSION_FULL << '\'' << endl
+ << "cli.checksum = [string] '" << CLI_VERSION_FULL << '\'' << endl;
return 0;
}
diff --git a/cli/cli/options.cli b/cli/cli/options.cli
index e564bc4..ff462d3 100644
--- a/cli/cli/options.cli
+++ b/cli/cli/options.cli
@@ -10,12 +10,13 @@ include <map>;
include <string>;
include <vector>;
include <cstddef>;
+include <cstdint>;
include <cli/option-types.hxx>;
class options
{
- bool --build2-metadata; // Leave undocumented/hidden.
+ std::uint64_t --build2-metadata; // Leave undocumented/hidden.
bool --help {"Print usage information and exit."};
bool --version {"Print version and exit."};
diff --git a/cli/cli/options.cxx b/cli/cli/options.cxx
index cc22a35..463973a 100644
--- a/cli/cli/options.cxx
+++ b/cli/cli/options.cxx
@@ -629,6 +629,7 @@ namespace cli
options::
options ()
: build2_metadata_ (),
+ build2_metadata_specified_ (false),
help_ (),
version_ (),
include_path_ (),
@@ -769,6 +770,7 @@ options (int& argc,
::cli::unknown_mode opt,
::cli::unknown_mode arg)
: build2_metadata_ (),
+ build2_metadata_specified_ (false),
help_ (),
version_ (),
include_path_ (),
@@ -912,6 +914,7 @@ options (int start,
::cli::unknown_mode opt,
::cli::unknown_mode arg)
: build2_metadata_ (),
+ build2_metadata_specified_ (false),
help_ (),
version_ (),
include_path_ (),
@@ -1055,6 +1058,7 @@ options (int& argc,
::cli::unknown_mode opt,
::cli::unknown_mode arg)
: build2_metadata_ (),
+ build2_metadata_specified_ (false),
help_ (),
version_ (),
include_path_ (),
@@ -1200,6 +1204,7 @@ options (int start,
::cli::unknown_mode opt,
::cli::unknown_mode arg)
: build2_metadata_ (),
+ build2_metadata_specified_ (false),
help_ (),
version_ (),
include_path_ (),
@@ -1341,6 +1346,7 @@ options (::cli::scanner& s,
::cli::unknown_mode opt,
::cli::unknown_mode arg)
: build2_metadata_ (),
+ build2_metadata_specified_ (false),
help_ (),
version_ (),
include_path_ (),
@@ -1483,7 +1489,7 @@ print_usage (::std::ostream& os, ::cli::usage_para p)
if (p == ::cli::usage_para::text)
os << ::std::endl;
- os << "--build2-metadata" << std::endl;
+ os << "--build2-metadata <arg>" << std::endl;
os << "--help Print usage information and exit." << ::std::endl;
@@ -1734,7 +1740,8 @@ struct _cli_options_map_init
_cli_options_map_init ()
{
_cli_options_map_["--build2-metadata"] =
- &::cli::thunk< options, bool, &options::build2_metadata_ >;
+ &::cli::thunk< options, std::uint64_t, &options::build2_metadata_,
+ &options::build2_metadata_specified_ >;
_cli_options_map_["--help"] =
&::cli::thunk< options, bool, &options::help_ >;
_cli_options_map_["--version"] =
diff --git a/cli/cli/options.hxx b/cli/cli/options.hxx
index b253092..b54d81f 100644
--- a/cli/cli/options.hxx
+++ b/cli/cli/options.hxx
@@ -400,6 +400,8 @@ namespace cli
#include <cstddef>
+#include <cstdint>
+
#include <cli/option-types.hxx>
class options
@@ -441,14 +443,20 @@ class options
// Option accessors and modifiers.
//
- const bool&
+ const std::uint64_t&
build2_metadata () const;
- bool&
+ std::uint64_t&
build2_metadata ();
void
- build2_metadata (const bool&);
+ build2_metadata (const std::uint64_t&);
+
+ bool
+ build2_metadata_specified () const;
+
+ void
+ build2_metadata_specified (bool);
const bool&
help () const;
@@ -1489,7 +1497,8 @@ class options
::cli::unknown_mode argument);
public:
- bool build2_metadata_;
+ std::uint64_t build2_metadata_;
+ bool build2_metadata_specified_;
bool help_;
bool version_;
std::vector<std::string> include_path_;
diff --git a/cli/cli/options.ixx b/cli/cli/options.ixx
index 12d40db..5916883 100644
--- a/cli/cli/options.ixx
+++ b/cli/cli/options.ixx
@@ -255,24 +255,36 @@ namespace cli
// options
//
-inline const bool& options::
+inline const std::uint64_t& options::
build2_metadata () const
{
return this->build2_metadata_;
}
-inline bool& options::
+inline std::uint64_t& options::
build2_metadata ()
{
return this->build2_metadata_;
}
inline void options::
-build2_metadata(const bool& x)
+build2_metadata(const std::uint64_t& x)
{
this->build2_metadata_ = x;
}
+inline bool options::
+build2_metadata_specified () const
+{
+ return this->build2_metadata_specified_;
+}
+
+inline void options::
+build2_metadata_specified(bool x)
+{
+ this->build2_metadata_specified_ = x;
+}
+
inline const bool& options::
help () const
{
diff --git a/cli/cli/version.hxx.in b/cli/cli/version.hxx.in
index 90b649a..ceb5389 100644
--- a/cli/cli/version.hxx.in
+++ b/cli/cli/version.hxx.in
@@ -36,7 +36,7 @@
#define CLI_SNAPSHOT $cli.version.snapshot_sn$ULL
#define CLI_SNAPSHOT_ID "$cli.version.snapshot_id$"
-#define CLI_CHECKSUM "$cli.version$"
+#define CLI_VERSION_FULL "$cli.version$"
#include <cutl/version.hxx>