aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/version/init.cxx26
-rw-r--r--build2/version/module.hxx2
2 files changed, 24 insertions, 4 deletions
diff --git a/build2/version/init.cxx b/build2/version/init.cxx
index f793c98..c6729f1 100644
--- a/build2/version/init.cxx
+++ b/build2/version/init.cxx
@@ -12,6 +12,8 @@
#include <build2/variable.hxx>
#include <build2/diagnostics.hxx>
+#include <build2/config/utility.hxx>
+
#include <build2/dist/module.hxx>
#include <build2/version/rule.hxx>
@@ -253,11 +255,26 @@ namespace build2
module& m (static_cast<module&> (*mod));
const standard_version& v (m.version);
- // If the dist module has been loaded, set its dist.package and register
- // the post-processing callback.
+ // If the dist module is used, set its dist.package and register the
+ // post-processing callback.
//
if (auto* dm = rs.modules.lookup<dist::module> (dist::module::name))
{
+ // Make sure dist is init'ed, not just boot'ed.
+ //
+ if (!cast_false<bool> (rs["dist.loaded"]))
+ load_module (rs, rs, "dist", l);
+
+ // Add the config.dist.uncommitted configuration variable (a bit cozy
+ // adding other module's config variable but I am not sure calling it
+ // config.version.dist.uncommitted would be better).
+ //
+ auto& vp (var_pool.rw (rs));
+ {
+ const auto& var (vp.insert<bool> ("config.dist.uncommitted", true));
+ m.dist_uncommitted = cast_false<bool> (config::optional (rs, var));
+ }
+
// Don't touch if dist.package was set by the user.
//
value& val (rs.assign (dm->var_dist_package));
@@ -335,8 +352,9 @@ namespace build2
// Complain if this is an uncommitted snapshot.
//
- if (v.snapshot () && !m.committed)
- fail << "distribution of uncommitted project " << rs.src_path ();
+ if (v.snapshot () && !m.committed && !m.dist_uncommitted)
+ fail << "distribution of uncommitted project " << rs.src_path () <<
+ info << "specify config.dist.uncommitted=true to force";
// The plan is simple, re-serialize the manifest into a temporary file
// fixing up the version. Then move the temporary file to the original.
diff --git a/build2/version/module.hxx b/build2/version/module.hxx
index a5a667a..e057e7d 100644
--- a/build2/version/module.hxx
+++ b/build2/version/module.hxx
@@ -32,6 +32,8 @@ namespace build2
const variable* in_symbol = nullptr; // in.symbol
const variable* in_substitution = nullptr; // in.substitution
+ bool dist_uncommitted = false;
+
module (butl::standard_version v,
bool c,
dependency_constraints d)