diff options
-rw-r--r-- | mod/build-config-module.hxx | 6 | ||||
-rw-r--r-- | mod/build-config.cxx | 16 | ||||
-rw-r--r-- | mod/build-config.hxx | 8 | ||||
-rw-r--r-- | mod/mod-build-task.cxx | 12 |
4 files changed, 32 insertions, 10 deletions
diff --git a/mod/build-config-module.hxx b/mod/build-config-module.hxx index 04fd5b1..ba2698d 100644 --- a/mod/build-config-module.hxx +++ b/mod/build-config-module.hxx @@ -42,13 +42,15 @@ namespace brep exclude (const small_vector<bpkg::build_class_expr, 1>& exprs, const vector<bpkg::build_constraint>& constrs, const bbot::build_config& cfg, - string* reason = nullptr) const + string* reason = nullptr, + bool default_all_ucs = false) const { return brep::exclude (exprs, constrs, cfg, build_conf_->class_inheritance_map, - reason); + reason, + default_all_ucs); } // Check if the configuration belongs to the specified class. diff --git a/mod/build-config.cxx b/mod/build-config.cxx index 2d64aec..43a85e8 100644 --- a/mod/build-config.cxx +++ b/mod/build-config.cxx @@ -13,17 +13,21 @@ namespace brep using namespace bpkg; using namespace bbot; - // The default underlying class set expression (see below). + // The default underlying class set expressions (see below). // static const build_class_expr default_ucs_expr ( {"default"}, '+', "Default."); + static const build_class_expr all_ucs_expr ( + {"all"}, '+', "All."); + bool exclude (const small_vector<build_class_expr, 1>& exprs, const vector<build_constraint>& constrs, const build_config& cfg, const map<string, string>& class_inheritance_map, - string* reason) + string* reason, + bool default_all_ucs) { // Save the first sentence of the reason, lower-case the first letter if // the beginning looks like a word (all subsequent characters until a @@ -132,9 +136,11 @@ namespace brep // cannot affect the result. // const build_class_expr& ucs_expr ( - ucs != nullptr - ? build_class_expr (ucs->underlying_classes, '+', ucs->comment) - : default_ucs_expr); + ucs != nullptr ? build_class_expr (ucs->underlying_classes, + '+', + ucs->comment) : + default_all_ucs ? all_ucs_expr : + default_ucs_expr); match (ucs_expr); diff --git a/mod/build-config.hxx b/mod/build-config.hxx index d5e44ce..e8dfe07 100644 --- a/mod/build-config.hxx +++ b/mod/build-config.hxx @@ -18,14 +18,18 @@ namespace brep // Return true if the specified build configuration is excluded by a package // based on its underlying build class set, build class expressions, and // build constraints, potentially extending the underlying set with the - // special classes. Set the exclusion reason if requested. + // special classes. Set the exclusion reason if requested. Optionally use + // the `all` class as a default underlying build class set rather than the + // `default` class (which is, for example, the case for the external test + // packages not to reduce their build configuration set needlessly). // bool exclude (const small_vector<bpkg::build_class_expr, 1>&, const vector<bpkg::build_constraint>&, const bbot::build_config&, const std::map<string, string>& class_inheritance_map, - string* reason = nullptr); + string* reason = nullptr, + bool default_all_ucs = false); // Convert dash-separated components (target, build configuration name, // machine name) or a pattern thereof into a path, replacing dashes with diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index 3eaa0d3..741d3b4 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -243,7 +243,17 @@ handle (request& rq, response& rs) { shared_ptr<build_package> p (t.package.load ()); - if (exclude (p->builds, p->constraints, *cm.config)) + // Use the `all` class as a least restrictive default underlying + // build class set. Note that we should only apply the explicit + // build restrictions to the external test packages (think about + // the `builds: all` and `builds: -windows` manifest values for + // the primary and external test packages, respectively). + // + if (exclude (p->builds, + p->constraints, + *cm.config, + nullptr /* reason */, + true /* default_all_ucs */)) tes.push_back (package {move (p->id.name), move (p->version)}); } } |