aboutsummaryrefslogtreecommitdiff
path: root/libbbot/build-config.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbbot/build-config.cxx')
-rw-r--r--libbbot/build-config.cxx34
1 files changed, 33 insertions, 1 deletions
diff --git a/libbbot/build-config.cxx b/libbbot/build-config.cxx
index 23935e3..de9a71d 100644
--- a/libbbot/build-config.cxx
+++ b/libbbot/build-config.cxx
@@ -12,6 +12,9 @@
#include <libbutl/path.mxx>
#include <libbutl/fdstream.mxx>
#include <libbutl/tab-parser.mxx>
+#include <libbutl/string-parser.mxx>
+
+#include <libbpkg/manifest.hxx> // build_class_term::validate_name()
#include <libbbot/manifest.hxx> // task_manifest::check_config()
@@ -53,7 +56,7 @@ namespace bbot
build_config config;
config.machine_pattern = move (tl[i++].value);
- // Configuration name field is a required one.
+ // Configuration name, target and classes fields are the required ones.
//
if (i == n)
bad_line ("no configuration name found");
@@ -80,6 +83,35 @@ namespace bbot
bad_line (e.what ());
}
+ if (++i == n)
+ bad_line ("no classes found");
+
+ // Parse a potentially quoted class list.
+ //
+ try
+ {
+ // We don't expect the class names be quotes as they cannot contain
+ // spaces.
+ //
+ using namespace string_parser;
+ config.classes = parse_quoted (unquote (tl[i].value),
+ false /* unquote */);
+
+ // Validate the class names.
+ //
+ for (const string& c: config.classes)
+ {
+ if (c == "none")
+ throw invalid_argument ("class 'none' is reserved");
+
+ bpkg::build_class_term::validate_name (c);
+ }
+ }
+ catch (const invalid_argument& e)
+ {
+ bad_line (e.what ());
+ }
+
try
{
for (++i; i < n; ++i)