Back to Contributing / Oil Dev Cheat Sheet
./NINJA-config.sh does two things:
build/dynamic_deps.py to figure out dependencies of Python code generatorsbuild/NINJA_main.py to write build.ninja, which is the default file that ninja looks at.build.ninja has many targets due to the build variants we use: dbg, opt, asan, ubsan, coverage, etc. All of these tools find bugs, help measure performance, or let us use other C++ introspection tools! They help us with the difficult task of writing and testing the garbage-collected C++ runtime.NINJA_main.py imports the files {build,cpp,mycpp}/NINJA_subgraph.py
Each of those files writes a subset of the NINJA rules (a "subgraph").
BUILD file in Google's build system Bazel, but not quite. We should probably move more toward that structure, where the build config lives next to the source files. That is, EVERY dir will have NINJA_subgraph.py, and the build and tests for osh could be in osh/NINJA_subgraph.py, not in build/NINJA_subgraph.py.There are essentially only two statements in Ninja: rule and build.
build defines a graph edge from multiple inputs to (potentially) multiple outputsrule tells what action to perform
build/NINJA-steps.sh_bin/shwrap/${foo}_main, which allows us to get incremental builds right with textual code generation
frontend/consts.py, then that should invalidate frontend/consts_gen.py, which will invalidate _gen/frontend/consts.{cc,h}.gcc -MD with the Makefile fragments and .d files.The incremental build is correct in almost all cases. EXCEPTIONS:
frontend/lexer_def.py), ninja _bin/cxx-dbg/osh_eval won't reflect it. Because that is shared with the Python build build/py.sh all.*/NINJA-steps.sh, it won't be reflected. (TODO: add these as implicit deps?)CXXFLAGS='-D ALLOCLOG' ninja, then objects in _build/obj/cxx-dbg will be compiled differently. And then future incremental builds may not be correct.2022-09-06
GC_RUNTIME var in mycpp/NINJA_subgraph.py
./NINJA-config.sh; ninjamycpp/NINJA_subgraph.pyWe are using the clang-format / IWYU / "Google" style.
Details: https://google.github.io/styleguide/cppguide.html
Summary:
#include guardstest/lint.sh format-cpp