Skip to content

Commit

Permalink
Remove fixed list of configure relevant features.
Browse files Browse the repository at this point in the history
This change removes the "hard wired" set of features that are relevant
for a configure check. And instead uses the dynamic base properties
of the target property set. Hence always giving the minimal set of
unique properties for the configure check. This also adds output to
the configure items showing what that feature set is.

fixes #582
  • Loading branch information
grafikrobot committed Feb 3, 2021
1 parent 9a550c6 commit 95c875b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 69 deletions.
65 changes: 19 additions & 46 deletions src/build/configure.jam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) 2010 Vladimir Prus.
# Copyright 2017 Rene Rivera.
# Copyright 2017-2021 Rene Rivera.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
Expand Down Expand Up @@ -27,23 +27,6 @@ import utility ;
import virtual-target ;


# The configure feature allows external definition of what features are
# relevant for doing configuration builds. One can add additional relevant
# features by using:
#
# import feature ;
# import configure ;
# feature.compose <configure> : <threading> ;
#
feature.feature configure : : composite optional ;

# This is the initial set of relevant features. Note that subfeature of all
# relevant features are also considered relevant.
#
feature.compose <configure> :
<target-os> <toolset> <address-model> <architecture> <cxxstd> ;


rule log-summary ( )
{
}
Expand Down Expand Up @@ -173,9 +156,11 @@ rule maybe-force-rebuild ( targets * )
# Attempts to build a set of virtual targets
rule try-build ( targets * : ps : what : retry ? )
{
local cache-name = $(what) [ $(ps).raw ] ;
local cache-props = [ $(ps).raw ] ;
local cache-name = $(what) $(cache-props) ;
cache-name = $(cache-name:J=-) ;
local value = [ config-cache.get $(cache-name) ] ;
local cache-min = [ SORT [ feature.minimize $(cache-props) ] ] ;

local result ;
local jam-targets ;
Expand All @@ -194,11 +179,11 @@ rule try-build ( targets * : ps : what : retry ? )
{
.$(what)-supported.$(ps) = yes ;
result = true ;
log-check-result "$(x) : yes (cached)" ;
log-check-result "$(x) : yes (cached) : $(cache-min:E=:J= )" ;
}
else
{
log-check-result "$(x) : no (cached)" ;
log-check-result "$(x) : no (cached) : $(cache-min:E=:J= )" ;
}
}
else if ! UPDATE_NOW in [ RULENAMES ]
Expand All @@ -213,11 +198,11 @@ rule try-build ( targets * : ps : what : retry ? )
{
.$(what)-supported.$(ps) = yes ;
result = true ;
log-check-result "$(x) : yes" ;
log-check-result "$(x) : yes : $(cache-min:E=:J= )" ;
}
else
{
log-check-result "$(x) : no" ;
log-check-result "$(x) : no : $(cache-min:E=:J= )" ;
}
}
if ! $(value)
Expand Down Expand Up @@ -406,29 +391,19 @@ rule find-builds-raw ( project : ps : what : * )
}
}

rule get-relevant-features ( )
rule get-relevant-features ( properties * )
{
local relevant = [ feature.expand <configure> ] ;
local result = ;
for local f in $(relevant)
{
if $(f) != <configure>
{
local sub = [ modules.peek feature : $(f).subfeatures ] ;
local name = [ utility.ungrist $(f) ] ;
result += $(f) <$(name)-$(sub)> ;
}
}
return $(result) ;
local ps-full = [ property-set.create $(properties) ] ;
local ps-base = [ property-set.create [ $(ps-full).base ] ] ;
local ps-relevant = [ property-set.create
[ feature.expand-subfeatures [ feature.minimize [ $(ps-base).raw ] ] ] ] ;

return [ $(ps-relevant).raw ] ;
}

rule builds ( metatarget-reference : properties * : what ? : retry ? )
{
local toolset-subfeatures = [ modules.peek feature : <toolset>.subfeatures ] ;
toolset-subfeatures = <toolset-$(toolset-subfeatures)> ;
# FIXME: This should not be hardcoded. Other checks might want to consider a
# different set of features as relevant.
local relevant = [ property.select [ get-relevant-features ] : $(properties) ] ;
local relevant = [ get-relevant-features $(properties) ] ;
local ps = [ property-set.create $(relevant) ] ;
local t = [ targets.current ] ;
local p = [ $(t).project ] ;
Expand All @@ -446,7 +421,7 @@ rule builds ( metatarget-reference : properties * : what ? : retry ? )

rule find-builds ( what : properties * : * )
{
local relevant = [ property.select [ get-relevant-features ] : $(properties) ] ;
local relevant = [ get-relevant-features $(properties) ] ;
local ps = [ property-set.create $(relevant) ] ;
local t = [ targets.current ] ;
local p = [ $(t).project ] ;
Expand Down Expand Up @@ -594,8 +569,7 @@ rule check-target-builds ( target message ? : true-properties * :
local rulename = [ indirect.make check : $(instance) ] ;
return <conditional>@$(rulename)
[ property.evaluate-conditional-relevance
$(true-properties) $(false-properties)
: [ configure.get-relevant-features ] ] ;
$(true-properties) $(false-properties) ] ;
}

# Usage:
Expand All @@ -612,8 +586,7 @@ rule choose ( message : * )
local rulename = [ indirect.make check : $(instance) ] ;
return <conditional>@$(rulename)
[ property.evaluate-conditional-relevance
[ $(instance).all-properties ]
: [ configure.get-relevant-features ] ] ;
[ $(instance).all-properties ] ] ;
}


Expand Down
34 changes: 17 additions & 17 deletions test/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def test_check_target_builds():
""")
t.run_build_system()
t.expect_output_lines([
" - pass builds : yes",
" - fail builds : no"])
" - pass builds : yes*",
" - fail builds : no*"])
t.expect_addition("bin/$toolset/debug*/pass.obj")
t.expect_addition("bin/$toolset/debug*/foo.obj")
t.expect_addition("bin/$toolset/debug*/bar.obj")
Expand All @@ -43,15 +43,15 @@ def test_check_target_builds():
# An up-to-date build should use the cache
t.run_build_system()
t.expect_output_lines([
" - pass builds : yes (cached)",
" - fail builds : no (cached)"])
" - pass builds : yes (cached)*",
" - fail builds : no (cached)*"])
t.expect_nothing_more()

# -a should re-run everything, including configuration checks
t.run_build_system(["-a"])
t.expect_output_lines([
" - pass builds : yes",
" - fail builds : no"])
" - pass builds : yes*",
" - fail builds : no*"])
t.expect_touch("bin/$toolset/debug*/pass.obj")
t.expect_touch("bin/$toolset/debug*/foo.obj")
t.expect_touch("bin/$toolset/debug*/bar.obj")
Expand All @@ -60,23 +60,23 @@ def test_check_target_builds():
# --reconfigure should re-run configuration checks only
t.run_build_system(["--reconfigure"])
t.expect_output_lines([
" - pass builds : yes",
" - fail builds : no"])
" - pass builds : yes*",
" - fail builds : no*"])
t.expect_touch("bin/$toolset/debug*/pass.obj")
t.expect_nothing_more()

# -a -n should not rebuild configuration checks
t.run_build_system(["-a", "-n"])
t.expect_output_lines([
" - pass builds : yes (cached)",
" - fail builds : no (cached)"])
" - pass builds : yes (cached)*",
" - fail builds : no (cached)*"])
t.expect_nothing_more()

# --clean-all should clear all configuration checks
t.run_build_system(["--clean-all"])
t.expect_output_lines([
" - pass builds : yes (cached)",
" - fail builds : no (cached)"])
" - pass builds : yes (cached)*",
" - fail builds : no (cached)*"])
t.expect_removal("bin/$toolset/debug*/pass.obj")
t.expect_removal("bin/$toolset/debug*/foo.obj")
t.expect_removal("bin/$toolset/debug*/bar.obj")
Expand All @@ -96,8 +96,8 @@ def test_check_target_builds():
# state here.
t.run_build_system()
t.expect_output_lines([
" - pass builds : yes",
" - fail builds : no"])
" - pass builds : yes*",
" - fail builds : no*"])
t.expect_addition("bin/$toolset/debug*/pass.obj")
t.expect_addition("bin/$toolset/debug*/foo.obj")
t.expect_addition("bin/$toolset/debug*/bar.obj")
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_choose():
t.expect_touch("bin/$toolset/debug*/pass.obj")
t.expect_touch("bin/$toolset/debug*/foo.obj")
t.expect_nothing_more()

# --reconfigure should re-run configuration checks only
t.run_build_system(["--reconfigure"])
t.expect_output_lines([
Expand Down Expand Up @@ -226,8 +226,8 @@ def test_translation():
""")
t.run_build_system(["subdir"])
t.expect_output_lines([
" - pass builds : yes",
" - fail builds : no"])
" - pass builds : yes*",
" - fail builds : no*"])
t.expect_addition("subdir/bin/$toolset/debug*/pass.obj")
t.expect_addition("subdir/bin/$toolset/debug*/foo.obj")
t.expect_addition("subdir/bin/$toolset/debug*/bar.obj")
Expand Down
12 changes: 6 additions & 6 deletions test/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
BoostBuild.annotation("config.log", log_file)
t.fail_test(True)

t.expect_output_lines([' - has --illegal-flag-cpp : no',
' - has -DMACRO_CPP : yes',
' - has --illegal-flag-c : no',
' - has -DMACRO_C : yes',
' - has --illegal-flag-link : no',
' - has *bin*/input.* : yes'])
t.expect_output_lines([' - has --illegal-flag-cpp : no*',
' - has -DMACRO_CPP : yes*',
' - has --illegal-flag-c : no*',
' - has -DMACRO_C : yes*',
' - has --illegal-flag-link : no*',
' - has *bin*/input.* : yes*'])
t.expect_addition('bin/$toolset/debug*/fail_cpp.obj')
t.expect_addition('bin/$toolset/debug*/pass_cpp.obj')
t.expect_addition('bin/$toolset/debug*/fail_c.obj')
Expand Down

0 comments on commit 95c875b

Please sign in to comment.