From 6362c4e4eda8340eedc73dfdbf6b92b281ccbadd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Mar 2017 11:51:24 +0200 Subject: Implement support for wildcard patterns --- build2/test/target.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'build2/test/target.cxx') 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 -- cgit v1.1