aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-01-29 22:41:17 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-01-30 12:05:53 +0300
commit9277075f1c42bbc7b1f4b1d7635c20f3a80ee565 (patch)
tree1e41253f4c50aad4a599b1acefd0872175b6625b
parentec14eabf9c2cb4630d384a256479b80e93f6a6d5 (diff)
Add support for $ and shortcut operator in dependency constraint
-rw-r--r--build2/version/init.cxx34
-rw-r--r--build2/version/rule.cxx17
2 files changed, 28 insertions, 23 deletions
diff --git a/build2/version/init.cxx b/build2/version/init.cxx
index 9884d58..2c80cec 100644
--- a/build2/version/init.cxx
+++ b/build2/version/init.cxx
@@ -120,27 +120,13 @@ namespace build2
string d (v, b, e - b);
trim (d);
- p = d.find_first_of (" \t=<>[(");
+ p = d.find_first_of (" \t=<>[(~^");
string n (d, 0, p);
string c (p != string::npos ? string (d, p) : string ());
trim (n);
trim (c);
- // If this is a dependency on the build system itself, check
- // it (so there is no need for explicit using build@X.Y.Z).
- //
- if (n == "build2" && !c.empty ())
- try
- {
- check_build_version (standard_version_constraint (c), l);
- }
- catch (const invalid_argument& e)
- {
- fail (l) << "invalid version constraint for dependency "
- << d << ": " << e;
- }
-
try
{
ds.emplace (project_name (move (n)).variable (), move (c));
@@ -192,6 +178,24 @@ namespace build2
committed = false;
}
+ // If there is a dependency on the build system itself, check it (so
+ // there is no need for explicit using build@X.Y.Z).
+ //
+ {
+ auto i (ds.find ("build2"));
+
+ if (i != ds.end () && !i->second.empty ())
+ try
+ {
+ check_build_version (standard_version_constraint (i->second, v), l);
+ }
+ catch (const invalid_argument& e)
+ {
+ fail (l) << "invalid version constraint for dependency build2 "
+ << i->second << ": " << e;
+ }
+ }
+
// Set all the version.* variables.
//
auto& vp (var_pool.rw (rs));
diff --git a/build2/version/rule.cxx b/build2/version/rule.cxx
index b7b0b84..1ff5b41 100644
--- a/build2/version/rule.cxx
+++ b/build2/version/rule.cxx
@@ -135,8 +135,6 @@ namespace build2
// of the MT-safety.
//
standard_version_constraint c;
-
- try
{
auto i (m.dependencies.find (pn));
@@ -146,12 +144,15 @@ namespace build2
if (i->second.empty ())
fail (l) << "no version constraint for dependency " << pn;
- c = standard_version_constraint (i->second);
- }
- catch (const invalid_argument& e)
- {
- fail (l) << "invalid version constraint for dependency " << pn
- << ": " << e;
+ try
+ {
+ c = standard_version_constraint (i->second, m.version);
+ }
+ catch (const invalid_argument& e)
+ {
+ fail (l) << "invalid version constraint for dependency " << pn
+ << " " << i->second << ": " << e;
+ }
}
// Now substitute.