SCons: Fix incremental builds breaking when querying the dependency tree from a SCsub #88025
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm querying the scons dependency tree to calculate some build information in a
SCsub
, viaSCons.Node.FS.File.children()
. This call causes scons to access the .sconsign database, to lookup the build information up to that point. When this happens on anSCsub
invoked via aSconscript()
call, the path to the .sconsign file is interpreted as being relative to the current executingSCsub
, not to the top-levelSConstruct
file.When this happens, it completely breaks incremental builds, because scons can't find build information in the "local" sconsign file (which is created on the spot with only the local
SCsub
build information), so scons decides to rebuild everything.I don't know why scons is doing this, given that all other build information is recorded on the top level sconsign file, including the build information related to the executing SCsub, but it is happening. Possibly a scons bug?
This PR sets an absolute path for
SConsignFile
, so any queries to the dependency database use the same database file, regardless of local executing SCsub context.Contributed by W4Games ❤️
/cc @akien-mga @mhilbrunner