Skip to content

Commit eff6740

Browse files
committed
Tweak documentation for CacheDir [skip appveyor]
Tighten up descriptions for the function and for the related command-line argument flags. Signed-off-by: Mats Wichmann <mats@linux.com>
1 parent dc70d15 commit eff6740

4 files changed

Lines changed: 76 additions & 114 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,16 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
8181
on a one-time uuid to make a path to the file.
8282
- Clarify VariantDir behavior when switching to not duplicate sources
8383
and tweak wording a bit.
84-
<<<<<<< feature/py315
8584
- Test suite: add support for Python 3.15 in the Action unit tests.
86-
=======
8785
- Update documentation of the three file-finding functions in the API
8886
(FindFile, FindInstalledFiles, FindSourceFiles) as well as FindPathDirs.
8987
Also add a test for FindFile to be sure it locates non-existing
9088
derived files as advertised.
91-
>>>>>>> master
9289
- zip tool now uses zipfile module's "from_file" method to populate
9390
ZipInfo records, rather than doing manually.
9491
- Update documentation for linking-related construction variables.
9592
Add a few more live links.
93+
- Update documentation for CacheDir and related option flags
9694

9795

9896
RELEASE 4.10.1 - Sun, 16 Nov 2025 10:51:57 -0700

RELEASE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ DOCUMENTATION
124124

125125
- Update documentation of the three file-finding functions in the API
126126
(FindFile, FindInstalledFiles, FindSourceFiles) as well as FindPathDirs.
127+
127128
- Update documentation for linking-related construction variables.
128129
Add a few more live links.
129130

131+
- Update documentation for CacheDir and related option flags
132+
130133
DEVELOPMENT
131134
-----------
132135

SCons/Environment.xml

Lines changed: 49 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -917,121 +917,83 @@ Direct
917917
&scons;
918918
to maintain a derived-file cache in
919919
<parameter>cache_dir</parameter>.
920-
The derived files in the cache will be shared
921-
among all the builds specifying the same
920+
Cached files are shared across builds that specify the same
922921
<parameter>cache_dir</parameter>.
923-
Specifying a
924-
<parameter>cache_dir</parameter>
925-
of
926-
<constant>None</constant>
927-
disables derived file caching.
922+
Setting <parameter>cache_dir</parameter>
923+
to <constant>None</constant> disables caching.
928924
</para>
929925

930926
<para>
931-
Calling the environment method
927+
The environment method
932928
&f-link-env-CacheDir;
933-
limits the effect to targets built
934-
through the specified &consenv;.
935-
Calling the global function
936-
&f-link-CacheDir;
937-
sets a global default
938-
that will be used by all targets built
939-
through &consenvs;
940-
that do not set up environment-specific
941-
caching by calling &f-env-CacheDir;.
929+
applies caching only to targets built
930+
through that specific &consenv;.
931+
The global function &f-link-CacheDir;
932+
sets a default that applies
933+
to all targets unless overridden by an
934+
environment-specific call.
942935
</para>
943936

944937
<para>
945-
Caching behavior can be configured by passing a specialized cache
946-
class as the optional <parameter>custom_class</parameter> parameter.
947-
This class must be a subclass of
948-
<classname>SCons.CacheDir.CacheDir</classname>.
949-
&SCons; will internally invoke the custom class for performing
950-
caching operations.
951-
If the parameter is omitted or set to
952-
<constant>None</constant>, &SCons; will use the default
953-
<classname>SCons.CacheDir.CacheDir</classname> class.
938+
Caching behavior can be customized by passing a subclass of
939+
<classname>SCons.CacheDir.CacheDir</classname>
940+
as the optional <parameter>custom_class</parameter> parameter.
941+
If omitted or set to <constant>None</constant>,
942+
&SCons; uses the default class.
954943
</para>
955944

956945
<para>
957-
When derived-file caching
958-
is being used and
959-
&scons;
960-
finds a derived file that needs to be rebuilt,
961-
it will first look in the cache to see if a
962-
file with matching &buildsig; exists
963-
(indicating the input file(s) and build action(s)
964-
were identical to those for the current target),
965-
and if so, will retrieve the file from the cache.
966-
&scons;
967-
will report
968-
<computeroutput>Retrieved `file' from cache</computeroutput>
969-
instead of the normal build message.
970-
If the derived file is not present in the cache,
971-
&scons;
972-
will build it and
973-
then place a copy of the built file in the cache,
974-
identified by its &buildsig;, for future use.
946+
When caching is enabled and &scons;
947+
needs to rebuild a derived file,
948+
it first checks the cache for a matching &buildsig;
949+
(indicating identical inputs and build actions).
950+
If found, the file is retrieved from the cache.
951+
Otherwise, &scons; builds the file and
952+
stores a copy the cache under its &buildsig;.
975953
</para>
976954

977955
<para>
978-
The
956+
By default, &scons; reports
979957
<computeroutput>Retrieved `file' from cache</computeroutput>
980-
messages are useful for human consumption,
981-
but less useful when comparing log files between
982-
&scons; runs which will show differences that are
983-
noisy and not actually significant.
984-
To disable,
985-
use the <option>--cache-show</option> option.
986-
With this option, &scons; changes printing
987-
to always show the action that would
988-
have been used to build the file without caching.
958+
on cache hits.
959+
Use the
960+
<link linkend="opt-cache-show"><option>--cache-show</option></link>
961+
option to hide that the cache was involved
962+
and display the normal build string instead,
963+
for consistent log output.
989964
</para>
990965

991966
<para>
992-
Derived-file caching
993-
may be disabled for any invocation
994-
of &scons; by giving the
995-
<option>--cache-disable</option>
996-
command line option;
997-
cache updating may be disabled, leaving cache
998-
fetching enabled, by giving the
999-
<option>--cache-readonly</option> option.
967+
Disable caching for a specific invocation with the
968+
<link linkend="opt-cache-disable"><option>--cache-disable</option></link>
969+
option.
970+
To allow retreival but prevent updates, use
971+
<link linkend="opt-cache-readonly"><option>--cache-readonly</option></link>.
1000972
</para>
1001973

1002974
<para>
1003-
If the
1004-
<option>--cache-force</option>
1005-
option is used,
1006-
&scons;
1007-
will place a copy of
1008-
<emphasis>all</emphasis>
1009-
derived files into the cache,
1010-
even if they already existed
1011-
and were not built by this invocation.
1012-
This is useful to populate a cache
1013-
the first time a
1014-
<parameter>cache_dir</parameter>
1015-
is used for a build,
1016-
or to bring a cache up to date after
1017-
a build with cache updating disabled
1018-
(<option>--cache-disable</option>
1019-
or <option>--cache-readonly</option>)
1020-
has been done.
975+
The
976+
<link linkend="opt-cache-force"><option>--cache-force</option></link>
977+
option copies <emphasis>all</emphasis> derived files into the cache,
978+
even pre-existing ones.
979+
This helps populate a new cache or update it
980+
after building with cache updating disabled
981+
(<link linkend="opt-cache-disable"><option>--cache-disable</option></link>
982+
or <link linkend="opt-cache-readonly"><option>--cache-readonly</option></link>).
1021983
</para>
1022984

1023985
<para>
1024-
The
986+
Use
1025987
&f-link-NoCache;
1026-
method can be used to disable caching of specific files. This can be
1027-
useful if inputs and/or outputs of some tool are impossible to
1028-
predict or prohibitively large.
988+
to exclude specific files from caching,
989+
such as those with unpredictable inputs or outputs,
990+
or excessively large output files.
1029991
</para>
1030992

1031993
<para>
1032-
Note that (at this time) &SCons; provides no facilities
1033-
for managing the derived-file cache. It is up to the developer
1034-
to arrange for cache pruning, expiry, access control, etc. if needed.
994+
&SCons; does not provide built-in tools for cache management.
995+
You will need to handle pruning, expiration,
996+
access control, and other maintenance tasks manually.
1035997
</para>
1036998

1037999
</summary>

doc/man/scons.xml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -715,10 +715,11 @@ If
715715
<replaceable>file</replaceable>
716716
is a hyphen
717717
(<literal>-</literal>),
718-
the debug information is printed to the standard output.
719-
The printed messages describe what signature-file names
720-
are being looked for in, retrieved from, or written to the
721-
derived-file cache specified by &f-link-CacheDir;.</para>
718+
the debug information is printed to standard output.
719+
The messages describe cache operations,
720+
such as which &buildsig; is being sarched for,
721+
retrieved, or stored in the cache specified by &f-link-CacheDir;.
722+
</para>
722723
</listitem>
723724
</varlistentry>
724725

@@ -731,9 +732,9 @@ derived-file cache specified by &f-link-CacheDir;.</para>
731732
<para>Disable derived-file caching.
732733
&scons;
733734
will neither retrieve files from the cache
734-
nor copy files to the cache. This option can
735-
be used to temporarily disable the cache without
736-
modifying the build scripts.
735+
nor copy files to the cache.
736+
This option allows temporarily disabling the cache without
737+
modifying build scripts.
737738
</para>
738739
</listitem>
739740
</varlistentry>
@@ -745,23 +746,22 @@ modifying the build scripts.
745746
</term>
746747
<listitem>
747748
<para>When using &f-link-CacheDir;,
748-
populate a derived-file cache by copying any already-existing,
749-
up-to-date derived files to the cache,
750-
in addition to files built by this invocation.
751-
This is useful to populate a new cache with
752-
all the current derived files,
753-
or to add to the cache any derived files
754-
recently built with caching disabled via the
755-
<option>--cache-disable</option>
756-
option.</para>
749+
populate a derived-file cache by copying any existing,
750+
up-to-date derived files to it,
751+
in addition to files built during this invocation.
752+
This is useful for initializing a new cache with
753+
current derived files or
754+
adding files that were recently built with caching disabled
755+
(via the <option>--cache-disable</option> option.
756+
</para>
757757
</listitem>
758758
</varlistentry>
759759

760760
<varlistentry id="opt-cache-readonly">
761761
<term><option>--cache-readonly</option></term>
762762
<listitem>
763763
<para>Use the derived-file cache, if enabled, to retrieve files,
764-
but do not not update the cache with any files actually
764+
but do not not update the cache with any files
765765
built during this invocation.
766766
</para>
767767
</listitem>
@@ -770,15 +770,14 @@ built during this invocation.
770770
<varlistentry id="opt-cache-show">
771771
<term><option>--cache-show</option></term>
772772
<listitem>
773-
<para>When using a derived-file cache, show the command
773+
<para>When using a derived-file cache, display the command
774774
that would have been executed to build the file
775775
(or the corresponding <literal>*COMSTR</literal>
776-
contents if set)
777-
even if the file is retrieved from cache.
778-
Without this option, &scons; shows a cache retrieval message
779-
if the file is fetched from cache.
780-
This allows producing consistent output for build logs,
781-
regardless of whether a target
776+
contents if set),
777+
even if the file is retrieved from the cache.
778+
Without this option, &scons; shows a cache retrieval message.
779+
This ensures consistent output in build logs,
780+
regardless of whether the
782781
file was rebuilt or retrieved from the cache.</para>
783782
</listitem>
784783
</varlistentry>

0 commit comments

Comments
 (0)