diff --git a/src/build/property-set.jam b/src/build/property-set.jam index b3217f0da..d3e76a35d 100644 --- a/src/build/property-set.jam +++ b/src/build/property-set.jam @@ -378,10 +378,15 @@ rule create-with-validation ( raw-properties * ) # rule create-from-user-input ( raw-properties * : jamfile-module location ) { + import project ; + import path ; local specification = [ property.translate-paths $(raw-properties) : $(location) ] ; specification = [ property.translate-indirect $(specification) : $(jamfile-module) ] ; + local project-id = [ project.attribute $(jamfile-module) id ] ; + project-id ?= [ path.root [ project.attribute $(jamfile-module) location ] [ path.pwd ] ] ; + specification = [ property.translate-dependencies $(specification) : $(project-id) ] ; specification = [ property.expand-subfeatures-in-conditions $(specification) ] ; specification = [ property.make $(specification) ] ; diff --git a/src/build/property.jam b/src/build/property.jam index 92b59673a..66bd96858 100644 --- a/src/build/property.jam +++ b/src/build/property.jam @@ -511,6 +511,35 @@ rule translate-indirect ( specification * : context-module ) return $(result) ; } +rule translate-dependencies ( specification * : project-id ) +{ + local result ; + for local p in $(specification) + { + local split = [ split-conditional $(p) ] ; + local condition = "" ; + if $(split) + { + condition = $(split[1]): ; + p = $(split[2]) ; + } + + if dependency in [ feature.attributes $(p:G) ] + { + if [ regex.match (.*//.*) : $(p:G=) ] { + result += $(condition)$(p) ; + } else { + result += $(condition)$(p:G)$(project-id)//$(p:G=) ; + } + } + else + { + result += $(condition)$(p) ; + } + } + return $(result) ; +} + # Class maintaining a property set -> string mapping. # diff --git a/test/inherited_dependency.py b/test/inherited_dependency.py new file mode 100644 index 000000000..cb74163c2 --- /dev/null +++ b/test/inherited_dependency.py @@ -0,0 +1,55 @@ +#!/usr/bin/python +# +# Copyright (c) 2008 Steven Watanabe +# +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt) or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +from BoostBuild import Tester + +tester = Tester() + +# test without giving the project an explicit id. +tester.write("Jamroot", """ + lib test : test.cpp ; + project : requirements test ; + build-project a ; +""") + +tester.write("test.cpp", """ + #ifdef _WIN32 + __declspec(dllexport) + #endif + void foo() {} +""") + +tester.write("a/test1.cpp", """ + int main() {} +""") + +tester.write("a/Jamfile", """ + exe test1 : test1.cpp ; +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.rm("bin") +tester.rm("a/bin") + +# this time, do give the project an id. +tester.write("Jamroot", """ + lib test : test.cpp ; + project test_project : requirements test ; + build-project a ; +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.cleanup() diff --git a/test/test_all.py b/test/test_all.py index 13e878498..b7f6c3da4 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -168,7 +168,8 @@ tests = [ "rebuilds", "remove_requirement", "free_features_request", "file_name_handling", - "sort_rule" + "sort_rule", + "inherited_dependency" ] if os.name == 'posix':