diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-19 09:18:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-19 09:18:29 +0200 |
commit | bd3fb4a1324228b768bfa1f34ab4ce12539eb45b (patch) | |
tree | c8a0e6bd089c9ca9d87181d1945d71e3be54a5bb /build2/target.cxx | |
parent | 43a1c24b089ae92bcf9a80584ebdf4c4011b9664 (diff) |
Add manifest{} target type ('manifest' file name automatically mapped as such)
Diffstat (limited to 'build2/target.cxx')
-rw-r--r-- | build2/target.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/build2/target.cxx b/build2/target.cxx index 201bd15..13db67e 100644 --- a/build2/target.cxx +++ b/build2/target.cxx @@ -1035,4 +1035,48 @@ namespace build2 &file_search, false }; + + static const char* + manifest_target_extension (const target_key& tk) + { + // If the name is special 'manifest', then there is no extension, + // otherwise it is .manifest. + // + return *tk.name == "manifest" ? "" : "manifest"; + } + + static bool + manifest_target_pattern (const target_type&, + const scope&, + string& v, + bool r) + { + size_t p (path::traits::find_extension (v)); + + if (r) + { + assert (p != string::npos); + v.resize (p); + } + else if (p == string::npos && v != "manifest") + { + v += ".manifest"; + return true; + } + + return false; + } + + const target_type manifest::static_type + { + "manifest", + &doc::static_type, + &target_factory<manifest>, + &manifest_target_extension, + nullptr, /* default_extension */ + &manifest_target_pattern, + nullptr, + &file_search, + false + }; } |