LUMIERA.clone/admin/scons
Ichthyostega d24e025de2 Build: chase down and solve spurious SVG icon rebuilds
Many years ago, I integrated the IconSvgRenderer (written by Joel Holdsworth)
directly into the SCons build by means of a custom builder with an ''emitter function''.

The build as such works fine and automatically determines which icons can be
generated from a given SVG source. However, those SVG icons tend to be rebuilt
very frequently, even while none of the SVG sources has changed.

Basically this was more of an annoyance, since we have now about 15 icons
and the rendering is really fast ... it is just ugly, especially on
incremental builds (and it could become a problem once we have a
massive amount of graphics to process.

So I took the opportunity to take close look now, since I am doing
uninspiring clean-up work since several weeks now. But that problem
turned out to be quite insidious and hard to spot.

First, AI set me off into a completely wrong angle, since it is ''not''
caused by a missing string representation of the custom Action class.
However, from there I went to watching the target checks with the debugger,
and this eventually got me to realise, that SCons mistakenly detects
a change in the Executor / the Action class.

The root cause is, that we invoke Python code from an external Module,
IconSvgRenderer.py, and this is »materialised« by SCons automatically
into a string representation, which includes memory addresses of functions
in that module. And that yields a signature, that is, quite obviously,
not stable, even while you end up sometimes with loading the code to
the same memory location.

As a solution / workaround, we now subclass the standard implementation
from SCons and override the signature function; instead of fingerprinting
the binary code, we just compute a MD5 over the python source file,
which can be easily achieved with the help of the File-Node from SCons.

Essential resources:
https://scons.org/doc/4.8.0/HTML/scons-user.html#chap-builders-writing

...and the Reference / Manpage of SCons
https://scons.org/doc/4.8.0/HTML/scons-man.html#action_objects

SCons/Action.py
SCons/Node/__init__.py
2025-11-27 18:15:49 +01:00
..
BuilderDoxygen.py Upgrade: Scons Doxygen Builder from 2022 2025-04-08 04:17:57 +02:00
Buildhelper.py Build: some further code clean-up and documentation 2025-11-27 18:21:22 +01:00
DIR_INFO Anchor: Directory for Scons tools 2025-04-08 04:10:02 +02:00
IconSvgRenderer.py clean-up: trifles 2025-06-07 23:59:57 +02:00
LumieraEnvironment.py Build: chase down and solve spurious SVG icon rebuilds 2025-11-27 18:15:49 +01:00
Options.py Build: configuring via environment is bad practice 2025-11-16 02:09:24 +01:00
Platform.py Build: some further code clean-up and documentation 2025-11-27 18:21:22 +01:00
Setup.py Build: chase down and solve spurious SVG icon rebuilds 2025-11-27 18:15:49 +01:00
ToolCCache.py Upgrade: adapt to use Scons 4.x which uses Python 3 2025-03-16 16:38:07 +01:00
ToolDistCC.py Upgrade: adapt to use Scons 4.x which uses Python 3 2025-03-16 16:38:07 +01:00