From 02a6e3ad65a3d7ffd187dd4e7deea4ac40c565b6 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 1 Sep 2007 20:28:42 +0000 Subject: [PATCH] Fix glob excludes in subdirectories. Thanks to Norbert Unterberg for the bug report. [SVN r39103] --- v2/test/project_glob.py | 33 +++++++++++++++++++++++++++++++++ v2/util/path.jam | 2 ++ 2 files changed, 35 insertions(+) diff --git a/v2/test/project_glob.py b/v2/test/project_glob.py index 39ec39305..fe76b6870 100644 --- a/v2/test/project_glob.py +++ b/v2/test/project_glob.py @@ -143,5 +143,38 @@ exe a : [ glob $(pwd)/src/foo/*.cpp $(pwd)/src/bar/*.cpp ] ../d2/d//l ; t.run_build_system(subdir="d1") t.expect_addition("d1/bin/$toolset/debug/a.exe") +# Regression test: glob excludes used to be broken +# when building from a subdirectory. +t.rm(".") + +t.write("Jamroot", """ +build-project p ; +""") + +t.write("p/p.c", """ +int main() +{ + return 0; +} + + +""") + +t.write("p/p_x.c", """ +int main() +{ + return 0; +} + +""") + +t.write("p/Jamfile", """ +exe p : + [ glob *.c : p_x.c ] + ; +""") + +t.run_build_system(subdir="p") +t.expect_addition("p/bin/$toolset/debug/p.exe") t.cleanup() diff --git a/v2/util/path.jam b/v2/util/path.jam index c7fdf801d..989b5649e 100644 --- a/v2/util/path.jam +++ b/v2/util/path.jam @@ -243,7 +243,9 @@ rule glob ( dirs * : patterns + : exclude-patterns * ) } local inc = [ GLOB-RECURSIVELY $(real-patterns) ] ; + inc = [ sequence.transform NORMALIZE_PATH : $(inc) ] ; local exc = [ GLOB-RECURSIVELY $(real-exclude-patterns) ] ; + exc = [ sequence.transform NORMALIZE_PATH : $(exc) ] ; return [ sequence.transform path.make : [ set.difference $(inc) : $(exc) ] ] ;