2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Implement a somewhat better link-compatibility check.

* new/targets.jam
  (basic-target.check-for-link-compatibility): New rule.
  (basic-target.generate-sources, basic-target.generate): Call the above.


[SVN r20191]
This commit is contained in:
Vladimir Prus
2003-09-26 11:13:42 +00:00
parent 2ee0f0be56
commit 16abe38d49
4 changed files with 78 additions and 36 deletions

View File

@@ -876,6 +876,8 @@ class basic-target : abstract-target
local more-targets =
[ targets.generate-from-reference $(s) : $(self.project)
: $(property-set) ] ;
check-for-link-compatibility $(more-targets[2-]) : $(property-set) ;
usage-requirements = [ $(usage-requirements).add $(more-targets[1]) ] ;
source-targets += $(more-targets[2-]) ;
@@ -919,9 +921,11 @@ class basic-target : abstract-target
rproperties =
[ targets.generate-dependencies $(rproperties) : $(self.project)
: $(rproperties) ] ;
: $(rproperties) ] ;
usage-requirements = [ $(usage-requirements).add $(rproperties[1]) ] ;
rproperties = $(rproperties[2-]) ;
local deps = [ $(rproperties).dependency ] ;
check-for-link-compatibility $(deps:G=) : $(property-set) ;
local source-target-groups = [ generate-sources $(rproperties) ] ;
@@ -1044,6 +1048,35 @@ class basic-target : abstract-target
}
}
# Checks if 'targets' are link-compatible with 'build-request' and
# issues a warning if that's not the case.
local rule check-for-link-compatibility ( targets * : build-request )
{
local checked ;
for local t in $(targets)
{
local a = [ $(t).action ] ;
if $(a)
{
local p = [ $(a).properties-ps ] ;
if ! $(p) in $(cheched)
{
if [ $(p).link-incompatible-with $(build-request) ]
{
local dg = [ $(t).dg ] ;
local other-mt = [ $(dg).main-target ] ;
ECHO "warning: targets produced from" [ $(other-mt).name ]
"are link incompatible" ;
ECHO "warning: with main target" [ name ] ;
}
}
checked += $(p) ;
}
}
}
# Constructs the virtual targets for this abstract targets and
# the dependecy graph. Returns the list of virtual targets.

View File

@@ -35,25 +35,13 @@ t.expect_content("bin/$toolset/debug/main-target-b.exe/b.exe",
"bin/$toolset/debug/a.obj\n"
)
# TODO: restore this test when we have new notion of link-compatibility
#t.copy("lib/Jamfile3", "lib/Jamfile")
#t.run_build_system(status=None)
#t.fail_test(find(t.stdout(), "warning: skipped build of lib/b.obj with properties") \
# != 0)
t.copy("lib/Jamfile3", "lib/Jamfile")
# Check that project can be skipped as well
#t.copy("Jamfile4", "Jamfile")
#expected="warning: skipping build of project at lib2 due to unsatisfied requirements."
#t.run_build_system("rtti=on")
#t.fail_test(find(t.stdout(), expected) != 0)
#t.copy("lib2/Jamfile2", "lib2/Jamfile")
#expected="warning: skipping build of project /mylib at lib2 due to unsatisfied\nrequirements."
#t.run_build_system("rtti=on")
#t.fail_test(find(t.stdout(), expected) != 0)
t.run_build_system(status=None)
t.fail_test(find(t.stdout(),
"""warning: targets produced from b.obj are link incompatible
warning: with main target a.exe""") !=-0)
# We don't yet make targets depend on Jamfile, so need to start from scratch
# The following test is disabled, because of problems related to

View File

@@ -876,6 +876,8 @@ class basic-target : abstract-target
local more-targets =
[ targets.generate-from-reference $(s) : $(self.project)
: $(property-set) ] ;
check-for-link-compatibility $(more-targets[2-]) : $(property-set) ;
usage-requirements = [ $(usage-requirements).add $(more-targets[1]) ] ;
source-targets += $(more-targets[2-]) ;
@@ -919,9 +921,11 @@ class basic-target : abstract-target
rproperties =
[ targets.generate-dependencies $(rproperties) : $(self.project)
: $(rproperties) ] ;
: $(rproperties) ] ;
usage-requirements = [ $(usage-requirements).add $(rproperties[1]) ] ;
rproperties = $(rproperties[2-]) ;
local deps = [ $(rproperties).dependency ] ;
check-for-link-compatibility $(deps:G=) : $(property-set) ;
local source-target-groups = [ generate-sources $(rproperties) ] ;
@@ -1044,6 +1048,35 @@ class basic-target : abstract-target
}
}
# Checks if 'targets' are link-compatible with 'build-request' and
# issues a warning if that's not the case.
local rule check-for-link-compatibility ( targets * : build-request )
{
local checked ;
for local t in $(targets)
{
local a = [ $(t).action ] ;
if $(a)
{
local p = [ $(a).properties-ps ] ;
if ! $(p) in $(cheched)
{
if [ $(p).link-incompatible-with $(build-request) ]
{
local dg = [ $(t).dg ] ;
local other-mt = [ $(dg).main-target ] ;
ECHO "warning: targets produced from" [ $(other-mt).name ]
"are link incompatible" ;
ECHO "warning: with main target" [ name ] ;
}
}
checked += $(p) ;
}
}
}
# Constructs the virtual targets for this abstract targets and
# the dependecy graph. Returns the list of virtual targets.

View File

@@ -35,25 +35,13 @@ t.expect_content("bin/$toolset/debug/main-target-b.exe/b.exe",
"bin/$toolset/debug/a.obj\n"
)
# TODO: restore this test when we have new notion of link-compatibility
#t.copy("lib/Jamfile3", "lib/Jamfile")
#t.run_build_system(status=None)
#t.fail_test(find(t.stdout(), "warning: skipped build of lib/b.obj with properties") \
# != 0)
t.copy("lib/Jamfile3", "lib/Jamfile")
# Check that project can be skipped as well
#t.copy("Jamfile4", "Jamfile")
#expected="warning: skipping build of project at lib2 due to unsatisfied requirements."
#t.run_build_system("rtti=on")
#t.fail_test(find(t.stdout(), expected) != 0)
#t.copy("lib2/Jamfile2", "lib2/Jamfile")
#expected="warning: skipping build of project /mylib at lib2 due to unsatisfied\nrequirements."
#t.run_build_system("rtti=on")
#t.fail_test(find(t.stdout(), expected) != 0)
t.run_build_system(status=None)
t.fail_test(find(t.stdout(),
"""warning: targets produced from b.obj are link incompatible
warning: with main target a.exe""") !=-0)
# We don't yet make targets depend on Jamfile, so need to start from scratch
# The following test is disabled, because of problems related to