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

Instead of don't returning targets which are not of requested type

from generators.construct, return them with 'intermediate' flag.


[SVN r21565]
This commit is contained in:
Vladimir Prus
2004-01-09 11:55:32 +00:00
parent 131cf1eefe
commit 2742a1f4e7
6 changed files with 59 additions and 12 deletions

View File

@@ -49,6 +49,11 @@ class alias-target-class : basic-target
rule check-for-link-compatibility ( * : * )
{
}
rule check-for-unused-sources ( * : * )
{
}
rule compute-usage-requirements ( subvariant )
{

View File

@@ -451,6 +451,7 @@ class generator
for local t in $(targets)
{
$(t).action $(a) ;
$(t).set-intermediate true ;
}
return [ sequence.transform virtual-target.register : $(targets) ] ;
@@ -1007,7 +1008,20 @@ rule construct ( project name ? : target-type multiple ? : property-set * : sour
{
ensure-type $(sources) ;
}
if ! $(.construct-stack)
{
local sources2 ;
for local s in $(sources)
{
if ! [ $(s).intermediate ]
{
sources2 += $(s) ;
}
}
sources = $(sources2) ;
}
.construct-stack += 1 ;
increase-indent ;
@@ -1037,6 +1051,7 @@ rule construct ( project name ? : target-type multiple ? : property-set * : sour
.construct-stack = $(.construct-stack[2-]) ;
# For all targets of 'allowed-type', reset the 'intermediate' attribute.
if ! $(.construct-stack) && $(allowed-type) != * # This is first invocation in stack
{
local result2 ;
@@ -1052,14 +1067,12 @@ rule construct ( project name ? : target-type multiple ? : property-set * : sour
# checking for unused sources a bit harder.
if $(type) = $(target-type) || [ type.is-derived $(type) $(allowed-type) ]
{
result2 += $(t) ;
$(t).set-intermediate ;
}
}
return $(result2) ;
}
else
{
return $(result) ;
}
return $(result) ;
}

View File

@@ -978,9 +978,12 @@ class basic-target : abstract-target
}
# Check that each source virtual target is either directly present in the
# result, or is in dependency graph of some returned virtual target.
# If this is not the case, issues a warning.
# Check that each source virtual target which is not marked as intermediate
# is present dependency graph of 'result'.
# If this is not the case, issues a warning.
# Sources which are directly presentin result are not considered used, and
# a warning will be issued for them as well.
#
# Note that 'result' *can* be empty. For
# example, in this use case:
# alias platform-sources ;
@@ -988,18 +991,30 @@ class basic-target : abstract-target
# result will be empty in the first case.
local rule check-for-unused-sources ( result * : sources * )
{
local isources ;
for local i in $(sources)
{
if ! [ $(i).intermediate ]
{
isources += $(i) ;
}
}
sources = $(isources) ;
local used-sources ;
for local r in $(result)
{
used-sources += [ virtual-target.traverse $(r) : include-roots : 1 ] ;
}
# Consider sources which are bypassed as unused
used-sources = [ set.difference $(used-sources) : $(result) ] ;
local unused = [ set.difference $(sources) : $(used-sources) ] ;
if $(unused)
{
for local u in $(unused)
{
errors.warning "Unused source" [ $(u).str ] "in main target" [ full-name ] ;
errors.warning "Unused source" [ $(u).str ] "in main target" [ full-name ] ;
}
}
}

View File

@@ -258,6 +258,18 @@ class abstract-file-target : virtual-target
}
return $(self.root) ;
}
rule set-intermediate ( value ? )
{
self.intermediate = $(value) ;
}
rule intermediate ( )
{
return $(self.intermediate) ;
}
# Gets or sets the subvariant which created this target. Subvariant
# is set when target is brought into existance, and is never changed
@@ -913,6 +925,7 @@ rule clone-template ( target dont-recurse ? : new-source : new-project )
{
local cloned = [ new file-target $(new-name) : [ $(target).type ] :
$(new-project) ] ;
$(cloned).set-intermediate [ $(target).intermediate ] ;
if ! $(dont-recurse) && [ $(target).action ]
{

View File

@@ -631,6 +631,7 @@ class linking-generator : generator
{
local libs = [ $(property-set).get <library> ] ;
sources += $(libs:G=) ;
if [ $(property-set).get <hardcode-dll-paths> ] = true
{

View File

@@ -146,7 +146,7 @@ class stage-target-class : basic-target
local result ;
for local i in $(source-targets)
{
if [ $(i).type ] != SEARCHED_LIB
if ! [ $(i).intermediate ] && [ $(i).type ] != SEARCHED_LIB
{
local staged-targets ;