aboutsummaryrefslogtreecommitdiff
path: root/mod/build-config-module.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/build-config-module.hxx')
-rw-r--r--mod/build-config-module.hxx85
1 files changed, 41 insertions, 44 deletions
diff --git a/mod/build-config-module.hxx b/mod/build-config-module.hxx
index 25ddbb4..c1630b0 100644
--- a/mod/build-config-module.hxx
+++ b/mod/build-config-module.hxx
@@ -1,24 +1,20 @@
// file : mod/build-config-module.hxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#ifndef MOD_BUILD_CONFIG_MODULE_HXX
#define MOD_BUILD_CONFIG_MODULE_HXX
#include <map>
-#include <algorithm> // find()
-#include <libbutl/utility.mxx> // compare_c_string
+#include <libbutl/target-triplet.hxx>
#include <libbpkg/manifest.hxx>
-#include <libbbot/build-config.hxx>
-
#include <libbrep/types.hxx>
#include <libbrep/utility.hxx>
-#include <mod/module.hxx>
-#include <mod/options.hxx>
+#include <mod/module-options.hxx>
+#include <mod/build-target-config.hxx>
// Base class for modules that utilize the build controller configuration.
//
@@ -40,55 +36,51 @@ namespace brep
void
init (const options::build&);
- // 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.
- //
+ template <typename K>
bool
- exclude (const small_vector<bpkg::build_class_expr, 1>&,
- const vector<bpkg::build_constraint>&,
- const bbot::build_config&,
- string* reason = nullptr) const;
+ exclude (const build_package_config_template<K>& pc,
+ const build_class_exprs& common_builds,
+ const build_constraints& common_constraints,
+ const build_target_config& tc,
+ string* reason = nullptr,
+ bool default_all_ucs = false) const
+ {
+ return brep::exclude (pc,
+ common_builds,
+ common_constraints,
+ tc,
+ target_conf_->class_inheritance_map,
+ reason,
+ default_all_ucs);
+ }
// Check if the configuration belongs to the specified class.
//
bool
- belongs (const bbot::build_config&, const char*) const;
+ belongs (const build_target_config&, const char*) const;
bool
- belongs (const bbot::build_config& cfg, const string& cls) const
+ belongs (const build_target_config& cfg, const string& cls) const
{
return belongs (cfg, cls.c_str ());
}
- // Convert dash-separated components (target, build configuration name,
- // machine name) or a pattern thereof into a path, replacing dashes with
- // slashes (directory separators), `**` with `*/**/*`, and appending the
- // trailing slash for a subsequent match using the path_match()
- // functionality (the idea here is for `linux**` to match `linux-gcc`
- // which is quite natural to expect). Throw invalid_path if the resulting
- // path is invalid.
- //
- // Note that the match_absent path match flag must be used for the above
- // `**` transformation to work.
+ // Target/configuration/toolchain combination that, in particular, can be
+ // used as a set value.
//
- static path
- dash_components_to_path (const string&);
-
- // Configuration/toolchain combination that, in particular, can be used as
- // a set value.
- //
- // Note: contains shallow references to the configuration, toolchain name,
- // and version.
+ // Note: all members are the shallow references.
//
struct config_toolchain
{
- const string& configuration;
+ const butl::target_triplet& target;
+ const string& target_config;
+ const string& package_config;
const string& toolchain_name;
const bpkg::version& toolchain_version;
+ // Note: the comparison reflects the order of unbuilt configurations on
+ // the Builds page.
+ //
bool
operator< (const config_toolchain& ct) const
{
@@ -98,19 +90,24 @@ namespace brep
if (toolchain_version != ct.toolchain_version)
return toolchain_version > ct.toolchain_version;
- return configuration.compare (ct.configuration) < 0;
+ if (int r = target.compare (ct.target))
+ return r < 0;
+
+ if (int r = target_config.compare (ct.target_config))
+ return r < 0;
+
+ return package_config.compare (ct.package_config) < 0;
}
};
protected:
// Build configurations.
//
- shared_ptr<const bbot::build_configs> build_conf_;
- shared_ptr<const cstrings> build_conf_names_;
+ shared_ptr<const build_target_configs> target_conf_;
- shared_ptr<const std::map<const char*,
- const bbot::build_config*,
- butl::compare_c_string>> build_conf_map_;
+ shared_ptr<const std::map<build_target_config_id,
+ const build_target_config*>>
+ target_conf_map_;
// Map of build bot agent public keys fingerprints to the key file paths.
//