aboutsummaryrefslogtreecommitdiff
path: root/build2/install/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-25 11:48:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-25 11:48:37 +0200
commitd69e09acb570030a56566739569867139f5d1f4b (patch)
tree94f21ae804595ce134a107c8f185d89747d48967 /build2/install/rule.cxx
parent5e2c26176cf48b65103251186a2bf321eda069a9 (diff)
Change default install filter to only accept prerequisites from amalgamation
Diffstat (limited to 'build2/install/rule.cxx')
-rw-r--r--build2/install/rule.cxx36
1 files changed, 26 insertions, 10 deletions
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 5184399..df25021 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -62,7 +62,8 @@ namespace build2
const target* alias_rule::
filter (action, const target& t, const prerequisite& p) const
{
- return &search (t, p);
+ const target& pt (search (t, p));
+ return pt.in (t.weak_scope ()) ? &pt : nullptr;
}
recipe alias_rule::
@@ -420,6 +421,7 @@ namespace build2
resolve (const scope& s,
const target* t,
dir_path d,
+ bool fail_unknown = true,
const string* var = nullptr)
{
install_dirs rs;
@@ -443,13 +445,25 @@ namespace build2
fail << "empty installation directory for name " << sn <<
info << "did you specified empty config." << var << "?";
- rs = resolve (s, t, *dn, &var);
+ rs = resolve (s, t, *dn, fail_unknown, &var);
+
+ if (rs.empty ())
+ {
+ assert (!fail_unknown);
+ return rs; // Empty.
+ }
+
d = rs.back ().dir / dir_path (++d.begin (), d.end ());
rs.emplace_back (move (d.normalize ()), rs.back ());
}
else
- fail << "unknown installation directory name '" << sn << "'" <<
- info << "did you forget to specify config." << var << "?";
+ {
+ if (fail_unknown)
+ fail << "unknown installation directory name '" << sn << "'" <<
+ info << "did you forget to specify config." << var << "?";
+
+ return rs; // Empty.
+ }
}
install_dir* r (&rs.back ());
@@ -495,21 +509,23 @@ namespace build2
}
static inline install_dirs
- resolve (const target& t, dir_path d, const string* var = nullptr)
+ resolve (const target& t, dir_path d, bool fail_unknown = true)
{
- return resolve (t.base_scope (), &t, d, var);
+ return resolve (t.base_scope (), &t, d, fail_unknown);
}
dir_path
- resolve_dir (const target& t, dir_path d)
+ resolve_dir (const target& t, dir_path d, bool fail_unknown)
{
- return move (resolve (t, move (d)).back ().dir);
+ install_dirs r (resolve (t, move (d), fail_unknown));
+ return r.empty () ? dir_path () : move (r.back ().dir);
}
dir_path
- resolve_dir (const scope& s, dir_path d)
+ resolve_dir (const scope& s, dir_path d, bool fail_unknown)
{
- return move (resolve (s, nullptr, move (d)).back ().dir);
+ install_dirs r (resolve (s, nullptr, move (d), fail_unknown));
+ return r.empty () ? dir_path () : move (r.back ().dir);
}
path