-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
When reading about how ninja
, one of my first thoughts was that why not use ninja itself bootstrap the build.ninja
file?
I tried googling this topic, but haven't really found anything, other than some closed issues concerning problems when regenerating build.ninja
, but nothing directly about using a build.ninja
-stub to bootstrap the project.
Looking at the build.ninja
of this project, it at least contains a passage to regenerate its contents when ./configure
is changed:
# Regenerate build files if build script changes.
rule configure
command = ${configure_env}python3 $root/configure.py $configure_args
generator = 1
build build.ninja: configure | $root/configure.py $root/misc/ninja_syntax.py
So my questions are:
Why not have that part in an otherwise empty build.ninja
, so that the user can just run ninja
the first time and the project bootstraps itself?
Does the build.ninja
get reloaded by the running ninja
process when it changes?
As in would running ninja manual
succeed in generating doc/manual.html
?
If the answer to these questions is "yes" it would be nice for those details to be part of the manual and maybe documented as potential pattern to use to bootstrap projects.
Though arguably writing to a source-controlled file might be a bad idea, instead one could write to an build.ninja
file contained in the build directory and include
that? (Does changing those cause ninja
re-source them? And would ninja
run when the file path doesn't exist currently, but is defined as a build target?)
If the answer is "no", it would be good to document that as gotcha and might be a potentially neat feature to consider in the future.
I would of cause be open to discuss this topic either here, or on the mailing list.