diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-06-28 09:44:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-06-28 09:44:15 +0200 |
commit | 3cc5e3bd441fc9d18fece3d9e99fae75c78438e7 (patch) | |
tree | a9a08c453370847e0d352d47e19fbfcb7cc757ef /build2/install | |
parent | c0f72d47fc25981dcc1f55e12dfa0fdba7b70242 (diff) |
Implement support for excluded and ad hoc prerequisites
The inclusion/exclusion is controlled via the 'include' prerequisite-specific
variable. Valid values are:
false - exclude
true - include
adhoc - include but treat as an ad hoc input
For example:
lib{foo}: cxx{win32-utility}: include = ($cxx.targe.class == 'windows')
exe{bar}: libs{plugin}: include = adhoc
Diffstat (limited to 'build2/install')
-rw-r--r-- | build2/install/rule.cxx | 20 | ||||
-rw-r--r-- | build2/install/rule.hxx | 4 |
2 files changed, 19 insertions, 5 deletions
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index 4b50a35..58182cb 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -82,6 +82,13 @@ namespace build2 { const prerequisite& p (i->prerequisite); + // Ignore excluded. + // + include_type pi (include (a, t, p)); + + if (!pi) + continue; + // Ignore unresolved targets that are imported from other projects. // We are definitely not installing those. // @@ -119,7 +126,7 @@ namespace build2 } build2::match (a, *pt); - pts.push_back (pt); + pts.push_back (prerequisite_target (pt, pi)); } return default_recipe; @@ -228,7 +235,7 @@ namespace build2 } build2::match (a, *mt); - pts.push_back (mt); + pts.push_back (mt); // Never ad hoc. } } @@ -292,6 +299,13 @@ namespace build2 { const prerequisite& p (i->prerequisite); + // Ignore excluded. + // + include_type pi (include (a, t, p)); + + if (!pi) + continue; + // Ignore unresolved targets that are imported from other projects. // We are definitely not installing those. // @@ -327,7 +341,7 @@ namespace build2 // static installable content (headers, documentation, etc). // if (!build2::match (a, *pt, unmatch::unchanged)) - pts.push_back (pt); + pts.push_back (prerequisite_target (pt, pi)); } if (a.operation () == update_id) diff --git a/build2/install/rule.hxx b/build2/install/rule.hxx index 8bb2fa3..20b30a1 100644 --- a/build2/install/rule.hxx +++ b/build2/install/rule.hxx @@ -9,8 +9,8 @@ #include <build2/utility.hxx> #include <build2/rule.hxx> +#include <build2/action.hxx> #include <build2/target.hxx> -#include <build2/operation.hxx> #include <build2/filesystem.hxx> namespace build2 @@ -24,7 +24,7 @@ namespace build2 match (action, target&, const string&) const override; // Return NULL if this prerequisite should be ignored and pointer to its - // target otherwise. The default implementation accepts prerequsites + // target otherwise. The default implementation accepts all prerequsites // from the target's (weak) amalgamation. // // The prerequisite it passed as an iterator allowing the filter to |