diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-09-26 22:14:26 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-09-26 22:14:26 +0400 |
commit | bc866f37ff13251e9c8cf8548669f788449d9238 (patch) | |
tree | 0eb6545172c4e1fbb09b42c4efd9b86bd6290a66 /jam-files | |
parent | bf81bdeda58eed12d971c001add9a031219a9efb (diff) |
New approach to forcing recompiles
Fixes annoying problem that unsuccessful build iterations would keep rebuilding Factory.o and CompactPT
Diffstat (limited to 'jam-files')
-rw-r--r-- | jam-files/sanity.jam | 47 |
1 files changed, 13 insertions, 34 deletions
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 <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 <dependency>$(file) to force +#recompilation. +rule update-if-changed ( file current ) { + if ( ! [ path.exists $(file) ] ) || ( [ _shell "cat $(file)" ] != $(current) ) { + make $(file) : : $(__name__).write-options : <options-to-write>$(current) ; + always $(file) ; } } |