From 5974cab56148a18628bfb423189e016ade2d40f9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 31 Aug 2015 13:45:57 +0200 Subject: Rework scoping logic Now the src directory is entered into the scope map and points to the same scope as out. This means that targets that are in src, not out (e.g., source files) will "see" rules, variables, etc. This becomes important when we try, for example, to install a source file (say, a header) from src: we need the rule as well as the install.* variables. --- tests/scope/amalgamation/build/bootstrap.build | 3 ++ tests/scope/amalgamation/buildfile | 1 + tests/scope/amalgamation/l1/build/bootstrap.build | 16 ++++++++++ tests/scope/amalgamation/l1/buildfile | 37 ++++++++++++++++++++++ .../scope/amalgamation/l1/l2/build/bootstrap.build | 2 ++ 5 files changed, 59 insertions(+) create mode 100644 tests/scope/amalgamation/build/bootstrap.build create mode 100644 tests/scope/amalgamation/buildfile create mode 100644 tests/scope/amalgamation/l1/build/bootstrap.build create mode 100644 tests/scope/amalgamation/l1/buildfile create mode 100644 tests/scope/amalgamation/l1/l2/build/bootstrap.build (limited to 'tests/scope/amalgamation') diff --git a/tests/scope/amalgamation/build/bootstrap.build b/tests/scope/amalgamation/build/bootstrap.build new file mode 100644 index 0000000..ee73365 --- /dev/null +++ b/tests/scope/amalgamation/build/bootstrap.build @@ -0,0 +1,3 @@ +project = scope-amalgamation +amalgamation = # Disabled. +using config diff --git a/tests/scope/amalgamation/buildfile b/tests/scope/amalgamation/buildfile new file mode 100644 index 0000000..9f80de9 --- /dev/null +++ b/tests/scope/amalgamation/buildfile @@ -0,0 +1 @@ +./: diff --git a/tests/scope/amalgamation/l1/build/bootstrap.build b/tests/scope/amalgamation/l1/build/bootstrap.build new file mode 100644 index 0000000..6bde838 --- /dev/null +++ b/tests/scope/amalgamation/l1/build/bootstrap.build @@ -0,0 +1,16 @@ +project = scope-amalgamation-l1 +using config + +# At this stage we don't know ../ is a project. This +# tests an out-of-project scope that will later be +# replaced with an in-project scope. Note that the +# replacement will only occur if src_root != out_root. +# If they are the same, then this scope will simply +# be "upgraded". +# +$src_root/../: +{ + print 0: $project + print 0: $src_base + print 0: $out_base +} diff --git a/tests/scope/amalgamation/l1/buildfile b/tests/scope/amalgamation/l1/buildfile new file mode 100644 index 0000000..55d8c64 --- /dev/null +++ b/tests/scope/amalgamation/l1/buildfile @@ -0,0 +1,37 @@ +# Out of amalgamation. +# +../../: +{ + print -1: $project + print -1: $src_base + print -1: $out_base +} + +# In amalgamation. +# +../s/: +{ + print 0: $project + print 0: $src_base + print 0: $out_base +} + +# In project. +# +s/: +{ + print 1: $project + print 1: $src_base + print 1: $out_base +} + +# In sub-project. +# +l2/s/: +{ + print 2: $project + print 2: $src_base + print 2: $out_base +} + +./: diff --git a/tests/scope/amalgamation/l1/l2/build/bootstrap.build b/tests/scope/amalgamation/l1/l2/build/bootstrap.build new file mode 100644 index 0000000..0262763 --- /dev/null +++ b/tests/scope/amalgamation/l1/l2/build/bootstrap.build @@ -0,0 +1,2 @@ +project = scope-amalgamation-l2 +using config -- cgit v1.1