allow dry run for builds with regeneration#2707
allow dry run for builds with regeneration#2707moritzx22 wants to merge 1 commit intoninja-build:masterfrom
Conversation
…n if a regeneration has been scheduled.
|
pacman -S ninja |
|
If "Re-running CMake..." would produce a different build manifest the dry run may then be incorrect. Not sure if this is a deal breaker. In general the "Re-checking globbed directories..." is a hack and we should find a better solution to support globbing. I've created #2709 just now to improve that situation. |
The “Re-checking globbed directories…” approach is definitely more of a workaround than a clean solution. I used globbing in my example simply because it’s something many developers are familiar with, so it makes ninjas regeneration and dry‑run behavior easier to demonstrate. |
It’s inherent to any dry‑run mechanism that it can’t be fully correct in all scenarios. During a real build, commands may generate new files, dyndeps can reshape the dependency graph, and other side effects can occur that a dry run simply cannot predict. The goal shouldn’t be perfect accuracy but usefulness—showing what Ninja plans to do, even if the actual build may differ. Proposed solutionBased on and in contrast to #2707 (comment), here’s a simple case where a dry run cannot be correct and ends up not being useful: After the rename, a real build would regenerate the manifest and proceed, but the dry run can’t know that and instead reports an error. Back to usefull |
Problem Description
The dry run
ninja -ndoes not help very much if a regeneration is scheduled.One common use case is globbing in cmake. See example below:
main.cppis on the disk.Master branch
The dry run option
-nis not very useful anymore.Proposed solution
The dry run is useful again.