From 95c875b1dd12a52f0d120480c8b498c9c3da36ab Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 3 Feb 2021 10:19:15 -0600 Subject: [PATCH] Remove fixed list of configure relevant features. 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 --- src/build/configure.jam | 65 ++++++++++++----------------------------- test/configure.py | 34 ++++++++++----------- test/flags.py | 12 ++++---- 3 files changed, 42 insertions(+), 69 deletions(-) diff --git a/src/build/configure.jam b/src/build/configure.jam index 646b05a035..821e0082fd 100644 --- a/src/build/configure.jam +++ b/src/build/configure.jam @@ -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 @@ -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 : ; -# -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 : - ; - - rule log-summary ( ) { } @@ -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 ; @@ -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 ] @@ -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) @@ -406,29 +391,19 @@ rule find-builds-raw ( project : ps : what : * ) } } -rule get-relevant-features ( ) +rule get-relevant-features ( properties * ) { - local relevant = [ feature.expand ] ; - local result = ; - for local f in $(relevant) - { - if $(f) != - { - 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 : .subfeatures ] ; - 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 ] ; @@ -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 ] ; @@ -594,8 +569,7 @@ rule check-target-builds ( target message ? : true-properties * : local rulename = [ indirect.make check : $(instance) ] ; return @$(rulename) [ property.evaluate-conditional-relevance - $(true-properties) $(false-properties) - : [ configure.get-relevant-features ] ] ; + $(true-properties) $(false-properties) ] ; } # Usage: @@ -612,8 +586,7 @@ rule choose ( message : * ) local rulename = [ indirect.make check : $(instance) ] ; return @$(rulename) [ property.evaluate-conditional-relevance - [ $(instance).all-properties ] - : [ configure.get-relevant-features ] ] ; + [ $(instance).all-properties ] ] ; } diff --git a/test/configure.py b/test/configure.py index 9e47af2e5e..ffeced3e0b 100644 --- a/test/configure.py +++ b/test/configure.py @@ -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") @@ -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") @@ -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") @@ -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") @@ -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([ @@ -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") diff --git a/test/flags.py b/test/flags.py index bdb2b6b7dc..c9af560c90 100644 --- a/test/flags.py +++ b/test/flags.py @@ -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')