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

Change <dependency>, so that it does not really add dependency

unconditionally.

* new/builtin.jam
     (linking-generator.run): New rule. Sets dependency on <library>
     properties.

* new/generators.jam
     (construct): Do not handle usage requirements. Do not handle
     dependency features in any way.

* new/targets.jam
     (main-target.generate-really): Don't create/set subvariant-dg.
     (basic-target.generate): Collect usage requirements. Create/set
     subvariant-dg.

* new/virtual-target.jam
     (subvariant-dg): Take actual build properties together with
     requested ones.


[SVN r17813]
This commit is contained in:
Vladimir Prus
2003-03-11 12:41:39 +00:00
parent 873676c2ec
commit a64edbb6eb
10 changed files with 132 additions and 92 deletions

View File

@@ -575,6 +575,30 @@ rule linking-generator ( id composing ? : source-types + : target-types + :
composing ?= true ;
generator.__init__ $(id) $(composing) : $(source-types) : $(target-types) :
$(requirements) ;
rule run ( project name ? : property-set : sources + : multiple ? )
{
local result = [ generator.run $(project) $(name) : $(property-set)
: $(sources) : $(multiple) ] ;
if $(result)
{
# Explicitly set dependency on all <library> features.
local libs = [ feature.get-values <library> :
[ $(property-set).raw ] ] ;
if $(libs)
{
for local t in $(result)
{
$(t).depends $(libs:G=) ;
}
}
}
return $(result) ;
}
rule action-class ( )
{

View File

@@ -907,17 +907,10 @@ local rule construct-without-caching (
# targets.
rule construct ( project name ? : target-type multiple ? : property-set * : sources * )
{
local usage-requirements ;
if (.construct-stack)
{
ensure-type $(sources) ;
for local e in $(sources)
{
usage-requirements += [ $(e).usage-requirements ] ;
}
}
property-set = [ $(property-set).add
[ property-set.create $(usage-requirements) ] ] ;
.construct-stack += 1 ;
@@ -950,17 +943,6 @@ rule construct ( project name ? : target-type multiple ? : property-set * : sour
if ! $(.construct-stack) # This is first invocation in stack
{
# Make roots of dependency graph depend on all 'dependency' features.
local dp = [ $(property-set).dependency ] ;
if $(dp)
{
for local t in $(result)
{
$(t).depends $(dp:G=) ;
}
}
local result2 ;
for local t in $(result)
{

View File

@@ -384,23 +384,7 @@ rule main-target ( name : project )
else
{
local result = [ $(best-alternatives).generate $(property-set) ] ;
# Mark all targets in result as roots
for local t in $(result)
{
$(t).root true ;
}
# Process all vtargets that will be created if this main target
# is created.
local all-targets =
[ sequence.transform virtual-target.traverse : $(result) ] ;
local dg = [ new subvariant-dg $(__name__) : $(property-set) : $(all-targets) ] ;
for local v in $(all-targets)
{
$(v).dg $(dg) ;
}
# Now return virtual targets for the only alternative
return $(result) ;
}
@@ -607,10 +591,20 @@ rule basic-target ( name : project
{
local source-targets = [ generate-sources $(rproperties) ] ;
self.generated.$(property-set) =
# Grab usage requirements from source targets
local usage-requirements ;
for local e in $(source-targets)
{
usage-requirements += [ $(e).usage-requirements ] ;
}
rproperties = [ $(rproperties).add
[ property-set.create $(usage-requirements) ] ] ;
local result =
[ construct $(source-targets) : $(rproperties) ] ;
check-for-unused-sources
$(self.generated.$(property-set)) : $(source-targets) ;
$(result) : $(source-targets) ;
# Apply use requirement of this target to all generated
# virtual targets.
@@ -620,10 +614,24 @@ rule basic-target ( name : project
: $(self.project) : $(rproperties) ] ;
xusage-requirements = [ $(xusage-requirements).raw ] ;
for local e in $(self.generated.$(property-set))
for local e in $(result)
{
$(e).set-usage-requirements $(xusage-requirements) ;
$(e).root true ;
}
# Process all vtargets that will be created if this main target
# is created.
local all-targets =
[ sequence.transform virtual-target.traverse : $(result) ] ;
local dg = [ new subvariant-dg $(__name__) : $(property-set)
: $(rproperties) : $(all-targets) ] ;
for local v in $(all-targets)
{
$(v).dg $(dg) ;
}
self.generated.$(property-set) = $(result) ;
}
else
{

View File

@@ -865,20 +865,24 @@ local rule clone-action-template ( action from cloned-from : new-source )
local rule subvariant-dg ( main-target # The instance of main-target class
: property-set # Properties requested for this target
: actual-properties # Actual used properties
: virtual-targets * )
{
self.main-target = $(main-target) ;
self.properties = $(property-set) ;
self.actual-properties = $(actual-properties) ;
self.virtual-targets = $(virtual-targets) ;
# Pre-compose the list of other dependency graphs, on which this one
# depends
local deps = [ $(actual-properties).dependency ] ;
for local d in $(deps)
{
self.other-dg += [ $(d:G=).dg ] ;
}
for local t in $(virtual-targets)
{
for local d in [ $(t).dependencies ]
{
self.other-dg += [ $(d).dg ] ;
}
local a = [ $(t).action ] ;
if $(a)
{
@@ -891,8 +895,9 @@ local rule subvariant-dg ( main-target # The instance of main-target class
}
}
}
self.other-dg = [ sequence.unique $(self.other-dg) ] ;
rule main-target ( )
{
return $(self.main-target) ;

View File

@@ -22,7 +22,10 @@ t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/b.exe")
t.expect_touch("bin/$toolset/debug/b.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
# Now, <dependency> does not add dependency.
# It sound weird, but is intentional. Need
# to rename <dependency> eventually.
#t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()
# Only 'a' include <a.h> and should be updated
@@ -31,7 +34,6 @@ t.run_build_system()
t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()
# "src/a.h" includes "b.h" (in the same dir)
@@ -39,7 +41,6 @@ t.touch("src1/b.h")
t.run_build_system()
t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()
# included by "src/b.h". We had a bug: file included via "",

View File

@@ -907,17 +907,10 @@ local rule construct-without-caching (
# targets.
rule construct ( project name ? : target-type multiple ? : property-set * : sources * )
{
local usage-requirements ;
if (.construct-stack)
{
ensure-type $(sources) ;
for local e in $(sources)
{
usage-requirements += [ $(e).usage-requirements ] ;
}
}
property-set = [ $(property-set).add
[ property-set.create $(usage-requirements) ] ] ;
.construct-stack += 1 ;
@@ -950,17 +943,6 @@ rule construct ( project name ? : target-type multiple ? : property-set * : sour
if ! $(.construct-stack) # This is first invocation in stack
{
# Make roots of dependency graph depend on all 'dependency' features.
local dp = [ $(property-set).dependency ] ;
if $(dp)
{
for local t in $(result)
{
$(t).depends $(dp:G=) ;
}
}
local result2 ;
for local t in $(result)
{

View File

@@ -384,23 +384,7 @@ rule main-target ( name : project )
else
{
local result = [ $(best-alternatives).generate $(property-set) ] ;
# Mark all targets in result as roots
for local t in $(result)
{
$(t).root true ;
}
# Process all vtargets that will be created if this main target
# is created.
local all-targets =
[ sequence.transform virtual-target.traverse : $(result) ] ;
local dg = [ new subvariant-dg $(__name__) : $(property-set) : $(all-targets) ] ;
for local v in $(all-targets)
{
$(v).dg $(dg) ;
}
# Now return virtual targets for the only alternative
return $(result) ;
}
@@ -607,10 +591,20 @@ rule basic-target ( name : project
{
local source-targets = [ generate-sources $(rproperties) ] ;
self.generated.$(property-set) =
# Grab usage requirements from source targets
local usage-requirements ;
for local e in $(source-targets)
{
usage-requirements += [ $(e).usage-requirements ] ;
}
rproperties = [ $(rproperties).add
[ property-set.create $(usage-requirements) ] ] ;
local result =
[ construct $(source-targets) : $(rproperties) ] ;
check-for-unused-sources
$(self.generated.$(property-set)) : $(source-targets) ;
$(result) : $(source-targets) ;
# Apply use requirement of this target to all generated
# virtual targets.
@@ -620,10 +614,24 @@ rule basic-target ( name : project
: $(self.project) : $(rproperties) ] ;
xusage-requirements = [ $(xusage-requirements).raw ] ;
for local e in $(self.generated.$(property-set))
for local e in $(result)
{
$(e).set-usage-requirements $(xusage-requirements) ;
$(e).root true ;
}
# Process all vtargets that will be created if this main target
# is created.
local all-targets =
[ sequence.transform virtual-target.traverse : $(result) ] ;
local dg = [ new subvariant-dg $(__name__) : $(property-set)
: $(rproperties) : $(all-targets) ] ;
for local v in $(all-targets)
{
$(v).dg $(dg) ;
}
self.generated.$(property-set) = $(result) ;
}
else
{

View File

@@ -865,20 +865,24 @@ local rule clone-action-template ( action from cloned-from : new-source )
local rule subvariant-dg ( main-target # The instance of main-target class
: property-set # Properties requested for this target
: actual-properties # Actual used properties
: virtual-targets * )
{
self.main-target = $(main-target) ;
self.properties = $(property-set) ;
self.actual-properties = $(actual-properties) ;
self.virtual-targets = $(virtual-targets) ;
# Pre-compose the list of other dependency graphs, on which this one
# depends
local deps = [ $(actual-properties).dependency ] ;
for local d in $(deps)
{
self.other-dg += [ $(d:G=).dg ] ;
}
for local t in $(virtual-targets)
{
for local d in [ $(t).dependencies ]
{
self.other-dg += [ $(d).dg ] ;
}
local a = [ $(t).action ] ;
if $(a)
{
@@ -891,8 +895,9 @@ local rule subvariant-dg ( main-target # The instance of main-target class
}
}
}
self.other-dg = [ sequence.unique $(self.other-dg) ] ;
rule main-target ( )
{
return $(self.main-target) ;

View File

@@ -22,7 +22,10 @@ t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/b.exe")
t.expect_touch("bin/$toolset/debug/b.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
# Now, <dependency> does not add dependency.
# It sound weird, but is intentional. Need
# to rename <dependency> eventually.
#t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()
# Only 'a' include <a.h> and should be updated
@@ -31,7 +34,6 @@ t.run_build_system()
t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()
# "src/a.h" includes "b.h" (in the same dir)
@@ -39,7 +41,6 @@ t.touch("src1/b.h")
t.run_build_system()
t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()
# included by "src/b.h". We had a bug: file included via "",

View File

@@ -575,6 +575,30 @@ rule linking-generator ( id composing ? : source-types + : target-types + :
composing ?= true ;
generator.__init__ $(id) $(composing) : $(source-types) : $(target-types) :
$(requirements) ;
rule run ( project name ? : property-set : sources + : multiple ? )
{
local result = [ generator.run $(project) $(name) : $(property-set)
: $(sources) : $(multiple) ] ;
if $(result)
{
# Explicitly set dependency on all <library> features.
local libs = [ feature.get-values <library> :
[ $(property-set).raw ] ] ;
if $(libs)
{
for local t in $(result)
{
$(t).depends $(libs:G=) ;
}
}
}
return $(result) ;
}
rule action-class ( )
{