diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-07 14:59:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-07 14:59:07 +0200 |
commit | e4f41c7319261b9585bd501256664679457e1d9d (patch) | |
tree | 21ef10a30d932a3172080de2690c6e38d851d0e2 /build2/test/target.cxx | |
parent | 7149c8eaeec3efcfc9da0f89c9ae979ff2c07fd5 (diff) |
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)
Diffstat (limited to 'build2/test/target.cxx')
-rw-r--r-- | build2/test/target.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/build2/test/target.cxx b/build2/test/target.cxx index a517240..57e2cb5 100644 --- a/build2/test/target.cxx +++ b/build2/test/target.cxx @@ -24,18 +24,17 @@ namespace build2 testscript_target_pattern (const target_type&, const scope&, string& v, + optional<string>& e, 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 if (!e && v != "testscript") { - v += ".test"; + e = "test"; return true; } |