From 8f021f4bfc83d743fbb08c8aa907d3cbcb7487c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Fri, 29 Jun 2012 19:20:56 +0000 Subject: [PATCH] Boost Build cleanup - minor stylistic changes. Added some FIXME comments. [SVN r79176] --- src/build-system.jam | 12 ++-- src/build/configure.jam | 151 +++++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 77 deletions(-) diff --git a/src/build-system.jam b/src/build-system.jam index f76fed9e3..a824af826 100644 --- a/src/build-system.jam +++ b/src/build-system.jam @@ -719,14 +719,14 @@ local rule should-clean-project ( project ) generators.dump ; } - # We wish to put config.log in the build directory corresponding - # to Jamroot, so that the location does not differ depending on - # directory where we do build. The amount of indirection necessary - # here is scary. + # We wish to put config.log in the build directory corresponding to Jamroot, + # so that the location does not differ depending on the directory we run the + # build from. The amount of indirection necessary here is scary. local first-project = [ $(targets[0]).project ] ; local first-project-root-location = [ $(first-project).get project-root ] ; - local first-project-root-module = [ project.load $(first-project-root-location) ] ; - local first-project-root = [ project.target $(first-project-root-module) ] ; + local first-project-root-module = [ project.load + $(first-project-root-location) ] ; + local first-project-root = [ project.target $(first-project-root-module) ] ; local first-build-build-dir = [ $(first-project-root).build-dir ] ; configure.set-log-file $(first-build-build-dir)/config.log ; diff --git a/src/build/configure.jam b/src/build/configure.jam index 14c1328af..afba37f82 100644 --- a/src/build/configure.jam +++ b/src/build/configure.jam @@ -6,25 +6,23 @@ # This module defines function to help with two main tasks: # -# - Discovering build-time configuration for the purposes of adjusting -# build process. +# - Discovering build-time configuration for the purposes of adjusting the build +# process. # - Reporting what is built, and how it is configured. -import targets ; -import errors ; -import targets ; -import sequence ; -import property ; -import property-set ; import "class" : new ; import common ; import path ; +import property ; +import property-set ; +import targets ; + rule log-summary ( ) { - } + .width = 30 ; rule set-width ( width ) @@ -32,29 +30,33 @@ rule set-width ( width ) .width = $(width) ; } + # Declare that the components specified by the parameter exist. +# rule register-components ( components * ) { .components += $(components) ; } -# Declare that the components specified by the parameters will -# be build. + +# Declare that the components specified by the parameters will be built. +# rule components-building ( components * ) { .built-components += $(components) ; } -# Report something about component configuration that the -# user should better know. + +# Report something about component configuration that the user should better +# know. +# rule log-component-configuration ( component : message ) { - # FIXME: implement per-property-set logs + # FIXME: Implement per-property-set logs. .component-logs.$(component) += $(message) ; } - rule log-check-result ( result ) { if ! $(.announced-checks) @@ -62,22 +64,27 @@ rule log-check-result ( result ) ECHO "Performing configuration checks\n" ; .announced-checks = 1 ; } - - ECHO $(result) ; + + ECHO $(result) ; + # FIXME: Unfinished code. Nothing seems to set .check-results at the moment. #.check-results += $(result) ; } + rule log-library-search-result ( library : result ) { local x = [ PAD " - $(library) : $(result)" : $(.width) ] ; log-check-result "$(x)" ; } + rule print-component-configuration ( ) { - local c = [ sequence.unique $(.components) ] ; - + # FIXME: See what was intended with this initial assignment. + # local c = [ sequence.unique $(.components) ] ; + ECHO "\nComponent configuration:\n" ; + local c ; for c in $(.components) { local s ; @@ -93,70 +100,70 @@ rule print-component-configuration ( ) for local m in $(.component-logs.$(c)) { ECHO " -" $(m) ; - } + } } ECHO ; } + rule print-configure-checks-summary ( ) { - # FIXME: the problem with that approach is tha - # the user sees checks summary when all checks are - # done, and has no progress reporting while the - # checks are being executed. + # FIXME: The problem with this approach is that the user sees the checks + # summary when all checks are done, and has no progress reporting while the + # checks are being executed. if $(.check-results) - { + { ECHO "Configuration checks summary\n" ; - for local r in $(.check-results) { ECHO $(r) ; } ECHO ; - } + } } -# Attempt to build a metatarget named by 'metatarget-reference' -# in context of 'project' with properties 'ps'. -# Returns non-empty value if build is OK. + +# Attempt to build a metatarget named by 'metatarget-reference' in context of +# 'project' with properties 'ps'. Returns non-empty value if build is OK. +# rule builds-raw ( metatarget-reference : project : ps : what : retry ? ) -{ +{ local result ; - + if ! $(retry) && ! $(.$(what)-tested.$(ps)) - { + { .$(what)-tested.$(ps) = true ; - - local targets = [ targets.generate-from-reference + + local targets = [ targets.generate-from-reference $(metatarget-reference) : $(project) : $(ps) ] ; - + local jam-targets ; for local t in $(targets[2-]) { jam-targets += [ $(t).actualize ] ; } - + if ! UPDATE_NOW in [ RULENAMES ] { - # Cannot determine. Assume existance. + # Cannot determine. Assume existence. } - else - { - local x = [ PAD " - $(what)" : $(.width) ] ; + else + { + local x = [ PAD " - $(what)" : $(.width) ] ; if [ UPDATE_NOW $(jam-targets) : - $(.log-fd) : ignore-minus-n : ignore-minus-q ] + $(.log-fd) : ignore-minus-n : ignore-minus-q ] { .$(what)-supported.$(ps) = yes ; result = true ; log-check-result "$(x) : yes" ; - } + } else { log-check-result "$(x) : no" ; } - } + } return $(result) ; - } + } else { return $(.$(what)-supported.$(ps)) ; @@ -166,32 +173,33 @@ rule builds-raw ( metatarget-reference : project : ps : what : retry ? ) rule builds ( metatarget-reference : properties * : what ? : retry ? ) { what ?= "$(metatarget-reference) builds" ; - - # FIXME: this should not be hardcoded. Other checks might - # want to consider different set of features as relevant. + + # FIXME: This should not be hardcoded. Other checks might want to consider a + # different set of features as relevant. local toolset = [ property.select : $(properties) ] ; local toolset-version-property = "" ; - local relevant = [ property.select $(toolset-version-property) - - : $(properties) ] ; - local ps = [ property-set.create $(relevant) ] ; + local relevant = [ property.select + $(toolset-version-property) : + $(properties) ] ; + local ps = [ property-set.create $(relevant) ] ; local t = [ targets.current ] ; local p = [ $(t).project ] ; - return [ builds-raw $(metatarget-reference) : $(p) : $(ps) : $(what) : $(retry) ] ; + return [ builds-raw $(metatarget-reference) : $(p) : $(ps) : $(what) : + $(retry) ] ; } -# Called by Boost.Build startup code to specify name of a file -# that will receive results of configure checks. This -# should never be called by users. +# Called by Boost.Build startup code to specify the file to receive the +# configuration check results. Should never be called by user code. +# rule set-log-file ( log-file ) { path.makedirs [ path.parent $(log-file) ] ; - .log-fd = [ FILE_OPEN $(log-file) : "w" ] ; } + # Frontend rules class check-target-builds-worker @@ -199,39 +207,40 @@ class check-target-builds-worker import configure ; import property-set ; import targets ; - import property ; - - rule __init__ ( target message ? : true-properties * : false-properties * ) + import property ; + + rule __init__ ( target message ? : true-properties * : false-properties * ) { self.target = $(target) ; - self.message = $(message) ; + self.message = $(message) ; self.true-properties = $(true-properties) ; self.false-properties = $(false-properties) ; } - + rule check ( properties * ) { local choosen ; if [ configure.builds $(self.target) : $(properties) : $(self.message) ] { choosen = $(self.true-properties) ; - } + } else { choosen = $(self.false-properties) ; - } - return [ property.evaluate-conditionals-in-context $(choosen) : $(properties) ] ; - } + } + return [ property.evaluate-conditionals-in-context $(choosen) : + $(properties) ] ; + } } -rule check-target-builds ( target message ? : true-properties * : false-properties * ) +rule check-target-builds ( target message ? : true-properties * : + false-properties * ) { - local instance = [ new check-target-builds-worker $(target) $(message) : $(true-properties) - : $(false-properties) ] ; + local instance = [ new check-target-builds-worker $(target) $(message) : + $(true-properties) : $(false-properties) ] ; return @$(instance).check ; } + IMPORT $(__name__) : check-target-builds : : check-target-builds ; - -