Skip to content

Commit c6182c8

Browse files
committed
Move some pieces around in builder docs
This is part of unmerged PR SCons#4671. This change moves two short sections around: * The note on builders and dependencies is moved to before the listing of methods be consistent with the other three sections of this type: all "descriptive text" followed by included generated listing, with no text following that. * The note on debugging user-written builders moves from the Builder Methods section to the Builder Objects section, where it seems more natural: the need to debug a builder seems a lot less likely with the pre-built Builders. Some rewording, as well. Signed-off-by: Mats Wichmann <mats@linux.com>
1 parent b2d2404 commit c6182c8

File tree

3 files changed

+64
-59
lines changed

3 files changed

+64
-59
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
182182
support batch mode (currently: Windows). Change the way the changed
183183
and unchanged target and source lists are accounted for to resolve.
184184
Fixes #3029.
185+
- Improve documentation of builder methods and builder objects.
185186

186187

187188
RELEASE 4.9.1 - Thu, 27 Mar 2025 11:40:20 -0700

RELEASE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ DOCUMENTATION
154154

155155
- Improve the wording of AppendENVPath and PrependENVPath in manpage.
156156

157+
- Improve documentation of builder methods and builder objects.
158+
157159
DEVELOPMENT
158160
-----------
159161

doc/man/scons.xml

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,64 +3281,6 @@ bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
32813281
print("The path to bar_obj is:", str(bar_obj_list[0]))
32823282
</programlisting>
32833283

3284-
<para>Note that because the Builder call returns a
3285-
<classname>NodeList</classname>,
3286-
you have to access the first element in the list
3287-
(<literal>bar_obj_list[0]</literal> in the example)
3288-
to get at the Node that actually represents
3289-
the object file.</para>
3290-
3291-
<para>
3292-
When trying to handle errors that may occur in a builder method,
3293-
consider that the corresponding Action is executed at a different
3294-
time than the &SConscript; file statement calling the builder.
3295-
It is not useful to wrap a builder call in a
3296-
<systemitem>try</systemitem> block,
3297-
since success in the builder call is not the same as
3298-
the builder itself succeeding.
3299-
If necessary, a Builder's Action should be coded to exit with
3300-
a useful exception message indicating the problem in the &SConscript; files -
3301-
programmatically recovering from build errors is rarely useful.
3302-
</para>
3303-
3304-
<para>
3305-
The following builder methods are predefined in the
3306-
&SCons; core software distribution.
3307-
Depending on the setup of a particular
3308-
&consenv; and on the type and software
3309-
installation status of the underlying system,
3310-
not all builders may be available in that
3311-
&consenv;.
3312-
Since the function calling signature is the same for all builders:
3313-
</para>
3314-
<programlisting language="python">
3315-
<function>Buildername</function>(<parameter>target, source, [key=val, ...]</parameter>)
3316-
</programlisting>
3317-
<para>
3318-
it is omitted in this listing for brevity.
3319-
</para>
3320-
3321-
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3322-
<!-- '\" BEGIN GENERATED BUILDER DESCRIPTIONS -->
3323-
3324-
<!-- '\" The descriptions below of the various SCons Builders are generated -->
3325-
<!-- '\" from the .xml files located together with the various Python -->
3326-
<!-- '\" builder modules in the build engine directory -->
3327-
3328-
<!-- '\" BEGIN GENERATED BUILDER DESCRIPTIONS -->
3329-
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3330-
<xsi:include xmlns:xsi="http://www.w3.org/2001/XInclude" href="../generated/builders.gen"/>
3331-
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3332-
<!-- '\" END GENERATED BUILDER DESCRIPTIONS -->
3333-
3334-
<!-- '\" The descriptions abocve of the various SCons Builders are generated -->
3335-
<!-- '\" from the .xml files located together with the various Python -->
3336-
<!-- '\" builder modules in the build engine directory -->
3337-
3338-
<!-- '\" END GENERATED BUILDER DESCRIPTIONS -->
3339-
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3340-
3341-
33423284
<para>All
33433285
targets of builder methods automatically depend on their sources.
33443286
An explicit dependency can
@@ -3387,13 +3329,58 @@ and using the
33873329
<classname>SourceFileScanner</classname>
33883330
object.</para>
33893331

3332+
3333+
<para>Note that because the Builder call returns a
3334+
<classname>NodeList</classname>,
3335+
you have to access the first element in the list
3336+
(<literal>bar_obj_list[0]</literal> in the example)
3337+
to get at the Node that actually represents
3338+
the object file.</para>
3339+
3340+
<para>
3341+
The following builder methods are predefined in the
3342+
&SCons; core software distribution.
3343+
Depending on the setup of a particular
3344+
&consenv; and on the type and software
3345+
installation status of the underlying system,
3346+
not all builders may be available in that
3347+
&consenv;.
3348+
Since the function calling signature is the same for all builders:
3349+
</para>
3350+
<programlisting language="python">
3351+
<function>Buildername</function>(<parameter>target, source, [key=val, ...]</parameter>)
3352+
</programlisting>
3353+
<para>
3354+
it is omitted in this listing for brevity.
3355+
</para>
3356+
3357+
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3358+
<!-- '\" BEGIN GENERATED BUILDER DESCRIPTIONS -->
3359+
3360+
<!-- '\" The descriptions below of the various SCons Builders are generated -->
3361+
<!-- '\" from the .xml files located together with the various Python -->
3362+
<!-- '\" builder modules in the build engine directory -->
3363+
3364+
<!-- '\" BEGIN GENERATED BUILDER DESCRIPTIONS -->
3365+
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3366+
<xsi:include xmlns:xsi="http://www.w3.org/2001/XInclude" href="../generated/builders.gen"/>
3367+
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3368+
<!-- '\" END GENERATED BUILDER DESCRIPTIONS -->
3369+
3370+
<!-- '\" The descriptions abocve of the various SCons Builders are generated -->
3371+
<!-- '\" from the .xml files located together with the various Python -->
3372+
<!-- '\" builder modules in the build engine directory -->
3373+
3374+
<!-- '\" END GENERATED BUILDER DESCRIPTIONS -->
3375+
<!-- '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
3376+
33903377
</refsect2>
33913378

33923379
<refsect2 id='env_methods'>
33933380
<title>&SCons; Functions and Environment Methods</title>
33943381

33953382
<para>
3396-
&SCons; provides a variety of &consenv; methods
3383+
&SCons; provides a variety of &consenv; methods
33973384
and global functions to manipulate the build configuration.
33983385
Often, a &consenv; method and a global function with
33993386
the same name exist for convenience.
@@ -6484,6 +6471,21 @@ and
64846471
<link linkend='emitter_function'>emitter functions</link>.
64856472
</para>
64866473

6474+
<para>
6475+
When debugging errors in a custom builder method,
6476+
remember that the builder's Action is executed asynchronously -
6477+
the builder call in the &SConscript; only instructs
6478+
&SCons; what you want built, while the actual building is
6479+
scheduled later (if necessary) by the taskmaster.
6480+
As a result, wrapping a builder call in a
6481+
<systemitem>try</systemitem> block is not useful,
6482+
as success in the builder call is not the same as
6483+
the build itself succeeding.
6484+
If necessary, code a builder's Action to exit with
6485+
a useful error message indicating the problem in the &SConscript; file.
6486+
Attempting programmatic recovery from build errors is rarely useful.
6487+
</para>
6488+
64876489
</refsect2>
64886490

64896491
<refsect2 id='action_objects'>

0 commit comments

Comments
 (0)