From 03c931e54e618221b69cfcd3dfb462e50ecad780 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Oct 2022 23:21:29 +0300 Subject: Add support for package build configurations --- mod/build-config-module.cxx | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'mod/build-config-module.cxx') diff --git a/mod/build-config-module.cxx b/mod/build-config-module.cxx index bf21fbb..eba753e 100644 --- a/mod/build-config-module.cxx +++ b/mod/build-config-module.cxx @@ -18,26 +18,25 @@ namespace brep using namespace std; using namespace butl; using namespace bpkg; - using namespace bbot; - // Return pointer to the shared build configurations instance, creating one - // on the first call. Throw tab_parsing on parsing error, io_error on the - // underlying OS error. Note: not thread-safe. + // Return pointer to the shared build target configurations instance, + // creating one on the first call. Throw tab_parsing on parsing error, + // io_error on the underlying OS error. Note: not thread-safe. // - static shared_ptr + static shared_ptr shared_build_config (const path& p) { - static map> configs; + static map> configs; auto i (configs.find (p)); if (i != configs.end ()) { - if (shared_ptr c = i->second.lock ()) + if (shared_ptr c = i->second.lock ()) return c; } - shared_ptr c ( - make_shared (parse_buildtab (p))); + shared_ptr c ( + make_shared (bbot::parse_buildtab (p))); configs[p] = c; return c; @@ -122,7 +121,7 @@ namespace brep { try { - build_conf_ = shared_build_config (bo.build_config ()); + target_conf_ = shared_build_config (bo.build_config ()); } catch (const io_error& e) { @@ -137,19 +136,21 @@ namespace brep bot_agent_key_map_ = shared_bot_agent_keys (bo, bo.build_bot_agent_keys ()); - using conf_map_type = map; + using conf_map_type = map; + conf_map_type conf_map; - for (const auto& c: *build_conf_) - conf_map[build_config_id {c.name, c.target}] = &c; + for (const auto& c: *target_conf_) + conf_map[build_target_config_id {c.target, c.name}] = &c; - build_conf_map_ = make_shared (move (conf_map)); + target_conf_map_ = make_shared (move (conf_map)); } bool build_config_module:: - belongs (const bbot::build_config& cfg, const char* cls) const + belongs (const build_target_config& cfg, const char* cls) const { - const map& im (build_conf_->class_inheritance_map); + const map& im (target_conf_->class_inheritance_map); for (const string& c: cfg.classes) { -- cgit v1.1