Skip to content

Team 5 - Hello World Graph - #30

Open
qianxichen233 wants to merge 1 commit into
team5-hw1from
team5-hello-world-graph
Open

Team 5 - Hello World Graph#30
qianxichen233 wants to merge 1 commit into
team5-hw1from
team5-hello-world-graph

Conversation

@qianxichen233

@qianxichen233 qianxichen233 commented Dec 13, 2024

Copy link
Copy Markdown
Collaborator

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 to runBuild.

To use it, after building Ninja, run ./ninja hello inside the hello_world_graph folder. This will generate the "Hello World" binary without the need for a build.ninja file.


Related Files and Their Functionality (in Suggested Review Order):

  1. shadowdash_docs/hello_world_graph_docs.md: detailed documentation for hello world graph task
  2. src/ninja.cc: main changes for the task
  3. .circleci/config.yml: Added test for hello world graph
  4. hello_world_graph/hello_world_graph_test.sh: main test script for hello world graph
  5. hello_world_graph/hello.cc: target example hello world program

Why use a command-line option (i.e., requiring hello to be passed to ninja) instead of creating a separate build binary specifically for the "Hello World" program (e.g., running ./ninja_hello directly in the hello_world_graph folder)?

While it is possible to create a dedicated binary, which would be clearer, all the relevant classes like NinjaMain exist only in ninja.cc, and there isn’t something like a ninja.h header file. In order to use NinjaMain to continue the build process after the graph is created, we would need to refactor ninja.cc into a header file (ninja.h) so that other source files could utilize NinjaMain.

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.

@qianxichen233
qianxichen233 requested a review from kyotov December 13, 2024 03:17
added documentation

updated ninja.cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant