Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79665 - in trunk/tools/build/v2: build test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-07-22 03:40:53


Author: jurko
Date: 2012-07-22 03:40:52 EDT (Sun, 22 Jul 2012)
New Revision: 79665
URL: http://svn.boost.org/trac/boost/changeset/79665

Log:
Fixed a Boost Build bug with path feature requirements not getting expanded to a correct relative path depending on where the build was getting run from, if added by an indirect conditional feature rule. Fixes ticket http://svn.boost.org/trac/boost/ticket/7144. Thanks to dimak <dvb.kharkov _at_ gmail _dot_ com> for reporting this and preparing a reproducible test case.
Text files modified:
   trunk/tools/build/v2/build/targets.jam | 5 +++
   trunk/tools/build/v2/test/path_features.py | 53 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 57 insertions(+), 1 deletions(-)

Modified: trunk/tools/build/v2/build/targets.jam
==============================================================================
--- trunk/tools/build/v2/build/targets.jam (original)
+++ trunk/tools/build/v2/build/targets.jam 2012-07-22 03:40:52 EDT (Sun, 22 Jul 2012)
@@ -1005,7 +1005,10 @@
         # Evaluate indirect conditionals.
         for local i in $(indirect)
         {
- e += [ indirect.call $(i) $(current) ] ;
+ local t = [ current ] ;
+ local p = [ $(t).project ] ;
+ local new = [ indirect.call $(i) $(current) ] ;
+ e += [ property.translate-paths $(new) : [ $(p).location ] ] ;
         }
 
         if $(e) = $(added-requirements)

Modified: trunk/tools/build/v2/test/path_features.py
==============================================================================
--- trunk/tools/build/v2/test/path_features.py (original)
+++ trunk/tools/build/v2/test/path_features.py 2012-07-22 03:40:52 EDT (Sun, 22 Jul 2012)
@@ -94,6 +94,59 @@
     t.cleanup()
 
 
+def test_paths_set_by_indirect_conditionals():
+ t = BoostBuild.Tester(pass_d0=False)
+
+ header = "child_dir/folder_to_include/some_header.h"
+
+ t.write("jamroot.jam", "build-project child_dir ;")
+ t.write("child_dir/jamfile.jam", """\
+import remote/remote ;
+
+# If we set the <include>folder_to_include property directly, it will work
+obj x1 : x.cpp : <conditional>@attach-include-local ;
+obj x2 : x.cpp : <conditional>@remote/remote.attach-include-remote ;
+
+rule attach-include-local ( properties * )
+{
+ return <include>folder_to_include ;
+}
+""")
+ t.write("child_dir/remote/remote.jam", """\
+rule attach-include-remote ( properties * )
+{
+ return <include>folder_to_include ;
+}
+""")
+ t.write("child_dir/x.cpp", """\
+#include <some_header.h>
+int main() {}
+""")
+ t.write(header, "int some_func();\n")
+ t.write("child_dir/folder_to_include/jamfile.jam", "")
+
+ expected_x1 = "child_dir/bin/$toolset/debug/x1.obj"
+ expected_x2 = "child_dir/bin/$toolset/debug/x2.obj"
+
+ t.run_build_system()
+ t.expect_addition(expected_x1)
+ t.expect_addition(expected_x2)
+
+ t.touch(header)
+ t.run_build_system(subdir="child_dir")
+ t.expect_modification(expected_x1)
+ t.expect_modification(expected_x2)
+
+ t.touch(header)
+ t.run_build_system(["..", "-d2"], subdir="child_dir/folder_to_include")
+ t.expect_modification(expected_x1)
+ t.expect_modification(expected_x2)
+
+ t.cleanup()
+
+
+
 test_basic()
 test_absolute_paths()
 test_ordered_paths()
+test_paths_set_by_indirect_conditionals()
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk