Index: build/config-cache.jam =================================================================== --- build/config-cache.jam (revision 0) +++ build/config-cache.jam (working copy) @@ -0,0 +1,79 @@ +# Copyright 2012 Steven Watanabe +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +import modules ; +import errors ; +import regex ; +import path ; +import project ; + +rule get ( name ) +{ + return $(.vars.$(name)) ; +} + +rule set ( name : value * ) +{ + .all-vars += $(name) ; + .vars.$(name) = $(value) ; +} + +rule save ( ) +{ + if $(.cache-file) + { + local target = $(.cache-file) ; + local contents = "# Automatically generated by Boost.Build.\n# Do not edit.\n\nmodule config-cache {\n" ; + for local var in $(.all-vars) + { + local transformed ; + for local value in $(.vars.$(var)) + { + transformed += [ regex.escape $(value) : \"\\ : \\ ] ; + } + local quoted = \"$(transformed)\" ; + contents += " set \"$(var)\" : $(quoted) ;\n" ; + } + contents += "}\n" ; + FILE_CONTENTS on $(target) = $(contents) ; + ALWAYS $(target) ; + config-cache.write $(target) ; + UPDATE_NOW $(target) : [ modules.peek configure : .log-fd ] : ignore-minus-n ; + } +} + +actions write +{ + @($(STDOUT):E=$(FILE_CONTENTS:J=)) > "$(<)" +} + +rule load ( cache-file ? ) +{ + if $(.cache-file) + { + errors.error duplicate load of cache file ; + } + if $(cache-file) + { + cache-file = $(cache-file) ; + } + else + { + local global-build-dir = [ project.global-build-dir ] ; + if $(global-build-dir) + { + cache-file = [ path.join $(global-build-dir) project-cache.jam ] ; + } + else + { + local project-root = [ project.find-project-root "." ] ; + cache-file = [ path.join $(project-root) "project-cache.jam" ] ; + } + } + if [ path.exists $(cache-file) ] && ! ( --reconfigure in [ modules.peek : ARGV ] ) + { + include $(cache-file) ; + } + .cache-file = $(cache-file) ; +} Property changes on: build/config-cache.jam ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: build/configure.jam =================================================================== --- build/configure.jam (revision 80856) +++ build/configure.jam (working copy) @@ -16,6 +16,7 @@ import property ; import property-set ; import targets ; +import config-cache ; rule log-summary ( ) @@ -134,7 +135,11 @@ { .$(what)-tested.$(ps) = true ; - local targets = [ targets.generate-from-reference + local cache-name = $(what) [ $(ps).raw ] ; + cache-name = $(cache-name:J=-) ; + local value = [ config-cache.get $(cache-name) ] ; + + local targets = [ targets.generate-from-reference $(metatarget-reference) : $(project) : $(ps) ] ; local jam-targets ; @@ -142,10 +147,24 @@ { jam-targets += [ $(t).actualize ] ; } - - if ! UPDATE_NOW in [ RULENAMES ] + + if $(value) { - # Cannot determine. Assume existence. + local x = [ PAD " - $(what)" : $(.width) ] ; + if $(value) = true + { + .$(what)-supported.$(ps) = yes ; + result = true ; + log-check-result "$(x) : yes (cached)" ; + } + else + { + log-check-result "$(x) : no (cached)" ; + } + } + else if ! UPDATE_NOW in [ RULENAMES ] + { + # Cannot determine. Assume existance. } else { @@ -162,6 +181,17 @@ log-check-result "$(x) : no" ; } } + if ! $(value) + { + if $(result) + { + config-cache.set $(cache-name) : true ; + } + else + { + config-cache.set $(cache-name) : false ; + } + } return $(result) ; } else Index: build/project.jam =================================================================== --- build/project.jam (revision 80856) +++ build/project.jam (working copy) @@ -114,6 +114,19 @@ } +# Returns the path to the project root of location if +# it exists. Otherwise returns nothing. +# +rule find-project-root ( location ) +{ + local found = [ path.glob-in-parents $(location) : $(JAMROOT) ] ; + if $(found) + { + return [ path.parent $(found) ] ; + } +} + + # Returns the project module corresponding to the given project-id or plain # directory name. Returns nothing if such a project can not be found. # @@ -409,6 +422,12 @@ } +rule global-build-dir ( ) +{ + return $(.global-build-dir) ; +} + + # Initialize the module for a project. # rule initialize ( Index: build-system.jam =================================================================== --- build-system.jam (revision 80856) +++ build-system.jam (working copy) @@ -27,6 +27,7 @@ import utility ; import version ; import virtual-target ; +import config-cache ; ################################################################################ @@ -538,6 +539,8 @@ version.verify-engine-version ; + config-cache.load ; + load-configuration-files ; # Load explicitly specified toolset modules. @@ -736,6 +739,7 @@ actual-targets += [ $(t).actualize ] ; } + config-cache.save ; # If XML data output has been requested prepare additional rules and targets # so we can hook into Jam to collect build data while its building and have Index: test/BoostBuild.py =================================================================== --- test/BoostBuild.py (revision 80856) +++ test/BoostBuild.py (working copy) @@ -702,6 +702,7 @@ # Boost Build's 'configure' functionality (unfinished at the time) # produces this file. self.ignore("bin/config.log") + self.ignore("project-cache.jam") # Compiled Python files created when running Python based Boost Build. self.ignore("*.pyc")