Team 5 - Hello World Graph - #30
Open
qianxichen233 wants to merge 1 commit into
Open
Conversation
added documentation updated ninja.cc
qianxichen233
force-pushed
the
team5-hello-world-graph
branch
from
December 13, 2024 03:20
a599f98 to
503cc84
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 helloinside thehello_world_graphfolder. This will generate the "Hello World" binary without the need for abuild.ninjafile.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
helloto be passed toninja) instead of creating a separate build binary specifically for the "Hello World" program (e.g., running./ninja_hellodirectly in thehello_world_graphfolder)?While it is possible to create a dedicated binary, which would be clearer, all the relevant classes like
NinjaMainexist only inninja.cc, and there isn’t something like aninja.hheader file. In order to useNinjaMainto continue the build process after the graph is created, we would need to refactorninja.ccinto 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.