diff options
author | Barry Haddow <barry.haddow@gmail.com> | 2012-09-27 01:50:48 +0400 |
---|---|---|
committer | Barry Haddow <barry.haddow@gmail.com> | 2012-09-27 01:50:48 +0400 |
commit | 9931a1e0fd84fa0cd2a149fde0b67ccd54b4b65c (patch) | |
tree | 07590a018a7ea586b0ba0f4414cb834863a4c54b /jam-files | |
parent | 0a950ee9f4227c8afbbe58d03a854745479ffbc0 (diff) | |
parent | bc866f37ff13251e9c8cf8548669f788449d9238 (diff) |
Merge remote branch 'github/master' into miramerge
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) ; } } |