diff options
-rw-r--r-- | build2/buildfile | 161 | ||||
-rw-r--r-- | build2/function.cxx | 5 | ||||
-rw-r--r-- | build2/functions-process-path.cxx | 35 | ||||
-rw-r--r-- | unit-tests/function/buildfile | 3 | ||||
-rw-r--r-- | unit-tests/test/script/parser/buildfile | 5 |
5 files changed, 124 insertions, 85 deletions
diff --git a/build2/buildfile b/build2/buildfile index b87a3dc..fa6faef 100644 --- a/build2/buildfile +++ b/build2/buildfile @@ -4,86 +4,87 @@ import libs = libbutl%lib{butl} -exe{b}: \ - {hxx ixx cxx}{ algorithm } \ - { cxx}{ b } \ - {hxx ixx cxx}{ b-options } \ - {hxx cxx}{ context } \ - {hxx cxx}{ depdb } \ - {hxx cxx}{ diagnostics } \ - {hxx cxx}{ dump } \ - {hxx ixx cxx}{ file } \ - {hxx txx cxx}{ filesystem } \ - {hxx cxx}{ function } \ - { cxx}{ functions-path } \ - {hxx cxx}{ lexer } \ - {hxx cxx}{ module } \ - {hxx ixx cxx}{ name } \ - {hxx cxx}{ operation } \ - {hxx cxx}{ parser } \ - {hxx cxx}{ prerequisite } \ - {hxx cxx}{ rule } \ - {hxx }{ rule-map } \ - {hxx cxx}{ scope } \ - {hxx cxx}{ search } \ - {hxx cxx}{ spec } \ - {hxx ixx txx cxx}{ target } \ - {hxx }{ target-key } \ - {hxx }{ target-type } \ - {hxx cxx}{ token } \ - {hxx }{ types } \ - {hxx cxx}{ types-parsers } \ - {hxx ixx txx cxx}{ utility } \ - {hxx ixx txx cxx}{ variable } \ - {hxx }{ version } \ - bin/{hxx cxx}{ guess } \ - bin/{hxx cxx}{ init } \ - bin/{hxx cxx}{ rule } \ - bin/{hxx cxx}{ target } \ - c/{hxx cxx}{ init } \ - c/{hxx }{ target } \ - cc/{hxx cxx}{ common } \ - cc/{hxx cxx}{ compile } \ - cc/{ cxx}{ gcc } \ - cc/{hxx cxx}{ guess } \ - cc/{hxx cxx}{ init } \ - cc/{hxx cxx}{ install } \ - cc/{hxx cxx}{ link } \ - cc/{hxx cxx}{ module } \ - cc/{ cxx}{ msvc } \ - cc/{ cxx}{ pkgconfig } \ - cc/{hxx cxx}{ target } \ - cc/{hxx }{ types } \ - cc/{hxx ixx cxx}{ utility } \ - cc/{ cxx}{ windows-manifest } \ - cc/{ cxx}{ windows-rpath } \ - cli/{hxx cxx}{ init } \ - cli/{hxx cxx}{ rule } \ - cli/{hxx cxx}{ target } \ - config/{hxx cxx}{ init } \ - config/{hxx }{ module } \ - config/{hxx cxx}{ operation } \ - config/{hxx txx cxx}{ utility } \ - cxx/{hxx cxx}{ init } \ - cxx/{hxx cxx}{ target } \ - dist/{hxx cxx}{ init } \ - dist/{hxx cxx}{ operation } \ - dist/{hxx cxx}{ rule } \ - pkgconfig/{hxx cxx}{ init } \ - install/{hxx cxx}{ init } \ - install/{hxx cxx}{ operation } \ - install/{hxx cxx}{ rule } \ - install/{hxx }{ utility } \ - test/{hxx cxx}{ init } \ - test/{hxx cxx}{ operation } \ - test/{hxx cxx}{ rule } \ - test/{hxx cxx}{ target } \ -test/script/{hxx cxx}{ builtin } \ -test/script/{hxx cxx}{ lexer } \ -test/script/{hxx cxx}{ parser } \ -test/script/{hxx cxx}{ runner } \ -test/script/{hxx cxx}{ script } \ -test/script/{hxx cxx}{ token } \ +exe{b}: \ + {hxx ixx cxx}{ algorithm } \ + { cxx}{ b } \ + {hxx ixx cxx}{ b-options } \ + {hxx cxx}{ context } \ + {hxx cxx}{ depdb } \ + {hxx cxx}{ diagnostics } \ + {hxx cxx}{ dump } \ + {hxx ixx cxx}{ file } \ + {hxx txx cxx}{ filesystem } \ + {hxx cxx}{ function } \ + { cxx}{ functions-path } \ + { cxx}{ functions-process-path } \ + {hxx cxx}{ lexer } \ + {hxx cxx}{ module } \ + {hxx ixx cxx}{ name } \ + {hxx cxx}{ operation } \ + {hxx cxx}{ parser } \ + {hxx cxx}{ prerequisite } \ + {hxx cxx}{ rule } \ + {hxx }{ rule-map } \ + {hxx cxx}{ scope } \ + {hxx cxx}{ search } \ + {hxx cxx}{ spec } \ + {hxx ixx txx cxx}{ target } \ + {hxx }{ target-key } \ + {hxx }{ target-type } \ + {hxx cxx}{ token } \ + {hxx }{ types } \ + {hxx cxx}{ types-parsers } \ + {hxx ixx txx cxx}{ utility } \ + {hxx ixx txx cxx}{ variable } \ + {hxx }{ version } \ + bin/{hxx cxx}{ guess } \ + bin/{hxx cxx}{ init } \ + bin/{hxx cxx}{ rule } \ + bin/{hxx cxx}{ target } \ + c/{hxx cxx}{ init } \ + c/{hxx }{ target } \ + cc/{hxx cxx}{ common } \ + cc/{hxx cxx}{ compile } \ + cc/{ cxx}{ gcc } \ + cc/{hxx cxx}{ guess } \ + cc/{hxx cxx}{ init } \ + cc/{hxx cxx}{ install } \ + cc/{hxx cxx}{ link } \ + cc/{hxx cxx}{ module } \ + cc/{ cxx}{ msvc } \ + cc/{ cxx}{ pkgconfig } \ + cc/{hxx cxx}{ target } \ + cc/{hxx }{ types } \ + cc/{hxx ixx cxx}{ utility } \ + cc/{ cxx}{ windows-manifest } \ + cc/{ cxx}{ windows-rpath } \ + cli/{hxx cxx}{ init } \ + cli/{hxx cxx}{ rule } \ + cli/{hxx cxx}{ target } \ + config/{hxx cxx}{ init } \ + config/{hxx }{ module } \ + config/{hxx cxx}{ operation } \ + config/{hxx txx cxx}{ utility } \ + cxx/{hxx cxx}{ init } \ + cxx/{hxx cxx}{ target } \ + dist/{hxx cxx}{ init } \ + dist/{hxx cxx}{ operation } \ + dist/{hxx cxx}{ rule } \ + pkgconfig/{hxx cxx}{ init } \ + install/{hxx cxx}{ init } \ + install/{hxx cxx}{ operation } \ + install/{hxx cxx}{ rule } \ + install/{hxx }{ utility } \ + test/{hxx cxx}{ init } \ + test/{hxx cxx}{ operation } \ + test/{hxx cxx}{ rule } \ + test/{hxx cxx}{ target } \ +test/script/{hxx cxx}{ builtin } \ +test/script/{hxx cxx}{ lexer } \ +test/script/{hxx cxx}{ parser } \ +test/script/{hxx cxx}{ runner } \ +test/script/{hxx cxx}{ script } \ +test/script/{hxx cxx}{ token } \ $libs # Pass our compiler target to be used as build2 host. diff --git a/build2/function.cxx b/build2/function.cxx index 2f2db51..720a5c2 100644 --- a/build2/function.cxx +++ b/build2/function.cxx @@ -302,14 +302,15 @@ namespace build2 // function_map functions; - void - path_functions (); // functions-path.cxx + void path_functions (); // functions-path.cxx + void process_path_functions (); // functions-process-path.cxx struct functions_init { functions_init () { path_functions (); + process_path_functions (); } }; diff --git a/build2/functions-process-path.cxx b/build2/functions-process-path.cxx new file mode 100644 index 0000000..7069c33 --- /dev/null +++ b/build2/functions-process-path.cxx @@ -0,0 +1,35 @@ +// file : build2/functions-process-path.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <build2/function> +#include <build2/variable> + +using namespace std; + +namespace build2 +{ + void + process_path_functions () + { + function_family f ("process_path"); + + // As discussed in value_traits<process_path>, we always have recall. + // + f["recall"] = &process_path::recall; + f["effect"] = [](process_path p) + { + return move (p.effect.empty () ? p.recall : p.effect); + }; + + //@@ TMP kludge + // + f["effect"] = [](names n) + { + auto p (value_traits<process_path>::convert ( + move (n[0]), n.size () > 1 ? &n[1] : nullptr)); + + return move (p.effect.empty () ? p.recall : p.effect); + }; + } +} diff --git a/unit-tests/function/buildfile b/unit-tests/function/buildfile index 6c1d346..1efc7e1 100644 --- a/unit-tests/function/buildfile +++ b/unit-tests/function/buildfile @@ -7,7 +7,8 @@ import libs = libbutl%lib{butl} src = token lexer diagnostics utility variable name b-options types-parsers \ context scope parser target operation rule prerequisite file module function \ -functions-path algorithm search dump filesystem config/{utility init operation} +functions-path functions-process-path algorithm search dump filesystem \ +config/{utility init operation} exe{driver}: cxx{driver} ../../build2/cxx{$src} $libs test{call syntax} diff --git a/unit-tests/test/script/parser/buildfile b/unit-tests/test/script/parser/buildfile index af3f2d3..5025e60 100644 --- a/unit-tests/test/script/parser/buildfile +++ b/unit-tests/test/script/parser/buildfile @@ -7,8 +7,9 @@ import libs = libbutl%lib{butl} src = token lexer parser diagnostics utility variable name context target \ scope prerequisite file module operation rule b-options algorithm search \ -filesystem function functions-path config/{utility init operation} dump \ -types-parsers test/{target script/{token lexer parser script}} +filesystem function functions-path functions-process-path \ +config/{utility init operation} dump types-parsers test/{target \ +script/{token lexer parser script}} exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs \ test{cleanup command-if command-re-parse description exit expansion \ |