From a89f1e4f4efd291beedea03c65c8185b7d0df20e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Dec 2017 12:06:59 +0200 Subject: Distinguish between "fixed" and "default" target extensions This fixes wrong merging of, say, file{README} and file{README.MySQL} (in libmysqlclient). --- build2/test/target.cxx | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'build2/test') diff --git a/build2/test/target.cxx b/build2/test/target.cxx index a85546c..0bda827 100644 --- a/build2/test/target.cxx +++ b/build2/test/target.cxx @@ -11,27 +11,13 @@ namespace build2 { namespace test { - static pair> - testscript_factory (const target_type&, - dir_path d, - dir_path o, - string n, - optional e) - { - if (!e) - e = (n == "testscript" ? string () : "test"); - - return make_pair ( - new testscript (move (d), move (o), move (n)), move (e)); - } - - static optional - testscript_target_extension (const target_key& tk, const scope&, bool) + static const char* + testscript_target_extension (const target_key& tk) { // If the name is special 'testscript', then there is no extension, // otherwise it is .test. // - return *tk.name == "testscript" ? string () : "test"; + return *tk.name == "testscript" ? "" : "test"; } static bool @@ -60,8 +46,9 @@ namespace build2 { "test", &file::static_type, - &testscript_factory, + &target_factory, &testscript_target_extension, + nullptr, /* default_extension */ &testscript_target_pattern, nullptr, &file_search, -- cgit v1.1