From b3633d94b0ec44575c7bbc0a741bf0e388beba72 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 29 Oct 2019 18:39:34 +0300 Subject: Add support for environment task manifest value --- libbbot/build-config.cxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'libbbot/build-config.cxx') diff --git a/libbbot/build-config.cxx b/libbbot/build-config.cxx index 1e8b8dc..65a64ab 100644 --- a/libbbot/build-config.cxx +++ b/libbbot/build-config.cxx @@ -68,7 +68,8 @@ namespace bbot // bool placeholder (config.machine_pattern == "-"); - // Configuration name, target and classes fields are the required ones. + // Configuration name, target[/environment] and classes fields are the + // required ones. // if (i == n) bad_line ("no configuration name found"); @@ -89,7 +90,27 @@ namespace bbot if (!placeholder) try { - config.target = target_triplet (tl[i].value); + const string& v (tl[i].value); + + // Extract the environment name, if present. + // + size_t p (v.find ('/')); + + if (p != string::npos) + { + string env (v, p + 1); + + if (env.empty ()) + bad_line ("empty environment"); + + config.environment = move (env); + } + + // Parse the target triplet. + // + config.target = target_triplet (p != string::npos + ? string (v, 0, p) + : v); } catch (const invalid_argument& e) { -- cgit v1.1