diff options
author | grbd <garlicbready@googlemail.com> | 2017-09-23 18:25:46 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-09-24 19:20:19 (GMT) |
commit | 8c32eaea7c88346e7a187fe501c9997ef623ad3f (patch) | |
tree | e03009988c21c930311161e51b32105211b6f2a8 /doc/user/scanners.xml | |
parent | 6a72c4de3e92cae65016578270e6f68e66c4f1e8 (diff) | |
download | SCons-8c32eaea7c88346e7a187fe501c9997ef623ad3f.zip SCons-8c32eaea7c88346e7a187fe501c9997ef623ad3f.tar.gz SCons-8c32eaea7c88346e7a187fe501c9997ef623ad3f.tar.bz2 |
addition to user docs
Diffstat (limited to 'doc/user/scanners.xml')
-rw-r--r-- | doc/user/scanners.xml | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index 1506254..fd4bc6c 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -410,6 +410,59 @@ kscan = Scanner(function = kfile_scan, This is important since many files get scanned in a typical build. </para> - </section> + </section> + + <section> + <title>Using scanners with Builders</title> + + <para> + + One approach for the use of scanners is with builders. + There are two optional parameters we can use with a builder + <literal>source_scanner</literal> and <literal>target_scanner</literal>. + + </para> + + <scons_example name="scanners_builders"> + <file name="SConstruct" printme="1"> + +def kfile_scan(node, env, path, arg): + contents = node.get_text_contents() + return env.File(include_re.findall(contents)) + +kscan = Scanner(function = kfile_scan, + skeys = ['.k'], + path_function = FindPathDirs('KPATH')) + +def build_function(target, source, env): + # Code to build "target" from "source" + return None + +bld = Builder(action = build_function, + suffix = '.foo', + source_scanner = kscan + src_suffix = '.input') +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file') + + </file> + </scons_example> + + <para> + + An emiter function can modify the list of sources or targets + passed to the action function when the builder is triggered. + + </para> + + <para> + + A scanner function will not affect the list of sources or targets + seen by the builder during the build action. The scanner function + will however affect if the builder should be rebuilt (if any of + the files sourced by the scanner have changed for example). + + </para> + </section> -</chapter> +</chapter>
\ No newline at end of file |