diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-11-16 22:14:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-11-23 14:08:05 +0300 |
commit | 40e4d161fa319a443c2598ddbc74b8ad31220c68 (patch) | |
tree | c5f8c20b135c297c386e9e544f303c991e3b40ab /libbbot | |
parent | 5d2f40dbca1ed021eb4586c8f3f5578825e82c57 (diff) |
Add support for package-config task manifest value
Diffstat (limited to 'libbbot')
-rw-r--r-- | libbbot/build-target-config.cxx (renamed from libbbot/build-config.cxx) | 34 | ||||
-rw-r--r-- | libbbot/build-target-config.hxx (renamed from libbbot/build-config.hxx) | 22 | ||||
-rw-r--r-- | libbbot/manifest.cxx | 35 | ||||
-rw-r--r-- | libbbot/manifest.hxx | 15 |
4 files changed, 66 insertions, 40 deletions
diff --git a/libbbot/build-config.cxx b/libbbot/build-target-config.cxx index 15061fc..9e04a17 100644 --- a/libbbot/build-config.cxx +++ b/libbbot/build-target-config.cxx @@ -1,7 +1,7 @@ -// file : libbbot/build-config.cxx -*- C++ -*- +// file : libbbot/build-target-config.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#include <libbbot/build-config.hxx> +#include <libbbot/build-target-config.hxx> #include <map> #include <string> @@ -23,10 +23,10 @@ using namespace butl; namespace bbot { - LIBBBOT_EXPORT build_configs + LIBBBOT_EXPORT build_target_configs parse_buildtab (istream& is, const string& name) { - build_configs r; + build_target_configs r; tab_parser parser (is, name); r.classes.push_back ("all"); @@ -56,22 +56,23 @@ namespace bbot d); }; - build_config config; + build_target_config config; config.machine_pattern = move (tl[i++].value); // If the machine pattern is a single dash character, then this is a // placeholder entry. The only thing we are interested about it is the // class inheritance information. Note that while all other information - // is discarded, the configuration name and target must be present (can - // also be dashes), so the classes field can be determined and parsed. + // is discarded, the target configuration name and target must be + // present (can also be dashes), so the classes field can be determined + // and parsed. // bool placeholder (config.machine_pattern == "-"); - // Configuration name, target[/environment] and classes fields are the - // required ones. + // Target configuration name, target[/environment] and classes fields + // are the required ones. // if (i == n) - bad_line ("no configuration name found"); + bad_line ("no target configuration name found"); config.name = move (tl[i].value); @@ -113,7 +114,7 @@ namespace bbot for (const auto& c: r) { if (c.name == config.name && c.target == config.target) - bad_line ("duplicate configuration name/target"); + bad_line ("duplicate target configuration name/target"); } if (++i == n) @@ -221,7 +222,7 @@ namespace bbot task_manifest::validate_regex (re); config.warning_regexes.emplace_back (move (re)); } - else // Configuration option or variable. + else // Target configuration option or variable. config.args.emplace_back (move (v)); } } @@ -230,13 +231,14 @@ namespace bbot bad_line (e.what ()); } - // Save the configuration. + // Save the target configuration. // r.emplace_back (move (config)); } // Erase entries for baseless classes (we were collecting them to make - // sure that the class inheritance is consistent across configurations). + // sure that the class inheritance is consistent across target + // configurations). // for (auto i (r.class_inheritance_map.begin ()); i != r.class_inheritance_map.end (); ) @@ -250,11 +252,11 @@ namespace bbot return r; } - build_configs + build_target_configs parse_buildtab (const path& p) { ifdstream ifs (p); - build_configs r (parse_buildtab (ifs, p.string ())); + build_target_configs r (parse_buildtab (ifs, p.string ())); ifs.close (); // Throws on failure. return r; diff --git a/libbbot/build-config.hxx b/libbbot/build-target-config.hxx index 473e5d8..27b555c 100644 --- a/libbbot/build-config.hxx +++ b/libbbot/build-target-config.hxx @@ -1,4 +1,4 @@ -// file : libbbot/build-config.hxx -*- C++ -*- +// file : libbbot/build-target-config.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file #ifndef LIBBBOT_BUILD_CONFIG_HXX @@ -19,10 +19,10 @@ namespace bbot { - // Build configuration matching specific machine names. Used by bbot + // Build target configuration matching specific machine names. Used by bbot // controllers. // - struct build_config + struct build_target_config { std::string machine_pattern; // Machine name pattern. std::string name; // Configuration name. @@ -36,10 +36,10 @@ namespace bbot std::vector<std::string> warning_regexes; }; - struct build_configs: std::vector<build_config> + struct build_target_configs: std::vector<build_target_config> { - // List of all configuration class names. Starts with the all and default - // classes. The rest follows in the same order as in the buildtab. + // List of all target configuration class names. Starts with the all and + // default classes. The rest follows in the same order as in the buildtab. // std::vector<std::string> classes; @@ -53,17 +53,17 @@ namespace bbot // // buildtab consists of lines in the following format: // - // <machine-pattern> <config> <target>[/<environment>] <classes> [<config-arg>]* [<warning-regex>]* + // <machine-pattern> <target-config> <target>[/<environment>] <classes> [<tgt-config-arg>]* [<warning-regex>]* // - // Note that each <config>/<target> pair is expected to be unique in the - // buildtab. + // Note that each <target-config>/<target> pair is expected to be unique in + // the buildtab. // using butl::tab_parsing; - LIBBBOT_EXPORT build_configs + LIBBBOT_EXPORT build_target_configs parse_buildtab (std::istream&, const std::string& name); - LIBBBOT_EXPORT build_configs + LIBBBOT_EXPORT build_target_configs parse_buildtab (const butl::path&); } diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx index 5b9de22..e2534c2 100644 --- a/libbbot/manifest.cxx +++ b/libbbot/manifest.cxx @@ -665,15 +665,23 @@ namespace bbot environment = move (v); } - else if (n == "config") + else if (n == "config" || // @@ TMP Until toolchain 0.16.0 is released. + n == "target-config") { - if (!config.empty ()) - bad_name ("task configuration redefinition"); + if (!target_config.empty ()) + bad_name ("task target configuration redefinition"); - config = parse_tab (v, [](const string&){}, "configuration"); + target_config = parse_tab (v, [](const string&){}, "configuration"); - if (config.empty ()) - bad_value ("empty task configuration"); + if (target_config.empty ()) + bad_value ("empty task target configuration"); + } + else if (n == "package-config") + { + if (!package_config.empty ()) + bad_name ("task package configuration redefinition"); + + package_config = move (v); } else if (n == "host") { @@ -829,7 +837,16 @@ namespace bbot } }; - serialize_list ("config", config); + // @@ TMP Always use 'target-config' name and always serialize + // package_config after toolchain 0.16.0 is released. + // + if (!package_config.empty ()) + { + serialize_list ("target-config", target_config); + s.next ("package-config", package_config); + } + else + serialize_list ("config", target_config); if (host) s.next ("host", *host ? "true" : "false"); @@ -846,9 +863,9 @@ namespace bbot } strings task_manifest:: - unquoted_config () const + unquoted_target_config () const { - return string_parser::unquote (config); + return string_parser::unquote (target_config); } strings task_manifest:: diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx index 7ba53cb..13b1138 100644 --- a/libbbot/manifest.hxx +++ b/libbbot/manifest.hxx @@ -183,7 +183,12 @@ namespace bbot // // Note: could be quoted. // - strings config; + strings target_config; + + // Whitespace separated list of potentially double/single-quoted package + // configuration arguments for bpkg-pkg-build command. + // + std::string package_config; // If true, then this configuration is self-hosted. // @@ -200,7 +205,7 @@ namespace bbot butl::optional<std::string> worker_checksum; strings - unquoted_config () const; + unquoted_target_config () const; strings unquoted_warning_regex () const; @@ -215,7 +220,8 @@ namespace bbot std::string mn, butl::target_triplet tg, butl::optional<std::string> en, - strings cf, + strings tc, + std::string pc, butl::optional<bool> ht, strings wr, butl::optional<std::string> ir, @@ -230,7 +236,8 @@ namespace bbot machine (std::move (mn)), target (std::move (tg)), environment (std::move (en)), - config (std::move (cf)), + target_config (std::move (tc)), + package_config (std::move (pc)), host (std::move (ht)), warning_regex (std::move (wr)), interactive (std::move (ir)), |