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.
This PR is an experiment that adds a build option to Ninja, allowing it to skip the parsing step (i.e., parsing
build.ninja
) and instead manually set up the dependency graph in memory, passing it directly torunBuild
.To use it, after building Ninja, run
./ninja hello
inside thehello_world_graph
folder. This will generate the "Hello World" binary without the need for abuild.ninja
file.Related Files and Their Functionality (in Suggested Review Order):
shadowdash_docs/hello_world_graph_docs.md
: detailed documentation for hello world graph tasksrc/ninja.cc
: main changes for the task.circleci/config.yml
: Added test for hello world graphhello_world_graph/hello_world_graph_test.sh
: main test script for hello world graphhello_world_graph/hello.cc
: target example hello world programWhy use a command-line option (i.e., requiring
hello
to be passed toninja
) instead of creating a separate build binary specifically for the "Hello World" program (e.g., running./ninja_hello
directly in thehello_world_graph
folder)?While it is possible to create a dedicated binary, which would be clearer, all the relevant classes like
NinjaMain
exist only inninja.cc
, and there isn’t something like aninja.h
header file. In order to useNinjaMain
to continue the build process after the graph is created, we would need to refactorninja.cc
into a header file (ninja.h
) so that other source files could utilizeNinjaMain
.Since I guess this task is more of an experiment, I have not done that refactoring at this point.
Here is the link to the successful CircleCI run.