[Scons-users] adding text to compile line

Gary Granger granger at ucar.edu
Sat Feb 3 17:44:39 EST 2024


Along the line of Mats email, making a long thread even longer, I wrote 
a tool to cache the last failed build command and rerun it on the next 
scons build.  The idea was to start the next scons build exactly where 
it left off, to make it a little faster to iterate on compile failures 
without reading all the scons files on subsequent build attempts.  It 
takes advantage of GetBuildFailures() to get the full expanded command 
line.  The source is here 
<https://github.com/NCAR/eol_scons/blob/master/eol_scons/tools/rerun.py>. 
I've also taken advantage of ninja output for this use case, where I 
just need to iterate on fixing source files and am not worried about the 
dependencies changing between scons runs.  However, as scons has been 
running faster over time, I've not really needed those options for our 
projects any more.

Feel free to use that code as is now, and I'm also close to changing all 
the licensing to MIT.  Or maybe GetBuildFailures() will help.

Gary

On 2/2/24 14:35, Mats Wichmann wrote:
> On 1/21/24 05:40, daggs via Scons-users wrote:
>> Greetings,
>>
>> I want to add a prefix the compile line scons is displaying, is it 
>> possible?
>
> this has been a lengthy thread, but I recall (without being able to 
> find the relevant message) your objective was to capture the build 
> lines in the midst of a lot of noise, so they could be used 
> separately.  It would be remiss not to mention that SCons has support 
> for two ways of doing that: the compilation database, and ninja build 
> support.  In both forms, SCons can generate a file with information 
> about the build.  The ninja form allows quick building with the ninja 
> tool specifically, without going through the full SCons parse/examine 
> sequence.  The compilation database is meant to feed external analysis 
> tools (and some editors) who need more context about how a file will 
> be used to be able to do complete analysis.  Maybe you might be able 
> to make use of one of these.
>
> Here, for example, is the compilation database output of a very simple 
> build used in the testsuite:
>
> [
>     {
>         "command": "/home/mats/.pyenv/versions/venv-system/bin/python 
> mygcc.py cc -o test_main.o -c test_main.c",
>         "directory": "/tmp/testcmd.1016192.7zudntn7",
>         "file": "/tmp/testcmd.1016192.7zudntn7/test_main.c",
>         "output": "/tmp/testcmd.1016192.7zudntn7/test_main.o"
>     }
> ]
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20240203/338d611e/attachment.htm>


More information about the Scons-users mailing list