aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-27 13:11:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-28 11:11:55 +0200
commit4f5c9357b7e17b4fb9ecaad36c8740a05cfc1bc6 (patch)
tree1849fdadad55c5efd9ee7e19d21f3915b626c9f7 /libbuild2/rule.hxx
parentf1c981a22365411794806ed0744b857ef0804e35 (diff)
Add support for rule-specific import phase 2
For example: import! [metadata, rule_hint=cxx.link] lib = libhello%lib{hello}
Diffstat (limited to 'libbuild2/rule.hxx')
-rw-r--r--libbuild2/rule.hxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx
index 77c2d2c..da069ef 100644
--- a/libbuild2/rule.hxx
+++ b/libbuild2/rule.hxx
@@ -52,6 +52,21 @@ namespace build2
rule (const rule&) = delete;
rule& operator= (const rule&) = delete;
+ // Resolve a project-qualified target in a rule-specific manner.
+ //
+ // This is optional functionality that may be provided by some rules to
+ // facilitate immediate importation of certain target types. See the
+ // import machinery for details. The default implementation always returns
+ // NULL.
+ //
+ // Note that if this function returns a target, it should have the
+ // extension assigned so that as_name() returns a stable name.
+ //
+ virtual const target*
+ import (const prerequisite_key&,
+ const optional<string>& metadata,
+ const location&) const;
+
// Sometimes we want to match only if another rule of ours would match
// another operation. For example, we would want our install rule to match
// only if our update rule also matches.