Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team 5 - Hello World Graph #30

Open
wants to merge 1 commit into
base: team5-hw1
Choose a base branch
from

Conversation

qianxichen233
Copy link
Collaborator

@qianxichen233 qianxichen233 commented Dec 13, 2024

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