-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Explain the last build execution, similar to ninja -d explain but after the fact and more detailed. In big projects during incremental development sometimes more files than expected get built. This is almost always mysterious and hard to diagnose. Typical console output looks like that:
$ cd build
$ ninja stuff
[1/2] Building CXX object CMakeFiles/stuff.dir/src/stuff.cc.o
[2/2] Linking CXX executable stuff
# change file in editor
$ ninja stuff
[1/2] Building CXX object CMakeFiles/stuff.dir/src/stuff.cc.o
[2/2] Linking CXX executable stuff
# change file in editor
$ ninja stuff
[1/100] Building CXX object CMakeFiles/lib-a/foo.cc.o
[2/100] Building CXX object CMakeFiles/lib-a/bar.cc.o
[3/100] Building CXX object CMakeFiles/lib-a/baz.cc.o
[4/100] Building CXX object CMakeFiles/lib-b/quux.cc.o
[5/100] Building CXX object CMakeFiles/lib-c/waldo.cc.o
[6/100] Building CXX object CMakeFiles/lib-c/fred.cc.o
^C
# what just happened?What could have happened is that a system package got updated, updating the timestamp of some system header. Or some dependency on a global share was touched by some cron job that always runs during lunch time… Unfortunately, after the fact this is very hard to investigate. For every execution the explain data should be logged to some default log file in the build directory so this information can be retrieved after the fact. Also, the data needs to be output in a way such that it is readable by people not familiar with the inner workings of ninja. Current ninja -d explain output just saying this or that is "dirty" is not very useful.
Additionally, when the manifest is rebuilt (causing commands to update or dependencies to change) this should ideally also be recorded in a way that can be reported in a useful way later.