diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-10 11:51:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-10 11:51:24 +0200 |
commit | 6362c4e4eda8340eedc73dfdbf6b92b281ccbadd (patch) | |
tree | c4878757293cc61398e257b96b0a30914e85e3a6 /build2/test/target.cxx | |
parent | a81d3fb9160b3032124bdc58e76619b724ccdb6c (diff) |
Implement support for wildcard patterns
Diffstat (limited to 'build2/test/target.cxx')
-rw-r--r-- | build2/test/target.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/build2/test/target.cxx b/build2/test/target.cxx index 3bf00c1..b6f9854 100644 --- a/build2/test/target.cxx +++ b/build2/test/target.cxx @@ -34,12 +34,35 @@ namespace build2 return *tk.name == "testscript" ? string () : "test"; } + static bool + testscript_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 != "testscript") + { + v += ".test"; + return true; + } + + return false; + } + const target_type testscript::static_type { "test", &file::static_type, &testscript_factory, &testscript_target_extension, + &testscript_target_pattern, nullptr, &search_file, false |