diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-07-04 19:12:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-07-05 14:24:43 +0300 |
commit | 57b10c06925d0bdf6ffb38488ee908f085109e95 (patch) | |
tree | f2103684d319650c3302aef9d7a70dd64ff2a347 /libbuild2/dist/module.hxx | |
parent | 30b4eda196e090aa820d312e6a9435a4ae84c303 (diff) |
Move config, dist, test, and install modules into library
Diffstat (limited to 'libbuild2/dist/module.hxx')
-rw-r--r-- | libbuild2/dist/module.hxx | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/libbuild2/dist/module.hxx b/libbuild2/dist/module.hxx new file mode 100644 index 0000000..abc1400 --- /dev/null +++ b/libbuild2/dist/module.hxx @@ -0,0 +1,71 @@ +// file : libbuild2/dist/module.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef LIBBUILD2_DIST_MODULE_HXX +#define LIBBUILD2_DIST_MODULE_HXX + +#include <libbuild2/types.hxx> +#include <libbuild2/utility.hxx> + +#include <libbuild2/module.hxx> +#include <libbuild2/variable.hxx> + +#include <libbuild2/export.hxx> + +namespace build2 +{ + namespace dist + { + struct LIBBUILD2_SYMEXPORT module: module_base + { + static const string name; + + const variable& var_dist_package; + + // Distribution post-processing callbacks. + // + // The last component in the pattern may contain shell wildcards. If the + // path contains a directory, then it is matched from the distribution + // root only. Otherwise, it is matched against all the files being + // distributed. For example: + // + // buildfile - every buildfile + // ./buildfile - root buildfile only + // tests/buildfile - tests/buildfile only + // + // The callback is called with the absolute path of the matching file + // after it has been copied to the distribution directory. The project's + // root scope and callback-specific data are passed along. + // + // Note that if registered, the callbacks are also called (recursively) + // in subprojects. + // + using callback_func = void (const path&, const scope&, void*); + + void + register_callback (path pattern, callback_func* f, void* data) + { + callbacks_.push_back (callback {move (pattern), f, data}); + } + + // Implementation details. + // + module (const variable& v_d_p) + : var_dist_package (v_d_p) {} + + public: + struct callback + { + const path pattern; + callback_func* function; + void* data; + }; + using callbacks = vector<callback>; + + callbacks callbacks_; + }; + } +} + +#endif // LIBBUILD2_DIST_MODULE_HXX |