mirror of
https://github.com/boostorg/build.git
synced 2026-02-13 12:22:17 +00:00
Make dependency properties specified in project requirements
not cause errors in subprojects. * build/property.jam (tranlate-dependencies) New rule to bind dependency properties to the project that they are specified in. * build/property-set.jam (create-from-user-input) Add call to property.translate-dependencies * test/test_all.py test/inherited_dependency.py Test case for this fix. [SVN r47536]
This commit is contained in:
@@ -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) ] ;
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
55
test/inherited_dependency.py
Normal file
55
test/inherited_dependency.py
Normal file
@@ -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 <library>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 <library>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()
|
||||
@@ -168,7 +168,8 @@ tests = [ "rebuilds",
|
||||
"remove_requirement",
|
||||
"free_features_request",
|
||||
"file_name_handling",
|
||||
"sort_rule"
|
||||
"sort_rule",
|
||||
"inherited_dependency"
|
||||
]
|
||||
|
||||
if os.name == 'posix':
|
||||
|
||||
Reference in New Issue
Block a user