2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-21 15:02:19 +00:00

Don't skip alias targets due to <build>no in ureqs (#97)

Adds rule skip-from-usage-requirements to basic-target, this allows
customizing whether the build of a target should be skipped because one
of its sources has <build>no in usage requirements. So far only one
class takes advantage of this: alias-target-class. As a result alias
targets aren't skipped due to dependencies, but downstream targets still
could.
So, lib <- alias <- exe skips exe if lib is skipped.
But lib <- alias -> lib does not skip alias if either of libs is
skipped.
This commit is contained in:
Dmitry
2021-10-03 18:14:46 +03:00
committed by GitHub
parent c86b033368
commit c56fb27395
2 changed files with 27 additions and 5 deletions

View File

@@ -49,6 +49,10 @@ class alias-target-class : basic-target
local base = [ basic-target.compute-usage-requirements $(subvariant) ] ;
return [ $(base).add [ $(subvariant).sources-usage-requirements ] ] ;
}
rule skip-from-usage-requirements ( )
{
}
}

View File

@@ -1321,11 +1321,13 @@ class basic-target : abstract-target
}
local skip ;
local skip-downstream ;
if $(rproperties[1]) = "@error"
{
ECHO [ targets.indent ] "Skipping build of:" [ full-name ]
"cannot compute common properties" ;
skip = true ;
skip-downstream = true ;
}
else if [ $(rproperties).get <build> ] = no
{
@@ -1334,6 +1336,7 @@ class basic-target : abstract-target
# to explain why a target is not built, for example using
# the configure.log-component-configuration function.
skip = true ;
skip-downstream = true ;
}
else
{
@@ -1355,14 +1358,16 @@ class basic-target : abstract-target
}
# Skipping this target if a dependency is skipped.
# Consider letting subclasses override this behavior. E.g.
# alias-target-class may override this to not fail to build if
# a dependency fails.
# Subclasses can override this behavior. E.g.
# alias-target-class overrides this to not be skipped if a
# dependency is skipped.
if <build>no in $(usage-requirements)
{
skip = true ;
skip = [ skip-from-usage-requirements ] ;
skip-downstream = true ;
}
else
if ! $(skip)
{
rproperties = [ property-set.create $(properties)
$(usage-requirements) ] ;
@@ -1416,6 +1421,11 @@ class basic-target : abstract-target
}
local ur = [ compute-usage-requirements $(s) ] ;
if $(skip-downstream)
{
ur = [ $(ur).add [ property-set.create <build>no ]
] ;
}
ur = [ $(ur).add $(gur) ] ;
$(s).set-usage-requirements $(ur) ;
if [ modules.peek : .debug-building ]
@@ -1587,6 +1597,14 @@ class basic-target : abstract-target
import errors : error : errors.error ;
errors.error "method should be defined in derived classes" ;
}
# Determines if build of this target should be skipped when there is
# <build>no in usage requirements. This should usually be true, unless
# the target is some kind of grouping, e.g. alias targets.
rule skip-from-usage-requirements ( )
{
return true ;
}
}