diff options
-rw-r--r-- | libbbot/manifest.cxx | 26 | ||||
-rw-r--r-- | tests/manifest/task.testscript | 18 |
2 files changed, 35 insertions, 9 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx index c604810..3f07091 100644 --- a/libbbot/manifest.cxx +++ b/libbbot/manifest.cxx @@ -530,6 +530,11 @@ namespace bbot optional<name_value> repo_url; optional<repository_type> repo_type; + // We will also cache the requires values to parse them later, after the + // package name is parsed. + // + vector<name_value> reqs; + for (nv = p.next (); !nv.empty (); nv = p.next ()) { string& n (nv.name); @@ -602,14 +607,7 @@ namespace bbot } else if (n == "requires") { - try - { - requirements.push_back (requirement_alternatives (v)); - } - catch (const invalid_argument& e) - { - bad_value (e.what ()); - } + reqs.push_back (move (nv)); } else if (n == "tests" || n == "examples" || n == "benchmarks") { @@ -754,6 +752,18 @@ namespace bbot nv = move (*repo_url); // Restore as bad_value() uses its line/column. bad_value (string ("invalid task repository URL: ") + e.what ()); } + + // Parse the requirements. + // + for (const name_value& r: reqs) + { + requirements.push_back ( + requirement_alternatives (r.value, + name, + p.name (), + r.value_line, + r.value_column)); + } } void task_manifest:: diff --git a/tests/manifest/task.testscript b/tests/manifest/task.testscript index 2d50914..bd1a365 100644 --- a/tests/manifest/task.testscript +++ b/tests/manifest/task.testscript @@ -79,13 +79,29 @@ test.options += -t name: foo version: 1.0 repository-url: http://pkg.example.org/1/math - requires: c++14 + requires: {c++ >= 14 windows} requires: host machine: windows target: x86_64-microsoft-win32-msvc14.0 EOF } + : requires-invalid + : + { + $* <<EOI 2>>EOE != 0 + : 1 + name: foo + version: 1.0 + repository-url: http://pkg.example.org/1/math + requires: {c++ >= 14 windows + machine: windows + target: x86_64-microsoft-win32-msvc14.0 + EOI + stdin:5:29: error: requirement or '}' expected + EOE + } + : tests : { |