From bc866f37ff13251e9c8cf8548669f788449d9238 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Wed, 26 Sep 2012 19:14:26 +0100 Subject: New approach to forcing recompiles Fixes annoying problem that unsuccessful build iterations would keep rebuilding Factory.o and CompactPT --- jam-files/sanity.jam | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) (limited to 'jam-files') diff --git a/jam-files/sanity.jam b/jam-files/sanity.jam index a2616f6bf..6beec3f94 100644 --- a/jam-files/sanity.jam +++ b/jam-files/sanity.jam @@ -235,42 +235,21 @@ rule add-post-hook ( names * ) { post-hooks += $(names) ; } - -#Backend for writing content to files after build completes. -post-files = ; -post-contents = ; -rule save-post-build ( ok ? ) { - if $(ok) { - while $(post-files) { - local ignored = @($(post-files[1]):E=$(post-contents[1])) ; - post-files = $(post-files[2-]) ; - post-contents = $(post-contents[2-]) ; - } - } -} -add-post-hook save-post-build ; - -#Queue content to be written to file when build completes successfully. -rule add-post-write ( name content ) { - post-files += $(name) ; - post-contents += $(content) ; +import feature : feature ; +feature options-to-write : : free ; +import toolset : flags ; +flags write-options OPTIONS-TO-WRITE ; +actions write-options { + echo "$(OPTIONS-TO-WRITE)" > $(<) ; } -#Compare contents of file with current. If they're different, force the targets to rebuild then overwrite the file. -rule always-if-changed ( file current : targets * ) { - local previous = inconsistent ; - if [ path.exists $(file) ] { - previous = [ _shell "cat $(file)" ] ; - } - if $(current) != $(previous) { - #Write inconsistent while the build is running - if [ path.exists $(file) ] { - local ignored = @($(file):E=inconsistent) ; - } - add-post-write $(file) $(current) ; - for local i in $(targets) { - always $(i) ; - } +#Compare contents of file with current. If they're different, write to the +#file. This file can then be used with $(file) to force +#recompilation. +rule update-if-changed ( file current ) { + if ( ! [ path.exists $(file) ] ) || ( [ _shell "cat $(file)" ] != $(current) ) { + make $(file) : : $(__name__).write-options : $(current) ; + always $(file) ; } } -- cgit v1.2.3