From c2b4305349ca855c497904282db354de56c74842 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 Aug 2018 14:59:07 +0200 Subject: Add support for default extension specification, trailing dot escaping For example: cxx{*}: extension = cxx cxx{foo} # foo.cxx cxx{foo.test} # foo.test (probably what we want...) cxx{foo.test...} # foo.test.cxx (... is this) cxx{foo..} # foo. cxx{foo....} # foo.. cxx{foo.....} # error (must come in escape pair) --- build2/test/target.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'build2/test') diff --git a/build2/test/target.cxx b/build2/test/target.cxx index a517240..25afd0d 100644 --- a/build2/test/target.cxx +++ b/build2/test/target.cxx @@ -24,19 +24,24 @@ namespace build2 testscript_target_pattern (const target_type&, const scope&, string& v, + optional& e, + const location& l, bool r) { - size_t p (path::traits::find_extension (v)); - if (r) { - assert (p != string::npos); - v.resize (p); + assert (e); + e = nullopt; } - else if (p == string::npos && v != "testscript") + else { - v += ".test"; - return true; + e = target::split_name (v, l); + + if (!e && v != "testscript") + { + e = "test"; + return true; + } } return false; -- cgit v1.1